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@4.7.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@4.7.2
Choose a head ref
  • 3 commits
  • 4 files changed
  • 4 contributors

Commits on Feb 15, 2022

  1. chore(gatsby-plugin-mdx): Use MDX v1 for install instructions (#34774) (

    #34817)
    
    Co-authored-by: Lennart <lekoarts@gmail.com>
    gatsbybot and LekoArts authored Feb 15, 2022
    Copy the full SHA
    d149291 View commit details
  2. fix(gatsby): Content Sync DSG bug (#34799) (#34818)

    (cherry picked from commit bfd04d3)
    
    Co-authored-by: Tyler Barnes <tylerdbarnes@gmail.com>
    gatsbybot and TylerBarnes authored Feb 15, 2022
    Copy the full SHA
    7ef1fb6 View commit details
  3. chore(release): Publish

     - gatsby-plugin-mdx@3.7.1
     - gatsby@4.7.2
    imjoshin committed Feb 15, 2022
    Copy the full SHA
    db83523 View commit details
Showing with 9 additions and 35 deletions.
  1. +4 −10 packages/gatsby-plugin-mdx/README.md
  2. +1 −1 packages/gatsby-plugin-mdx/package.json
  3. +1 −1 packages/gatsby/package.json
  4. +3 −23 packages/gatsby/src/utils/node-manifest.ts
14 changes: 4 additions & 10 deletions packages/gatsby-plugin-mdx/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![Logo](./img/gatsby-mdx.png)

> `gatsby-plugin-mdx` is the official integration for using [MDX](https://mdxjs.com)
> with [Gatsby](https://www.gatsbyjs.org/).
> with [Gatsby](https://www.gatsbyjs.com).
# What’s MDX?

@@ -18,7 +18,7 @@ MDX seeks to make writing with Markdown and JSX simpler while being more express

### Read more about MDX

- [📚 Gatsby guide](https://www.gatsbyjs.org/docs/mdx/)
- [📚 Gatsby guide](https://www.gatsbyjs.com/docs/mdx/)
- [📣 Language](https://mdxjs.com)
- [👩‍🔬 Specification](https://github.com/mdx-js/specification)

@@ -49,16 +49,10 @@ MDX seeks to make writing with Markdown and JSX simpler while being more express

## Installation

Install with npm:
Install:

```shell
npm install gatsby-plugin-mdx @mdx-js/mdx @mdx-js/react
```

Install with yarn:

```shell
yarn add gatsby-plugin-mdx @mdx-js/mdx @mdx-js/react
npm install gatsby-plugin-mdx @mdx-js/mdx@v1 @mdx-js/react@v1
```

## Usage
2 changes: 1 addition & 1 deletion packages/gatsby-plugin-mdx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gatsby-plugin-mdx",
"version": "3.7.0",
"version": "3.7.1",
"description": "MDX integration for Gatsby",
"main": "index.js",
"license": "MIT",
2 changes: 1 addition & 1 deletion packages/gatsby/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gatsby",
"description": "Blazing fast modern site generator for React",
"version": "4.7.1",
"version": "4.7.2",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"bin": {
"gatsby": "./cli.js"
26 changes: 3 additions & 23 deletions packages/gatsby/src/utils/node-manifest.ts
Original file line number Diff line number Diff line change
@@ -49,32 +49,18 @@ async function findPageOwnedByNodeId({ nodeId }: { nodeId: string }): Promise<{
const { pages, nodes } = state
const { byNode } = state.queries

// in development queries are run on demand so we wont have an accurate nodeId->pages map until those pages are visited in the browser. We want this mapping before the page is visited in the browser so we can route to the right page in the browser.
// So in development we can just use the Map of all pages (pagePath -> pageNode)
// but for builds (preview inc builds or regular builds) we will have a full map
// of all nodeId's to pages they're queried on and we can use that instead since it
// will be a much smaller list of pages, resulting in better performance for large sites
const usingPagesMap: boolean = `development` === process.env.NODE_ENV

const pagePathSetOrMap = usingPagesMap
? // this is a Map of page path to page node
pages
: // this is a Set of page paths
byNode?.get(nodeId)

// the default page path is the first page found in
// node id to page query tracking

let pagePath = byNode?.get(nodeId)?.values()?.next()?.value

let foundPageBy: FoundPageBy = pagePath ? `queryTracking` : `none`

if (pagePathSetOrMap) {
if (pages) {
let ownerPagePath: string | undefined
let foundOwnerNodeId = false

// for each page this nodeId is queried in
for (const pathOrPageObject of pagePathSetOrMap.values()) {
for (const pageObject of pages.values()) {
// if we haven't found a page with this nodeId
// set as page.ownerNodeId then run this logic.
// this condition is on foundOwnerNodeId instead of ownerPagePath
@@ -86,13 +72,7 @@ async function findPageOwnedByNodeId({ nodeId }: { nodeId: string }): Promise<{
break
}

const path = (
usingPagesMap
? // in development we're using a Map, so the value here is a page object
(pathOrPageObject as IGatsbyPage).path
: // in builds we're using a Set so the page path is the value
pathOrPageObject
) as string
const path = pageObject.path

const fullPage: IGatsbyPage | undefined = pages.get(path)