From f95be79e9aeec35d5cd22ec6c0bede161d6975fb Mon Sep 17 00:00:00 2001 From: Jaz White Date: Fri, 7 Jan 2022 14:09:20 -0500 Subject: [PATCH 01/11] Fix misspelling of "precedence" in log message (#34428) --- packages/gatsby/src/bootstrap/__tests__/redirects-writer.ts | 2 +- packages/gatsby/src/bootstrap/redirects-writer.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/gatsby/src/bootstrap/__tests__/redirects-writer.ts b/packages/gatsby/src/bootstrap/__tests__/redirects-writer.ts index ada1749be3398..63a3b5fc5b091 100644 --- a/packages/gatsby/src/bootstrap/__tests__/redirects-writer.ts +++ b/packages/gatsby/src/bootstrap/__tests__/redirects-writer.ts @@ -108,7 +108,7 @@ describe(`redirect-writer`, () => { const warningMessage = reporterWarnMock.mock.calls[0][0] expect(warningMessage).toMatchInlineSnapshot(` - "There are routes that match both page and redirect. Pages take precendence over redirects so the redirect will not work: + "There are routes that match both page and redirect. Pages take precedence over redirects so the redirect will not work: - page: \\"/server-overlap\\" and redirect: \\"/server-overlap/\\" -> \\"/server-overlap/redirect/\\" - page: \\"/client-overlap/\\" and redirect: \\"/client-overlap\\" -> \\"/client-overlap/redirect/\\"" `) diff --git a/packages/gatsby/src/bootstrap/redirects-writer.ts b/packages/gatsby/src/bootstrap/redirects-writer.ts index d8879033a2bc6..e6db08c22df55 100644 --- a/packages/gatsby/src/bootstrap/redirects-writer.ts +++ b/packages/gatsby/src/bootstrap/redirects-writer.ts @@ -47,7 +47,7 @@ export const writeRedirects = async (): Promise => { if (redirectMatchingPageWarnings.length > 0) { reporter.warn( - `There are routes that match both page and redirect. Pages take precendence over redirects so the redirect will not work:\n${redirectMatchingPageWarnings.join( + `There are routes that match both page and redirect. Pages take precedence over redirects so the redirect will not work:\n${redirectMatchingPageWarnings.join( `\n` )}` ) From 024d298e9d38386327dd44744ce877368a3261c6 Mon Sep 17 00:00:00 2001 From: Ward Peeters Date: Mon, 10 Jan 2022 09:53:51 +0100 Subject: [PATCH 02/11] fix(gatsby-plugin-manifest): generate icons sequentially (#34331) --- packages/gatsby-plugin-manifest/.babelrc | 8 +++++++- .../gatsby-plugin-manifest/src/gatsby-browser.js | 7 +++++-- .../gatsby-plugin-manifest/src/gatsby-node.js | 16 ++++++---------- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/packages/gatsby-plugin-manifest/.babelrc b/packages/gatsby-plugin-manifest/.babelrc index 31043522b2321..7094b00b614c2 100644 --- a/packages/gatsby-plugin-manifest/.babelrc +++ b/packages/gatsby-plugin-manifest/.babelrc @@ -1,3 +1,9 @@ { - "presets": [["babel-preset-gatsby-package", { "browser": true }]] + "presets": [["babel-preset-gatsby-package"]], + "overrides": [ + { + "test": ["**/gatsby-browser.js"], + "presets": [["babel-preset-gatsby-package", { "browser": true, "esm": true }]] + } + ] } diff --git a/packages/gatsby-plugin-manifest/src/gatsby-browser.js b/packages/gatsby-plugin-manifest/src/gatsby-browser.js index ec4f55c157d2b..7800ae70bec94 100644 --- a/packages/gatsby-plugin-manifest/src/gatsby-browser.js +++ b/packages/gatsby-plugin-manifest/src/gatsby-browser.js @@ -3,8 +3,11 @@ import { withPrefix } from "gatsby" import getManifestForPathname from "./get-manifest-pathname" // when we don't have localisation in our manifest, we tree shake everything away -if (__MANIFEST_PLUGIN_HAS_LOCALISATION__) { - exports.onRouteUpdate = function ({ location }, pluginOptions) { +export const onRouteUpdate = function onRouteUpdate( + { location }, + pluginOptions +) { + if (__MANIFEST_PLUGIN_HAS_LOCALISATION__) { const { localize } = pluginOptions const manifestFilename = getManifestForPathname( location.pathname, diff --git a/packages/gatsby-plugin-manifest/src/gatsby-node.js b/packages/gatsby-plugin-manifest/src/gatsby-node.js index 01234cbccceca..bed101a18790d 100644 --- a/packages/gatsby-plugin-manifest/src/gatsby-node.js +++ b/packages/gatsby-plugin-manifest/src/gatsby-node.js @@ -220,11 +220,9 @@ const makeManifest = async ({ async function processIconSet(iconSet) { // if cacheBusting is being done via url query icons must be generated before cache busting runs if (cacheMode === `query`) { - await Promise.all( - iconSet.map(dstIcon => - checkCache(cache, dstIcon, icon, iconDigest, generateIcon) - ) - ) + for (const dstIcon of iconSet) { + await checkCache(cache, dstIcon, icon, iconDigest, generateIcon) + } } if (cacheMode !== `none`) { @@ -237,11 +235,9 @@ const makeManifest = async ({ // if file names are being modified by cacheBusting icons must be generated after cache busting runs if (cacheMode !== `query`) { - await Promise.all( - iconSet.map(dstIcon => - checkCache(cache, dstIcon, icon, iconDigest, generateIcon) - ) - ) + for (const dstIcon of iconSet) { + await checkCache(cache, dstIcon, icon, iconDigest, generateIcon) + } } return iconSet From 521cf43e94fbdc6b96a7c8dee4b3d28b2ffa6a31 Mon Sep 17 00:00:00 2001 From: Lennart Date: Mon, 10 Jan 2022 11:37:49 +0100 Subject: [PATCH 03/11] Revert "docs: Match egghead.io video instructions (#34315)" (#34384) --- docs/tutorial/building-a-theme.md | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/docs/tutorial/building-a-theme.md b/docs/tutorial/building-a-theme.md index 32733dea4fa2a..756dbf6d1b002 100644 --- a/docs/tutorial/building-a-theme.md +++ b/docs/tutorial/building-a-theme.md @@ -2,7 +2,7 @@ title: Building a Theme --- -In this tutorial, you'll learn how to build a theme plugin for Gatsby. This tutorial is meant as a written companion to the [Gatsby Theme Authoring Egghead course](https://egghead.io/courses/gatsby-theme-authoring). +In this tutorial, you'll learn how to build a theme plugin for Gatsby. This tutorial is meant as a written companion to the [Gatsby Theme Authoring Egghead course](https://egghead.io/courses/gatsby-theme-authoring). **Note:** The video instructions are slightly outdated at times, thus the written instructions here are the source of truth. ## Set up yarn workspaces @@ -47,12 +47,7 @@ In the `package.json` file in `gatsby-theme-events`, add the following: "name": "gatsby-theme-events", "version": "1.0.0", "main": "index.js", - "license": "MIT", - "scripts": { - "build": "gatsby build", - "develop": "gatsby develop", - "clean": "gatsby clean" - } + "license": "MIT" } ``` @@ -134,7 +129,7 @@ If you run `yarn workspaces info`, you'll be able to verify that the site is usi ### Add peer dependencies to `gatsby-theme-events` -Targeting the `gatsby-theme-events` workspace, install `gatsby`, `react`, and `react-dom` as peer and development dependencies: +Targeting the `gatsby-theme-events` workspace, install `gatsby`, `react`, and `react-dom` as peer dependencies: ```shell yarn workspace gatsby-theme-events add -P gatsby react react-dom @@ -142,12 +137,6 @@ yarn workspace gatsby-theme-events add -P gatsby react react-dom > 💡 The `-P` flag is shorthand for installing peer dependencies. -```shell -yarn workspace gatsby-theme-events add -D gatsby react react-dom -``` - -> 💡 The `-D` flag is shorthand for installing development dependencies. - The `gatsby-theme-events/package.json` file should now include the following: ```json:title=gatsby-theme-events/package.json @@ -156,12 +145,6 @@ The `gatsby-theme-events/package.json` file should now include the following: "gatsby": "^3.0.0", "react": "^17.0.0", "react-dom": "^17.0.0" - }, - { - "devDependencies": { - "gatsby": "^3.0.0", - "react": "^17.0.0", - "react-dom": "^17.0.0" } } ``` From 08c998b04a58cf3e116ed33e797005a9143ad739 Mon Sep 17 00:00:00 2001 From: Ty Hopp Date: Tue, 11 Jan 2022 17:06:06 +0800 Subject: [PATCH 04/11] chore(release): Publish next - gatsby-cli@4.6.0-next.1 - gatsby-plugin-create-client-paths@4.6.0-next.1 - gatsby-plugin-manifest@4.6.0-next.1 - gatsby-source-wordpress@6.6.0-next.1 - gatsby-worker@1.6.0-next.1 - gatsby@4.6.0-next.1 --- packages/gatsby-cli/package.json | 2 +- packages/gatsby-plugin-create-client-paths/package.json | 2 +- packages/gatsby-plugin-manifest/package.json | 2 +- packages/gatsby-source-wordpress/package.json | 2 +- packages/gatsby-worker/package.json | 2 +- packages/gatsby/package.json | 6 +++--- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/gatsby-cli/package.json b/packages/gatsby-cli/package.json index 14f80b109d8ec..20dc1d740e464 100644 --- a/packages/gatsby-cli/package.json +++ b/packages/gatsby-cli/package.json @@ -1,7 +1,7 @@ { "name": "gatsby-cli", "description": "Gatsby command-line interface for creating new sites and running Gatsby commands", - "version": "4.6.0-next.0", + "version": "4.6.0-next.1", "author": "Kyle Mathews ", "bin": { "gatsby": "cli.js" diff --git a/packages/gatsby-plugin-create-client-paths/package.json b/packages/gatsby-plugin-create-client-paths/package.json index 7123bd879596b..0ba6b76a94c50 100644 --- a/packages/gatsby-plugin-create-client-paths/package.json +++ b/packages/gatsby-plugin-create-client-paths/package.json @@ -1,7 +1,7 @@ { "name": "gatsby-plugin-create-client-paths", "description": "Gatsby-plugin for creating paths that exist only on the client", - "version": "4.6.0-next.0", + "version": "4.6.0-next.1", "author": "scott.eckenthal@gmail.com", "bugs": { "url": "https://github.com/gatsbyjs/gatsby/issues" diff --git a/packages/gatsby-plugin-manifest/package.json b/packages/gatsby-plugin-manifest/package.json index ebaa9064a5de5..61036a3171218 100644 --- a/packages/gatsby-plugin-manifest/package.json +++ b/packages/gatsby-plugin-manifest/package.json @@ -1,7 +1,7 @@ { "name": "gatsby-plugin-manifest", "description": "Gatsby plugin which adds a manifest.webmanifest to make sites progressive web apps", - "version": "4.6.0-next.0", + "version": "4.6.0-next.1", "author": "Kyle Mathews ", "bugs": { "url": "https://github.com/gatsbyjs/gatsby/issues" diff --git a/packages/gatsby-source-wordpress/package.json b/packages/gatsby-source-wordpress/package.json index 3e707e013a8be..b795fd8cd9819 100644 --- a/packages/gatsby-source-wordpress/package.json +++ b/packages/gatsby-source-wordpress/package.json @@ -2,7 +2,7 @@ "name": "gatsby-source-wordpress", "description": "Source data from WordPress in an efficient and scalable way.", "author": "Tyler Barnes ", - "version": "6.6.0-next.0", + "version": "6.6.0-next.1", "bugs": { "url": "https://github.com/gatsbyjs/gatsby/issues" }, diff --git a/packages/gatsby-worker/package.json b/packages/gatsby-worker/package.json index fb6ed0f05c468..303fd4bf43ce3 100644 --- a/packages/gatsby-worker/package.json +++ b/packages/gatsby-worker/package.json @@ -1,7 +1,7 @@ { "name": "gatsby-worker", "description": "Utility to create worker pools", - "version": "1.6.0-next.0", + "version": "1.6.0-next.1", "author": "Michal Piechowiak", "bugs": { "url": "https://github.com/gatsbyjs/gatsby/issues" diff --git a/packages/gatsby/package.json b/packages/gatsby/package.json index a006d94dd18f4..9194cbd324f2c 100644 --- a/packages/gatsby/package.json +++ b/packages/gatsby/package.json @@ -1,7 +1,7 @@ { "name": "gatsby", "description": "Blazing fast modern site generator for React", - "version": "4.6.0-next.0", + "version": "4.6.0-next.1", "author": "Kyle Mathews ", "bin": { "gatsby": "./cli.js" @@ -77,7 +77,7 @@ "find-cache-dir": "^3.3.2", "fs-exists-cached": "1.0.0", "fs-extra": "^10.0.0", - "gatsby-cli": "^4.6.0-next.0", + "gatsby-cli": "^4.6.0-next.1", "gatsby-core-utils": "^3.6.0-next.0", "gatsby-graphiql-explorer": "^2.6.0-next.0", "gatsby-legacy-polyfills": "^2.6.0-next.0", @@ -87,7 +87,7 @@ "gatsby-plugin-utils": "^2.6.0-next.0", "gatsby-react-router-scroll": "^5.6.0-next.0", "gatsby-telemetry": "^3.6.0-next.0", - "gatsby-worker": "^1.6.0-next.0", + "gatsby-worker": "^1.6.0-next.1", "glob": "^7.2.0", "got": "^11.8.2", "graphql": "^15.7.2", From 49e071022633ec5afee73a6abed70b47257b29ea Mon Sep 17 00:00:00 2001 From: Ty Hopp Date: Tue, 11 Jan 2022 17:47:03 +0800 Subject: [PATCH 05/11] test(ssr): Fix flakes (#34443) --- integration-tests/ssr/__tests__/ssr.js | 2 +- integration-tests/ssr/test-output.js | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/integration-tests/ssr/__tests__/ssr.js b/integration-tests/ssr/__tests__/ssr.js index 9fe736f202dae..5e9e33b77bbea 100644 --- a/integration-tests/ssr/__tests__/ssr.js +++ b/integration-tests/ssr/__tests__/ssr.js @@ -33,7 +33,7 @@ describe(`SSR`, () => { expect(String(childProcess.stdout)).toContain( `testing these paths for differences between dev & prod outputs` ) - }, 15000) + }, 30000) test(`it generates an error page correctly`, async () => { const src = path.join(__dirname, `/fixtures/bad-page.js`) diff --git a/integration-tests/ssr/test-output.js b/integration-tests/ssr/test-output.js index 0a952796f7c77..c3a205bebb92f 100644 --- a/integration-tests/ssr/test-output.js +++ b/integration-tests/ssr/test-output.js @@ -47,10 +47,10 @@ async function run() { // Fetch once to trigger re-compilation. await fetch(`${devSiteBasePath}/${path}`) - // Then wait for 6 seconds to ensure it's ready to go. + // Then wait for a second to ensure it's ready to go. // Otherwise, tests are flaky depending on the speed of the testing machine. await new Promise(resolve => { - setTimeout(() => resolve(), 6000) + setTimeout(() => resolve(), 1000) }) let devStatus = 200 @@ -103,7 +103,15 @@ async function run() { paths ) - const results = await Promise.all(paths.map(p => comparePath(p))) + const results = [] + + // Run comparisons serially, otherwise recompilation fetches + // interfere with each other when run within Promise.all + for (const path of paths) { + const result = await comparePath(path) + results.push(result) + } + // Test all true if (results.every(r => r)) { process.exit(0) From 89d4e6f06ed4f0536394030ae436e4feeab85d46 Mon Sep 17 00:00:00 2001 From: Varghese Jose <71702982+varghesejose2020@users.noreply.github.com> Date: Tue, 11 Jan 2022 17:38:29 +0530 Subject: [PATCH 06/11] chore(docs): Update localization doc (#34429) * Update localization.md articles link updated * chore(docs): Update static-folder doc Fix:pace.js link * Update static-folder.md * chore(docs): Update localization doc Fix: Link w3c's i18n resources Co-authored-by: Lennart --- docs/docs/how-to/adding-common-features/localization-i18n.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/how-to/adding-common-features/localization-i18n.md b/docs/docs/how-to/adding-common-features/localization-i18n.md index c0d7660eeb02f..7ffe24787b5b3 100644 --- a/docs/docs/how-to/adding-common-features/localization-i18n.md +++ b/docs/docs/how-to/adding-common-features/localization-i18n.md @@ -57,4 +57,4 @@ This framework also has experimental support for the React suspense API and it s - [Gatsby i18n articles](https://www.gatsbyjs.com/blog/tags/localization/) -- [W3C's i18n resources](https://w3c.github.io/i18n-drafts/getting-started/contentdev.en#reference) +- [W3C's i18n resources](https://www.w3.org/International/i18n-drafts/nav/contentdev#reference) From f1dfedc01a8bf635e6199adc7a5508b345165ba9 Mon Sep 17 00:00:00 2001 From: Konrad Fedorczyk Date: Tue, 11 Jan 2022 13:15:27 +0100 Subject: [PATCH 07/11] Update media-item-processing.md (#34434) Fixed a typo. --- .../docs/features/media-item-processing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/gatsby-source-wordpress/docs/features/media-item-processing.md b/packages/gatsby-source-wordpress/docs/features/media-item-processing.md index ef4efa3f2ac70..984252924c187 100644 --- a/packages/gatsby-source-wordpress/docs/features/media-item-processing.md +++ b/packages/gatsby-source-wordpress/docs/features/media-item-processing.md @@ -26,7 +26,7 @@ For example, both of the following will be sourced: ``` -Note that there's currently a hard requirement for both kinds of url's to include `/wp-content/uploads` in order to be picked up. If your media items are stored in another directory they will not become Gatsby iamges. +Note that there's currently a hard requirement for both kinds of url's to include `/wp-content/uploads` in order to be picked up. If your media items are stored in another directory they will not become Gatsby images. ## Preventing Image/File sourcing From 26882f3438b18a0c3c9dad71217213625344f87f Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Tue, 11 Jan 2022 04:18:28 -0800 Subject: [PATCH 08/11] perf(gatsby): reuse rootNode & trackedRootNodes caches across instances of graphqlRunner (#33695) Co-authored-by: gatsbybot Co-authored-by: Ward Peeters Co-authored-by: Khaled Garbaya --- packages/gatsby/src/query/graphql-runner.ts | 6 ++++++ packages/gatsby/src/schema/node-model.js | 13 +++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/packages/gatsby/src/query/graphql-runner.ts b/packages/gatsby/src/query/graphql-runner.ts index 84790093dbde9..2ff241c4b03e5 100644 --- a/packages/gatsby/src/query/graphql-runner.ts +++ b/packages/gatsby/src/query/graphql-runner.ts @@ -23,6 +23,10 @@ import { IGraphQLRunnerStatResults, IGraphQLRunnerStats } from "./types" import { IGraphQLTelemetryRecord } from "../schema/type-definitions" import GraphQLSpanTracer from "./graphql-span-tracer" +// Preserve these caches across graphql instances. +const _rootNodeMap = new WeakMap() +const _trackedRootNodes = new WeakSet() + type Query = string | Source export interface IQueryOptions { @@ -62,6 +66,8 @@ export class GraphQLRunner { schema, schemaComposer: schemaCustomization.composer, createPageDependency, + _rootNodeMap, + _trackedRootNodes, }) this.schema = schema this.parseCache = new Map() diff --git a/packages/gatsby/src/schema/node-model.js b/packages/gatsby/src/schema/node-model.js index 2f80b8ae2b943..ea0051a517ee1 100644 --- a/packages/gatsby/src/schema/node-model.js +++ b/packages/gatsby/src/schema/node-model.js @@ -71,13 +71,18 @@ export interface NodeModel { } class LocalNodeModel { - constructor({ schema, schemaComposer, createPageDependency }) { + constructor({ + schema, + schemaComposer, + createPageDependency, + _rootNodeMap, + _trackedRootNodes, + }) { this.schema = schema this.schemaComposer = schemaComposer this.createPageDependencyActionCreator = createPageDependency - - this._rootNodeMap = new WeakMap() - this._trackedRootNodes = new WeakSet() + this._rootNodeMap = _rootNodeMap || new WeakMap() + this._trackedRootNodes = _trackedRootNodes || new WeakSet() this._prepareNodesQueues = {} this._prepareNodesPromises = {} this._preparedNodesCache = new Map() From 024713b2b4a390d97aedddf279a277c5241e024e Mon Sep 17 00:00:00 2001 From: Anil Seervi <61609033+AnilSeervi@users.noreply.github.com> Date: Tue, 11 Jan 2022 17:52:42 +0530 Subject: [PATCH 09/11] chore(docs) : Typo fix GatbsyImage -> GatsbyImage (#34439) --- docs/docs/conceptual/image-plugin-architecture.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/conceptual/image-plugin-architecture.md b/docs/docs/conceptual/image-plugin-architecture.md index 3de2180929a96..fda657ff1410a 100644 --- a/docs/docs/conceptual/image-plugin-architecture.md +++ b/docs/docs/conceptual/image-plugin-architecture.md @@ -70,7 +70,7 @@ The `GatsbyImage` component supports three types of layout, which define the res #### Placeholder -`GatbsyImage` supports displaying a placeholder while the main image loads. There are two kinds of placeholder that are currently supported: flat colors and images. The type of placeholder is set via the image data object, and will either be a data URI for the image, or a CSS color value. The image will either be a base64-encoded low resolution raster image (called `BLURRED` when using sharp) or a URI-encoded SVG (called `TRACED_SVG`). The raster image will by default be 20px wide, and the same aspect ratio as the main image. This will be resized to fill the full container, giving a blurred effect. The SVG image is expected to be a single-color, simplified SVG generated using [potrace](http://potrace.sourceforge.net/). While these are the defaults produced by sharp, and also used by many third-party source plugins, we do not enforce this, and it can be any URI. We strongly encourage the use of inline data URIs, as any placeholder that needs to make a network request will defeat much of the purpose of using a placeholder. The actual placeholder element is a regular `` tag, even for SVGs. +`GatsbyImage` supports displaying a placeholder while the main image loads. There are two kinds of placeholder that are currently supported: flat colors and images. The type of placeholder is set via the image data object, and will either be a data URI for the image, or a CSS color value. The image will either be a base64-encoded low resolution raster image (called `BLURRED` when using sharp) or a URI-encoded SVG (called `TRACED_SVG`). The raster image will by default be 20px wide, and the same aspect ratio as the main image. This will be resized to fill the full container, giving a blurred effect. The SVG image is expected to be a single-color, simplified SVG generated using [potrace](http://potrace.sourceforge.net/). While these are the defaults produced by sharp, and also used by many third-party source plugins, we do not enforce this, and it can be any URI. We strongly encourage the use of inline data URIs, as any placeholder that needs to make a network request will defeat much of the purpose of using a placeholder. The actual placeholder element is a regular `` tag, even for SVGs. The alternative placeholder is a flat color. This is expected to be calculated from the dominant color of the source image. sharp supports performing this calculation, and some CMSs provide it in the image metadata. This color is applied as a background color to a placeholder `
` element. From 596e9ff24ae62274d5c2435ff10df47a98b410ec Mon Sep 17 00:00:00 2001 From: Lennart Date: Tue, 11 Jan 2022 13:41:58 +0100 Subject: [PATCH 10/11] chore(docs): Update quick-start guide (#34445) --- docs/docs/quick-start.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/docs/quick-start.md b/docs/docs/quick-start.md index f4699191e41bb..340f4a9dfabe4 100644 --- a/docs/docs/quick-start.md +++ b/docs/docs/quick-start.md @@ -12,11 +12,11 @@ This quick start is intended for intermediate to advanced developers. For a gent npm init gatsby ``` -Follow the prompts to choose your preferred CMS, styling tools and additional features. +It'll ask for a site title and the name of the project's directory. Continue following the prompts to choose your preferred CMS, styling tools and additional features. 2. Once everything is downloaded you will see a message with instructions for navigating to your site and running it locally. -It will look like this, but use your project's directory. +The CLI created the site as a new folder with the name you chose in step 1. Start by going to the directory with @@ -40,8 +40,8 @@ Try editing the home page in `src/pages/index.js`. Saved changes will live reloa ### Add more features -[Install and configure additional plugins](/docs/recipes/) to quickly add additional functionality to your site. +[Follow our guides](/docs/how-to/) to add more functionality to your site or browse [our plugins](/plugins/) to quickly install additional features. ### Deploy your site -Try using [Gatsby Cloud](https://www.gatsbyjs.com/cloud/) to build and deploy your site to one of many hosting providers. +Try using [Gatsby Cloud](/products/cloud/) to build and deploy your site to one of many hosting providers. From f5c8c2034c4cb77cfde0265b3477a054a24be93a Mon Sep 17 00:00:00 2001 From: Lennart Date: Tue, 11 Jan 2022 17:37:36 +0100 Subject: [PATCH 11/11] chore(docs): Release Notes v4.5 (#34425) --- .../reference/release-notes/v4.5/index.md | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 docs/docs/reference/release-notes/v4.5/index.md diff --git a/docs/docs/reference/release-notes/v4.5/index.md b/docs/docs/reference/release-notes/v4.5/index.md new file mode 100644 index 0000000000000..9b9ca3c2e585f --- /dev/null +++ b/docs/docs/reference/release-notes/v4.5/index.md @@ -0,0 +1,118 @@ +--- +date: "2022-01-11" +version: "4.5.0" +title: "v4.5 Release Notes" +--- + +Welcome to `gatsby@4.5.0` release (January 2022 #1) + +Key highlights of this release: + +- [Gracefully Handling Browser Cache Issues](#gracefully-handling-browser-cache-issues) +- [TypeScript Types for `getServerData`](#typescript-types-for-getserverdata) +- [Deprecation of `gatsby-recipes`](#deprecation-of-gatsby-recipes) + +Also check out [notable bugfixes](#notable-bugfixes--improvements). + +**Bleeding Edge:** Want to try new features as soon as possible? Install `gatsby@next` and let us know +if you have any [issues](https://github.com/gatsbyjs/gatsby/issues). + +[Previous release notes](/docs/reference/release-notes/v4.4) + +[Full changelog][full-changelog] + +--- + +## Gracefully Handling Browser Cache Issues + +If you've seen the error `The result of this StaticQuery could not be fetched`, `Loading (StaticQuery)`, or `We couldn't find the correct component chunk with the name` you might have run into issues regarding `useStaticQuery` and some form of browser cache. More details are laid out in these two issues: [#33956](https://github.com/gatsbyjs/gatsby/issues/33956) and [#33112](https://github.com/gatsbyjs/gatsby/issues/33112). + +The way we could reproduce this problem was using cached HTML from previous build (which would use previous JavaScript bundles), that would fetch new data (from newer builds). In those cases wrong static queries were fetched as the cached HTML expected other bundles. + +In [#34225](https://github.com/gatsbyjs/gatsby/pull/34225) we've added an integrity check to Gatsby's runtime to see if the loaded HTML & JavaScript is matching the new data, and if not a single (forced) reload tries to fetch the updated assets. + +If you've run into problems like these, please upgrade and let us know (in the two issues mentioned above) if your problem is resolved. + +## TypeScript Types for `getServerData` + +Gatsby now ships with TypeScript types for the `getServerData` function. You can use the `GetServerDataProps` and `GetServerDataReturn` as following: + +```tsx +import * as React from "react" +import { GetServerDataProps, GetServerDataReturn } from "gatsby" + +type ServerDataProps = { + hello: string +} + +const Page = () =>
Hello World
+export default Page + +export async function getServerData( + props: GetServerDataProps +): GetServerDataReturn { + return { + status: 200, + headers: {}, + props: { + hello: "world", + }, + } +} +``` + +If you're using an anonymous function, you can also use the shorthand `GetServerData` type like this: + +```tsx +const getServerData: GetServerData = async props => { + // your function body +} +``` + +## Deprecation of `gatsby-recipes` + +In early 2020 we've [introduced Gatsby Recipes](/blog/2020-04-15-announcing-gatsby-recipes/) to automate common site building tasks. Since then our priorities and plans on that front for Gatsby have shifted, thus `gatsby-recipes` itself didn't ever go from alpha status to general availability. We're deprecating `gatsby-recipes` now to signal that we'll no longer will continue work on this specific package and to also remove some heavy dependencies from `gatsby-cli`. Some deprecation warnings or audit messages about packages from `gatsby-recipes` should be gone now. + +You can continue to use it via `gatsby-cli@4.4.0` and the source itself will live inside the `deprecated-packages` folder in the [monorepo](https://github.com/gatsbyjs/gatsby/tree/master/deprecated-packages). + +If you've liked the features in `gatsby-recipes` and would like to have something similar in the future, feel free to open a [feature request](https://github.com/gatsbyjs/gatsby/discussions/categories/ideas-feature-requests) in our discussions forum. Thanks! + +## Notable Bugfixes & Improvements + +- A lot of internal dependency updates to some packages. You can check the `CHANGELOG.md` file in each package’s folder for the details. +- If you want to know how to enable [Content Sync](/docs/conceptual/content-sync/) in your source plugin, you can read the [updated guide](/docs/how-to/plugins-and-themes/creating-a-source-plugin/#enabling-content-sync) now. +- `gatsby` + - When using the File System Route API and SSR rendering mode, the routing between individual pages and a catch-all splat route was not correctly resolved. The `findPageByPath` function was updated to use another algorithm to find the correct page, via [PR #34070](https://github.com/gatsbyjs/gatsby/pull/34070) + - Remove unused exports from query engine, via [PR #33484](https://github.com/gatsbyjs/gatsby/pull/33484) + - Resolve `createNode` promise when LMDB datastore is ready to fix issues where nodes were not created, via [PR #34277](https://github.com/gatsbyjs/gatsby/pull/34277) + - Reorder `` tags so that e.g. large stylesheets don't block parsers from getting meta tags, via [PR #34030](https://github.com/gatsbyjs/gatsby/pull/34030) +- `gatsby-plugin-preact`: Fix exports resolution to get it working with Gatsby 4, via [PR #34337](https://github.com/gatsbyjs/gatsby/pull/34337) +- `gatsby-source-contentful`: + - Calculate aspect ratio for `base64` previews correctly, via [PR #33533](https://github.com/gatsbyjs/gatsby/pull/33533) + - Fix issue where images were not downloaded when using `downloadLocal`, via [PR #34276](https://github.com/gatsbyjs/gatsby/pull/34276) +- `gatsby-cli`: Make `--inspect-brk` work with specified port, via [PR #34242](https://github.com/gatsbyjs/gatsby/pull/34242) +- `gatsby-source-filesystem`: Replace special filename characters, via [PR #34249](https://github.com/gatsbyjs/gatsby/pull/34249) + +## Contributors + +A big **Thank You** to [our community who contributed][full-changelog] to this release 💜 + +- [iChenLei](https://github.com/iChenLei) + - fix(gatsby-cli): make `--inspect-brk` work [PR #34242](https://github.com/gatsbyjs/gatsby/pull/34242) + - docs: use en-US version mdn links [PR #34318](https://github.com/gatsbyjs/gatsby/pull/34318) + - chore(examples): use mobx v6 in using-mobx example [PR #34351](https://github.com/gatsbyjs/gatsby/pull/34351) +- [axe312ger](https://github.com/axe312ger): fix(gatsby-source-contentful): fix base64 aspect ratio [PR #33533](https://github.com/gatsbyjs/gatsby/pull/33533) +- [cassiebeckley](https://github.com/cassiebeckley): chore(gatsby-transformer-screenshot): Update old name [PR #34285](https://github.com/gatsbyjs/gatsby/pull/34285) +- [ollybenson](https://github.com/ollybenson): docs: fix typo in gatsby-image [PR #34300](https://github.com/gatsbyjs/gatsby/pull/34300) +- [fagiani](https://github.com/fagiani): docs: Match egghead.io video instructions [PR #34315](https://github.com/gatsbyjs/gatsby/pull/34315) +- [AnilSeervi](https://github.com/AnilSeervi) + - docs: change gastby to gatsby [PR #34341](https://github.com/gatsbyjs/gatsby/pull/34341) + - docs(gatsby-remark-prismjs): Update http links to use https [PR #34340](https://github.com/gatsbyjs/gatsby/pull/34340) + - docs: Add shell code block & remove starter link for sass [PR #34322](https://github.com/gatsbyjs/gatsby/pull/34322) + - docs: fix typo gatby-node.js -> gatsby-node.js [PR #34347](https://github.com/gatsbyjs/gatsby/pull/34347) +- [varghesejose2020](https://github.com/varghesejose2020): chore(docs): Update localization doc [PR #34378](https://github.com/gatsbyjs/gatsby/pull/34378) +- [SMony-L](https://github.com/SMony-L): chore: Fix typo [PR #34349](https://github.com/gatsbyjs/gatsby/pull/34349) +- [seanparmelee](https://github.com/seanparmelee): chore(docs): Fix links to shared layout component [PR #34330](https://github.com/gatsbyjs/gatsby/pull/34330) +- [tlgimenes](https://github.com/tlgimenes): fix(gatsby): Wrong route resolved by findPageByPath function [PR #34070](https://github.com/gatsbyjs/gatsby/pull/34070) + +[full-changelog]: https://github.com/gatsbyjs/gatsby/compare/gatsby@4.5.0-next.0...gatsby@4.5.0