Skip to content

Commit

Permalink
Merge branch 'master' into renovate/gatsby-plugin-mdx-dev-minor
Browse files Browse the repository at this point in the history
  • Loading branch information
LekoArts committed Jul 4, 2023
2 parents ab18130 + 39c4987 commit 8ecac3d
Show file tree
Hide file tree
Showing 83 changed files with 1,694 additions and 1,244 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ module.exports = {
}
```

### DSG engine doesn't support `onCreateWebpackConfig`

If you're modifying Gatsby's webpack configuration through [`onCreateWebpackConfig`](/docs/reference/config-files/gatsby-node/#onCreateWebpackConfig) those changes won't be applied to the DSG engine. The DSG engine is bundling everything it needs to run GraphQL queries, including your `gatsby-node` file with its `createResolvers` or `createSchemaCustomization` APIs. If you import/use files in those APIs that rely on your custom webpack changes (e.g. path aliases) it won't work.

## Additional Resources

- [How-To Guide: Using Deferred Static Generation](/docs/how-to/rendering-options/using-deferred-static-generation/)
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/contentful/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
"@simonsmith/cypress-image-snapshot": "^6.1.1",
"@types/simonsmith__cypress-image-snapshot": "npm:@types/cypress-image-snapshot",
"cross-env": "^7.0.3",
"cypress": "^12.13.0",
"cypress": "^12.16.0",
"gatsby-cypress": "next",
"prettier": "^2.8.8",
"srcset": "^5.0.0",
"start-server-and-test": "^2.0.0",
"typescript": "^5.0.4"
"typescript": "^5.1.6"
},
"keywords": [
"gatsby"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,14 @@ describe("Slice passed via createPage", () => {
.should(`contain`, allRecipeAuthors.find(author => recipe.authorId === author.id).name)
})
})

it(`404 pages with slices mapping have correct content`, () => {
cy.visit(`/doesnt-exist`, {
failOnStatusCode: false,
}).waitForRouteChange()

cy.get(`button`).click()

cy.getTestElement(`mapped-slice`).should("have.text", "My mapped Slice")
})
})
12 changes: 12 additions & 0 deletions e2e-tests/development-runtime/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ exports.createPages = async function createPages({
},
})

createSlice({
id: `mappedslice-fakeid`,
component: require.resolve(`./src/components/mapped-slice.js`),
})

slicesData.allRecipeAuthors.forEach(({ id, name }) => {
createSlice({
id: `author-${id}`,
Expand Down Expand Up @@ -342,6 +347,13 @@ exports.onCreatePage = async ({ page, actions }) => {
})
}
}

if (page.path === `/404/`) {
createPage({
...page,
slices: { mappedslice: "mappedslice-fakeid" },
})
}
}

/**
Expand Down
8 changes: 4 additions & 4 deletions e2e-tests/development-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"node-fetch": "^3.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sass": "^1.62.1"
"sass": "^1.63.6"
},
"keywords": [
"gatsby",
Expand Down Expand Up @@ -59,20 +59,20 @@
"postinstall": "playwright install chromium"
},
"devDependencies": {
"@playwright/test": "^1.34.3",
"@playwright/test": "^1.35.1",
"@simonsmith/cypress-image-snapshot": "^6.1.1",
"@testing-library/cypress": "^9.0.0",
"@types/simonsmith__cypress-image-snapshot": "npm:@types/cypress-image-snapshot",
"cross-env": "^7.0.3",
"cypress": "^12.13.0",
"cypress": "^12.16.0",
"express": "^4.18.2",
"fs-extra": "^11.1.1",
"gatsby-core-utils": "next",
"gatsby-cypress": "next",
"is-ci": "^3.0.1",
"prettier": "^2.8.8",
"start-server-and-test": "^2.0.0",
"typescript": "^5.0.4",
"typescript": "^5.1.6",
"yargs": "^17.7.2"
},
"repository": {
Expand Down
7 changes: 7 additions & 0 deletions e2e-tests/development-runtime/src/components/mapped-slice.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as React from "react"

const MappedSlice = () => {
return <div data-testid="mapped-slice">My mapped Slice</div>
}

export default MappedSlice
3 changes: 2 additions & 1 deletion e2e-tests/development-runtime/src/pages/404.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"
import { graphql, Link } from "gatsby"
import { graphql, Link, Slice } from "gatsby"

import Layout from "../components/layout"
import Seo from "../components/seo"
Expand Down Expand Up @@ -64,6 +64,7 @@ const NotFoundPage = ({ data }) => (
Go to page B
</Link>
</fieldset>
<Slice alias="mappedslice" />
</Layout>
)
export const Head = () => <Seo title="404: Not found" />
Expand Down
8 changes: 4 additions & 4 deletions e2e-tests/mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"description": "Gatsby MDX tester",
"version": "1.0.0",
"dependencies": {
"@emotion/react": "^11.11.0",
"@emotion/react": "^11.11.1",
"@mdx-js/react": "^2.3.0",
"@sindresorhus/slugify": "^2.2.1",
"cypress": "^12.13.0",
"cypress": "^12.16.0",
"fs-extra": "^11.1.1",
"gatsby": "next",
"gatsby-plugin-mdx": "next",
Expand All @@ -19,7 +19,7 @@
"react-dom": "^18.2.0",
"rehype-slug": "^5.1.0",
"remark-gfm": "^3.0.1",
"theme-ui": "^0.15.7"
"theme-ui": "^0.16.0"
},
"keywords": [
"gatsby"
Expand Down Expand Up @@ -49,6 +49,6 @@
"is-ci": "^3.0.1",
"prettier": "^2.8.8",
"start-server-and-test": "^2.0.0",
"typescript": "^5.0.4"
"typescript": "^5.1.6"
}
}
6 changes: 3 additions & 3 deletions e2e-tests/path-prefix/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "1.0.0",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"dependencies": {
"cypress": "^12.13.0",
"cypress": "^12.16.0",
"gatsby": "next",
"gatsby-plugin-feed": "next",
"gatsby-plugin-image": "next",
Expand Down Expand Up @@ -43,11 +43,11 @@
"del-cli": "^5.0.0",
"gatsby-cypress": "next",
"is-ci": "^3.0.1",
"make-dir-cli": "^3.0.0",
"make-dir-cli": "^3.1.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.8",
"start-server-and-test": "^2.0.0",
"typescript": "^5.0.4",
"typescript": "^5.1.6",
"wait-on": "^7.0.1"
},
"repository": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,12 @@ describe("Slice passed via createPage", () => {
.should(`contain`, allRecipeAuthors.find(author => recipe.authorId === author.id).name)
})
})

it(`404 pages with slices mapping have correct content`, () => {
cy.visit(`/doesnt-exist`, {
failOnStatusCode: false,
}).waitForRouteChange()

cy.getTestElement(`mapped-slice`).should("have.text", "My mapped Slice")
})
})
12 changes: 12 additions & 0 deletions e2e-tests/production-runtime/gatsby-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ export const createPages: GatsbyNode["createPages"] = ({
},
})

createSlice({
id: `mappedslice-fakeid`,
component: path.resolve(`./src/components/mapped-slice.js`),
})

slicesData.allRecipeAuthors.forEach(({ id, name }) => {
createSlice({
id: `author-${id}`,
Expand Down Expand Up @@ -322,5 +327,12 @@ export const onCreatePage: GatsbyNode["onCreatePage"] = ({ page, actions }) => {
},
})
break
case `/404/`: {
actions.createPage({
...page,
slices: { mappedslice: "mappedslice-fakeid" },
})
break
}
}
}
8 changes: 4 additions & 4 deletions e2e-tests/production-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"dependencies": {
"babel-plugin-search-and-replace": "^1.1.1",
"cypress": "^12.13.0",
"cypress": "^12.16.0",
"gatsby": "next",
"gatsby-cypress": "next",
"gatsby-plugin-image": "next",
Expand All @@ -18,7 +18,7 @@
"gatsby-source-filesystem": "next",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sass": "^1.62.1",
"sass": "^1.63.6",
"typeface-merriweather": "^1.1.13"
},
"keywords": [
Expand Down Expand Up @@ -55,15 +55,15 @@
"postinstall": "playwright install chromium"
},
"devDependencies": {
"@playwright/test": "^1.34.3",
"@playwright/test": "^1.35.1",
"cross-env": "^7.0.3",
"express": "^4.18.2",
"fs-extra": "^11.1.1",
"gatsby-core-utils": "next",
"is-ci": "^3.0.1",
"prettier": "^2.8.8",
"start-server-and-test": "^2.0.0",
"typescript": "^5.0.4"
"typescript": "^5.1.6"
},
"repository": {
"type": "git",
Expand Down
7 changes: 7 additions & 0 deletions e2e-tests/production-runtime/src/components/mapped-slice.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as React from "react"

const MappedSlice = () => {
return <div data-testid="mapped-slice">My mapped Slice</div>
}

export default MappedSlice
3 changes: 2 additions & 1 deletion e2e-tests/production-runtime/src/pages/404.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react"
import { Link } from "gatsby"
import { Link, Slice } from "gatsby"

import Layout from "../components/layout"
import Seo from "../components/seo"
Expand All @@ -12,6 +12,7 @@ const NotFoundPage = () => (
<Link to="/" data-testid="index">
Go to Index
</Link>
<Slice alias="mappedslice" />
</Layout>
)

Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/themes/development-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
},
"devDependencies": {
"cross-env": "^7.0.3",
"cypress": "^12.13.0",
"cypress": "^12.16.0",
"gatsby-cypress": "next",
"is-ci": "^3.0.1",
"prettier": "^2.8.8",
"start-server-and-test": "^2.0.0",
"typescript": "^5.0.4"
"typescript": "^5.1.6"
},
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/themes/production-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
},
"devDependencies": {
"cross-env": "^7.0.3",
"cypress": "^12.13.0",
"cypress": "^12.16.0",
"gatsby-cypress": "next",
"is-ci": "^3.0.1",
"prettier": "^2.8.8",
"start-server-and-test": "^2.0.0",
"typescript": "^5.0.4"
"typescript": "^5.1.6"
},
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/trailing-slash/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "1.0.0",
"author": "LekoArts",
"dependencies": {
"cypress": "^12.13.0",
"cypress": "^12.16.0",
"gatsby": "next",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down Expand Up @@ -37,6 +37,6 @@
"npm-run-all": "^4.1.5",
"prettier": "^2.8.8",
"start-server-and-test": "^2.0.0",
"typescript": "^5.0.4"
"typescript": "^5.1.6"
}
}
4 changes: 2 additions & 2 deletions e2e-tests/visual-regression/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"dependencies": {
"@simonsmith/cypress-image-snapshot": "^6.1.1",
"cypress": "^12.13.0",
"cypress": "^12.16.0",
"gatsby": "next",
"gatsby-plugin-image": "next",
"gatsby-plugin-sharp": "next",
Expand Down Expand Up @@ -38,7 +38,7 @@
"is-ci": "^3.0.1",
"prettier": "^2.8.8",
"start-server-and-test": "^2.0.0",
"typescript": "^5.0.4"
"typescript": "^5.1.6"
},
"repository": {
"type": "git",
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@
"@types/common-tags": "^1.8.1",
"@types/fs-extra": "^9.0.13",
"@types/jaeger-client": "^3.18.4",
"@types/jest": "^29.5.1",
"@types/jest": "^29.5.2",
"@types/joi": "^14.3.4",
"@types/lodash": "^4.14.195",
"@types/node": "^12.20.55",
"@types/node-fetch": "^2.6.4",
"@types/normalize-path": "^3.0.0",
"@types/react": "^18.2.7",
"@types/react": "^18.2.14",
"@types/semver": "^7.5.0",
"@types/signal-exit": "^3.0.1",
"@types/stack-trace": "^0.0.30",
"@types/webpack-merge": "^4.1.5",
"@typescript-eslint/eslint-plugin": "^5.59.8",
"@typescript-eslint/parser": "^5.59.8",
"@typescript-eslint/eslint-plugin": "^5.60.1",
"@typescript-eslint/parser": "^5.60.1",
"babel-jest": "^29.5.0",
"chalk": "^4.1.2",
"chokidar": "^3.5.3",
"cross-env": "^7.0.3",
"danger": "^10.9.0",
"date-fns": "^1.30.1",
"dictionary-en": "^3.2.0",
"eslint": "^8.41.0",
"eslint": "^8.43.0",
"eslint-config-google": "^0.14.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-filenames": "^1.3.2",
Expand Down Expand Up @@ -64,7 +64,7 @@
"npm-run-all": "4.1.5",
"prettier": "^2.8.8",
"rimraf": "^3.0.2",
"typescript": "^5.0.4",
"typescript": "^5.1.6",
"unified": "^9.2.2",
"yargs": "^15.4.1"
},
Expand Down
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": "5.12.0-next.0",
"version": "5.12.0-next.1",
"author": "Jason Quense <monastic.panic@gmail.com>",
"repository": {
"type": "git",
Expand All @@ -11,7 +11,7 @@
"dependencies": {
"@babel/runtime": "^7.20.13",
"@babel/types": "^7.20.7",
"gatsby-core-utils": "^4.12.0-next.0"
"gatsby-core-utils": "^4.12.0-next.1"
},
"devDependencies": {
"@babel/cli": "^7.20.7",
Expand Down

0 comments on commit 8ecac3d

Please sign in to comment.