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: ddb52afd476cf312c9f8c355e15778f4f20b72de
Choose a base ref
...
head repository: gatsbyjs/gatsby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4046323a40c4b6222066d47fe89e088ace9571a8
Choose a head ref

Commits on Jun 2, 2022

  1. chore(release): Publish next pre-minor

     - babel-plugin-remove-graphql-queries@4.17.0-next.0
     - babel-preset-gatsby-package@2.17.0-next.0
     - babel-preset-gatsby@2.17.0-next.0
     - create-gatsby@2.17.0-next.0
     - gatsby-cli@4.17.0-next.0
     - gatsby-codemods@3.17.0-next.0
     - gatsby-core-utils@3.17.0-next.0
     - gatsby-cypress@2.17.0-next.0
     - gatsby-design-tokens@4.17.0-next.0
     - gatsby-dev-cli@4.17.0-next.0
     - gatsby-graphiql-explorer@2.17.0-next.0
     - gatsby-legacy-polyfills@2.17.0-next.0
     - gatsby-link@4.17.0-next.0
     - gatsby-page-utils@2.17.0-next.0
     - gatsby-parcel-config@0.8.0-next.0
     - @gatsbyjs/parcel-namer-relative-to-cwd@1.2.0-next.0
     - gatsby-plugin-benchmark-reporting@2.17.0-next.0
     - gatsby-plugin-canonical-urls@4.17.0-next.0
     - gatsby-plugin-catch-links@4.17.0-next.0
     - gatsby-plugin-coffeescript@4.17.0-next.0
     - gatsby-plugin-cxs@4.17.0-next.0
     - gatsby-plugin-emotion@7.17.0-next.0
     - gatsby-plugin-facebook-analytics@4.17.0-next.0
     - gatsby-plugin-feed@4.17.0-next.0
     - gatsby-plugin-flow@3.17.0-next.0
     - gatsby-plugin-fullstory@4.17.0-next.0
     - gatsby-plugin-gatsby-cloud@4.17.0-next.0
     - gatsby-plugin-google-analytics@4.17.0-next.0
     - gatsby-plugin-google-gtag@4.17.0-next.0
     - gatsby-plugin-google-tagmanager@4.17.0-next.0
     - gatsby-plugin-image@2.17.0-next.0
     - gatsby-plugin-jss@4.17.0-next.0
     - gatsby-plugin-layout@3.17.0-next.0
     - gatsby-plugin-less@6.17.0-next.0
     - gatsby-plugin-lodash@5.17.0-next.0
     - gatsby-plugin-manifest@4.17.0-next.0
     - gatsby-plugin-mdx@3.17.0-next.0
     - gatsby-plugin-netlify-cms@6.17.0-next.0
     - gatsby-plugin-no-sourcemaps@4.17.0-next.0
     - gatsby-plugin-nprogress@4.17.0-next.0
     - gatsby-plugin-offline@5.17.0-next.0
     - gatsby-plugin-page-creator@4.17.0-next.0
     - gatsby-plugin-postcss@5.17.0-next.0
     - gatsby-plugin-preact@6.17.0-next.0
     - gatsby-plugin-preload-fonts@3.17.0-next.0
     - gatsby-plugin-react-css-modules@4.17.0-next.0
     - gatsby-plugin-react-helmet@5.17.0-next.0
     - gatsby-plugin-remove-trailing-slashes@4.17.0-next.0
     - gatsby-plugin-sass@5.17.0-next.0
     - gatsby-plugin-schema-snapshot@3.17.0-next.0
     - gatsby-plugin-sharp@4.17.0-next.0
     - gatsby-plugin-sitemap@5.17.0-next.0
     - gatsby-plugin-styled-components@5.17.0-next.0
     - gatsby-plugin-styled-jsx@5.17.0-next.0
     - gatsby-plugin-styletron@7.17.0-next.0
     - gatsby-plugin-stylus@4.17.0-next.0
     - gatsby-plugin-subfont@4.17.0-next.0
     - gatsby-plugin-twitter@4.17.0-next.0
     - gatsby-plugin-typescript@4.17.0-next.0
     - gatsby-plugin-typography@4.17.0-next.0
     - gatsby-plugin-utils@3.11.0-next.0
     - gatsby-react-router-scroll@5.17.0-next.0
     - gatsby-remark-autolink-headers@5.17.0-next.0
     - gatsby-remark-code-repls@6.17.0-next.0
     - gatsby-remark-copy-linked-files@5.17.0-next.0
     - gatsby-remark-custom-blocks@4.17.0-next.0
     - gatsby-remark-embed-snippet@7.17.0-next.0
     - gatsby-remark-graphviz@4.17.0-next.0
     - gatsby-remark-images-contentful@5.17.0-next.0
     - gatsby-remark-images@6.17.0-next.0
     - gatsby-remark-katex@6.17.0-next.0
     - gatsby-remark-prismjs@6.17.0-next.0
     - gatsby-remark-responsive-iframe@5.17.0-next.0
     - gatsby-remark-smartypants@5.17.0-next.0
     - gatsby-script@1.2.0-next.0
     - gatsby-sharp@0.11.0-next.0
     - gatsby-source-contentful@7.15.0-next.0
     - gatsby-source-drupal@5.18.0-next.0
     - gatsby-source-faker@4.17.0-next.0
     - gatsby-source-filesystem@4.17.0-next.0
     - gatsby-source-graphql@4.17.0-next.0
     - gatsby-source-hacker-news@4.17.0-next.0
     - gatsby-source-lever@4.17.0-next.0
     - gatsby-source-medium@4.17.0-next.0
     - gatsby-source-mongodb@4.17.0-next.0
     - gatsby-source-npm-package-search@4.17.0-next.0
     - gatsby-source-shopify@7.6.0-next.0
     - gatsby-source-wikipedia@4.17.0-next.0
     - gatsby-source-wordpress@6.17.0-next.0
     - gatsby-telemetry@3.17.0-next.0
     - gatsby-transformer-asciidoc@3.17.0-next.0
     - gatsby-transformer-csv@4.17.0-next.0
     - gatsby-transformer-documentationjs@6.17.0-next.0
     - gatsby-transformer-excel@4.17.0-next.0
     - gatsby-transformer-hjson@4.17.0-next.0
     - gatsby-transformer-javascript-frontmatter@4.17.0-next.0
     - gatsby-transformer-javascript-static-exports@4.17.0-next.0
     - gatsby-transformer-json@4.17.0-next.0
     - gatsby-transformer-pdf@3.17.0-next.0
     - gatsby-transformer-react-docgen@7.17.0-next.0
     - gatsby-transformer-remark@5.17.0-next.0
     - gatsby-transformer-screenshot@4.17.0-next.0
     - gatsby-transformer-sharp@4.17.0-next.0
     - gatsby-transformer-sqip@4.17.0-next.0
     - gatsby-transformer-toml@4.17.0-next.0
     - gatsby-transformer-xml@4.17.0-next.0
     - gatsby-transformer-yaml@4.17.0-next.0
     - gatsby-worker@1.17.0-next.0
     - gatsby@4.17.0-next.0
    marvinjude committed Jun 2, 2022
    Copy the full SHA
    f35540c View commit details
  2. Copy the full SHA
    b78a896 View commit details
  3. fix(gatsby-plugin-mdx): don't allow JS frontmatter by default (#35830)

    Co-authored-by: Ty Hopp <hopp.ty.c@gmail.com>
    pieh and tyhopp authored Jun 2, 2022
    Copy the full SHA
    b3690fb View commit details

Commits on Jun 3, 2022

  1. Copy the full SHA
    e7afa54 View commit details
  2. chore(docs): add options command to cli reference (#35815)

    Co-authored-by: Lennart <lekoarts@gmail.com>
    ElegantStack and LekoArts authored Jun 3, 2022
    Copy the full SHA
    3a9216a View commit details
  3. perf(gatsby): Only polyfill node modules if IE support is needed (#35702

    )
    
    * Only polyfill node modules if IE support is needed
    
    * Lint fix
    
    * Rework to use es6 module check instead of explicit ie
    
    * lint fix
    
    * Try being explicit with es6 module support being false in test
    
    * Clean up test
    
    * Path fix, remove stale code
    
    * Lint fix
    imjoshin authored Jun 3, 2022
    Copy the full SHA
    0cd90d9 View commit details
  4. feat(gatsby): Exclude the internal/fields objects for greater consist…

    …ency creating contentDigest (#33671)
    
    * feat(gatsby-core-utils): Exclude the internal object for greater consistency
    
    I was puzzled why a site was having more nodes than expected by marked as changed on each data update. I use jest-diff to show the diff between the nodes and as it turns out, it was all trivial differences in the `internal` object. Since the `internal` object is managed by the framework and source/transformer plugins typically don't ensure that the `internal` object hasn't changed between updates — we should just exclude it when generating the digest.
    
    Making this change resulted in ~20 less nodes being changed which reduced the number of invalidated queries from ~40k to ~6k, dramatically speeding up the incremental builds.
    
    I tested whether the destructuring would slow things down any by running the ~700k nodes on this site through both the old and new version of the site. They were essentially the same — ~16.5s vs. ~16.9s with the new algorithm being faster, presumably as we don't now have to hash the internal object.
    
    I expect this will result in fewer changed nodes in a lot of plugins.
    
    * Update create-content-digest.ts
    
    * Only hash as node if node & update snapshots
    
    * Only remove autogenerated fields from internal object
    
    * Move node-specific createContentDigest code to api-runner-node
    
    * revert snapshot changes
    
    * update snapshots
    
    * Update packages/gatsby/src/utils/api-runner-node.js
    
    Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
    
    Co-authored-by: Ward Peeters <ward@coding-tech.com>
    Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
    3 people authored Jun 3, 2022
    Copy the full SHA
    7dfd52d View commit details

Commits on Jun 6, 2022

  1. Copy the full SHA
    8257bca View commit details

Commits on Jun 7, 2022

  1. feat(gatsby, gatsby-plugin-utils): add image cdn source urls to redux (

    …#35427)
    
    * wip
    
    * wip: initial implementation of telemetry object in redux
    
    * feat: finish adding image cdn urls to redux
    
    * refactor: combine imports
    
    * refactor: clean up console logs etc
    
    * refactor: processGatsbyImageSourceUrl -> addGatsbyImageSourceUrl
    
    * refactor: remove console.log
    
    * test: add test to verify that gatsbyImageResolver adds source urls to redux store
    
    * feat: update gatsby index.d.ts doc reference for addGatsbyImageSourceUrl
    
    * feat: add whitespace to force canary publish
    
    * feat: add comment to force canary publish
    
    * refactor: gatsbyImageResolver -> gatsbyImageSourceUrls
    
    * feat: add telemetry to state cached on disk
    
    * refactor: remove telemetry from state stored to disk
    
    * feat: add action to clear gatsby image source urls
    
    * fix: return state directly in default case for telemetry slice reducer
    
    * wip: add some logs
    
    * wip: swap some logs
    
    * wip: add some logging
    
    * refactor: do not curry dispatch
    
    * feat: merge state back in from PQR workers
    
    * fix: typing
    
    * m
    
    * refactor: remove logs
    
    * refactor: remove logs
    
    * refactor: do no use a thunk for the gatsby image url clearing action
    
    * refactor: remove uneccessary default redux state creation
    
    * fix: only send gatsby image urls from worker if they exist
    
    * refactor: mutate state instead of copying
    
    * feat: only add gatsby image source url to redux if env var is set
    
    * test: update existing snapshot test
    
    * test: set env var to save ye old url in redux
    
    * fix: do not break worker state merging reducers if worker does not return slice items
    
    * feat: store GATSBY_SHOULD_TRACK_IMAGE_CDN_URLS once and check if addGatsbyImageSourceUrl exists on actions
    
    * test: get tests working for image cdn source url tracking
    
    * refactor: move clearGatsbyImageSourceUrls from public to internal actions
    
    * fix: remove duplicate action from public
    
    * test: pass through mock actions to replaceNodeHtmlImages
    
    Co-authored-by: Tyler Barnes <tylerdbarnes@gmail.com>
    veryspry and TylerBarnes authored Jun 7, 2022
    Copy the full SHA
    7a5b5c1 View commit details
  2. chore(docs): Release Notes for 4.16 (#35828)

    * release notes
    
    * add image stuff
    
    * Update index.md
    
    * chore: Fix typo in release notes (#35846)
    
    * format
    
    * Update index.md
    
    * Update index.md
    
    * Update index.md
    
    * thanks contributors
    
    * Update index.md
    
    * Update index.md
    
    Co-authored-by: Lennart <lekoarts@gmail.com>
    Co-authored-by: Hashim Warren <hashimwarren@gmail.com>
    3 people authored Jun 7, 2022
    Copy the full SHA
    6335f69 View commit details
  3. chore(docs): add changelog URL to 4.16 release notes (#35868)

    add changelog URL to 4.16 release notes
    marvinjude authored Jun 7, 2022
    Copy the full SHA
    c1255f0 View commit details
  4. chore(docs): fix typo in release note (#35871)

    fix typo in release note
    marvinjude authored Jun 7, 2022
    Copy the full SHA
    9a84098 View commit details
  5. Copy the full SHA
    7511ee7 View commit details

Commits on Jun 8, 2022

  1. refactor(gatsby-source-wordpress): move option check within relevant …

    …function to ensure enforcement (#35827)
    tsdexter authored Jun 8, 2022
    Copy the full SHA
    b653c7b View commit details
  2. Copy the full SHA
    fbdec7e View commit details
  3. Copy the full SHA
    2e76561 View commit details

Commits on Jun 9, 2022

  1. chore(docs): fix export.createPages to exports.CreatePages in documen…

    …tation (#35874)
    
    fix export.createPages to exports.CreatePages
    rudevdr authored Jun 9, 2022
    Copy the full SHA
    8274284 View commit details
  2. chore(changelogs): update changelogs (#35876)

    Co-authored-by: LekoArts <lekoarts@gmail.com>
    gatsbybot and LekoArts authored Jun 9, 2022
    Copy the full SHA
    8497887 View commit details
  3. chore(deps): update starters and examples (#35850)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Jun 9, 2022
    Copy the full SHA
    50d66c2 View commit details
  4. fix(deps): update starters and examples - gatsby (#35870)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Jun 9, 2022
    Copy the full SHA
    629c00f View commit details
  5. Copy the full SHA
    faaca37 View commit details
  6. Copy the full SHA
    5c7e2a6 View commit details
  7. chore(docs): add peer deps to gatsby-source-contentful docs (#35854)

    Co-authored-by: LekoArts <lekoarts@gmail.com>
    Paul Scanlon and LekoArts authored Jun 9, 2022
    Copy the full SHA
    a8405cb View commit details
  8. Copy the full SHA
    2282446 View commit details

Commits on Jun 13, 2022

  1. fix(deps): update starters and examples (#35920)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Jun 13, 2022
    Copy the full SHA
    95d472e View commit details
  2. Copy the full SHA
    7573c2c View commit details
  3. chore(docs): Add Jest 28 jest-environment-jsdom information (#35904)

    Co-authored-by: Lennart <lekoarts@gmail.com>
    Jon Rutter and LekoArts authored Jun 13, 2022
    Copy the full SHA
    96a18c9 View commit details
  4. chore(docs): Add Gatsby Script component to "Adding Analytics" (#35839)

    Co-authored-by: Lennart <lekoarts@gmail.com>
    labifrancis and LekoArts authored Jun 13, 2022
    Copy the full SHA
    f2a65e1 View commit details
  5. examples: Update using-mdx (#35526)

    Co-authored-by: Patrick Sullivan <patricksullivan@Patricks-MacBook-Air.local>
    Co-authored-by: Khaled Garbaya <kgarbaya@gmail.com>
    Co-authored-by: Lennart <lekoarts@gmail.com>
    4 people authored Jun 13, 2022
    Copy the full SHA
    452a780 View commit details
  6. chore(docs): Add resolveUrl section to gatsby-script docs (#35905)

    * chore(docs): Add resolveUrl section to gatsby-script docs
    
    * Replace we with you
    
    * our -> your
    
    Co-authored-by: Lennart <lekoarts@gmail.com>
    tyhopp and LekoArts authored Jun 13, 2022
    Copy the full SHA
    75d296a View commit details
  7. Copy the full SHA
    a53dfec View commit details
  8. chore(gatsby,gatsby-core-utils): Upgrade lmdb to 2.5.2 (#35724)

    Co-authored-by: LekoArts <lekoarts@gmail.com>
    wardpeet and LekoArts authored Jun 13, 2022
    Copy the full SHA
    9f3708f View commit details
  9. fix(gatsby): show meaningful error message when engines try to bundle…

    … ts-node (#35762)
    
    Co-authored-by: Lennart <lekoarts@gmail.com>
    pieh and LekoArts authored Jun 13, 2022
    Copy the full SHA
    123f202 View commit details
  10. chore(release): Publish next

     - babel-plugin-remove-graphql-queries@4.17.0-next.1
     - babel-preset-gatsby@2.17.0-next.1
     - create-gatsby@2.17.0-next.1
     - gatsby-cli@4.17.0-next.1
     - gatsby-core-utils@3.17.0-next.1
     - gatsby-link@4.17.0-next.1
     - gatsby-page-utils@2.17.0-next.1
     - gatsby-parcel-config@0.8.0-next.1
     - @gatsbyjs/parcel-namer-relative-to-cwd@1.2.0-next.1
     - gatsby-plugin-benchmark-reporting@2.17.0-next.1
     - gatsby-plugin-cxs@4.17.0-next.1
     - gatsby-plugin-feed@4.17.0-next.1
     - gatsby-plugin-flow@3.17.0-next.1
     - gatsby-plugin-gatsby-cloud@4.17.0-next.1
     - gatsby-plugin-google-tagmanager@4.17.0-next.1
     - gatsby-plugin-image@2.17.0-next.1
     - gatsby-plugin-manifest@4.17.0-next.1
     - gatsby-plugin-mdx@3.17.0-next.1
     - gatsby-plugin-offline@5.17.0-next.1
     - gatsby-plugin-page-creator@4.17.0-next.1
     - gatsby-plugin-preload-fonts@3.17.0-next.1
     - gatsby-plugin-sass@5.17.0-next.1
     - gatsby-plugin-sharp@4.17.0-next.1
     - gatsby-plugin-sitemap@5.17.0-next.1
     - gatsby-plugin-twitter@4.17.0-next.1
     - gatsby-plugin-typescript@4.17.0-next.1
     - gatsby-plugin-utils@3.11.0-next.1
     - gatsby-remark-autolink-headers@5.17.0-next.1
     - gatsby-remark-images@6.17.0-next.1
     - gatsby-source-contentful@7.15.0-next.1
     - gatsby-source-drupal@5.18.0-next.1
     - gatsby-source-filesystem@4.17.0-next.1
     - gatsby-source-graphql@4.17.0-next.1
     - gatsby-source-shopify@7.6.0-next.1
     - gatsby-source-wordpress@6.17.0-next.1
     - gatsby-telemetry@3.17.0-next.1
     - gatsby-transformer-documentationjs@6.17.0-next.1
     - gatsby-transformer-remark@5.17.0-next.1
     - gatsby-transformer-sharp@4.17.0-next.1
     - gatsby-transformer-sqip@4.17.0-next.1
     - gatsby@4.17.0-next.1
    LekoArts committed Jun 13, 2022
    Copy the full SHA
    2dbdd68 View commit details
  11. fix(deps): update dependency got to ^11.8.5 for gatsby-source-npm-pac…

    …kage-search (#35802)
    
    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Jun 13, 2022
    Copy the full SHA
    be21c15 View commit details

Commits on Jun 14, 2022

  1. chore(gatsby-source-drupal): Document fix for 406 (#35927)

    Document in the README how to use a custom header from `gatsby-config.js` to specify a media type for Drupal JSON API. This can fix `406 Not Acceptable` errors.
    febeling authored Jun 14, 2022
    Copy the full SHA
    76ed6a8 View commit details

Commits on Jun 15, 2022

  1. fix(gatsby): Stabilize types output of GraphQL Typegen (#35925)

    * initial
    
    * Update packages/gatsby/src/utils/graphql-typegen/utils.ts
    
    Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
    
    Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
    LekoArts and pieh authored Jun 15, 2022
    Copy the full SHA
    0268405 View commit details

Commits on Jun 21, 2022

  1. chore(release): Publish

     - babel-plugin-remove-graphql-queries@4.17.0
     - babel-preset-gatsby-package@2.17.0
     - babel-preset-gatsby@2.17.0
     - create-gatsby@2.17.0
     - gatsby-cli@4.17.0
     - gatsby-codemods@3.17.0
     - gatsby-core-utils@3.17.0
     - gatsby-cypress@2.17.0
     - gatsby-design-tokens@4.17.0
     - gatsby-dev-cli@4.17.0
     - gatsby-graphiql-explorer@2.17.0
     - gatsby-legacy-polyfills@2.17.0
     - gatsby-link@4.17.0
     - gatsby-page-utils@2.17.0
     - gatsby-parcel-config@0.8.0
     - @gatsbyjs/parcel-namer-relative-to-cwd@1.2.0
     - gatsby-plugin-benchmark-reporting@2.17.0
     - gatsby-plugin-canonical-urls@4.17.0
     - gatsby-plugin-catch-links@4.17.0
     - gatsby-plugin-coffeescript@4.17.0
     - gatsby-plugin-cxs@4.17.0
     - gatsby-plugin-emotion@7.17.0
     - gatsby-plugin-facebook-analytics@4.17.0
     - gatsby-plugin-feed@4.17.0
     - gatsby-plugin-flow@3.17.0
     - gatsby-plugin-fullstory@4.17.0
     - gatsby-plugin-gatsby-cloud@4.17.0
     - gatsby-plugin-google-analytics@4.17.0
     - gatsby-plugin-google-gtag@4.17.0
     - gatsby-plugin-google-tagmanager@4.17.0
     - gatsby-plugin-image@2.17.0
     - gatsby-plugin-jss@4.17.0
     - gatsby-plugin-layout@3.17.0
     - gatsby-plugin-less@6.17.0
     - gatsby-plugin-lodash@5.17.0
     - gatsby-plugin-manifest@4.17.0
     - gatsby-plugin-mdx@3.17.0
     - gatsby-plugin-netlify-cms@6.17.0
     - gatsby-plugin-no-sourcemaps@4.17.0
     - gatsby-plugin-nprogress@4.17.0
     - gatsby-plugin-offline@5.17.0
     - gatsby-plugin-page-creator@4.17.0
     - gatsby-plugin-postcss@5.17.0
     - gatsby-plugin-preact@6.17.0
     - gatsby-plugin-preload-fonts@3.17.0
     - gatsby-plugin-react-css-modules@4.17.0
     - gatsby-plugin-react-helmet@5.17.0
     - gatsby-plugin-remove-trailing-slashes@4.17.0
     - gatsby-plugin-sass@5.17.0
     - gatsby-plugin-schema-snapshot@3.17.0
     - gatsby-plugin-sharp@4.17.0
     - gatsby-plugin-sitemap@5.17.0
     - gatsby-plugin-styled-components@5.17.0
     - gatsby-plugin-styled-jsx@5.17.0
     - gatsby-plugin-styletron@7.17.0
     - gatsby-plugin-stylus@4.17.0
     - gatsby-plugin-subfont@4.17.0
     - gatsby-plugin-twitter@4.17.0
     - gatsby-plugin-typescript@4.17.0
     - gatsby-plugin-typography@4.17.0
     - gatsby-plugin-utils@3.11.0
     - gatsby-react-router-scroll@5.17.0
     - gatsby-remark-autolink-headers@5.17.0
     - gatsby-remark-code-repls@6.17.0
     - gatsby-remark-copy-linked-files@5.17.0
     - gatsby-remark-custom-blocks@4.17.0
     - gatsby-remark-embed-snippet@7.17.0
     - gatsby-remark-graphviz@4.17.0
     - gatsby-remark-images-contentful@5.17.0
     - gatsby-remark-images@6.17.0
     - gatsby-remark-katex@6.17.0
     - gatsby-remark-prismjs@6.17.0
     - gatsby-remark-responsive-iframe@5.17.0
     - gatsby-remark-smartypants@5.17.0
     - gatsby-script@1.2.0
     - gatsby-sharp@0.11.0
     - gatsby-source-contentful@7.15.0
     - gatsby-source-drupal@5.18.0
     - gatsby-source-faker@4.17.0
     - gatsby-source-filesystem@4.17.0
     - gatsby-source-graphql@4.17.0
     - gatsby-source-hacker-news@4.17.0
     - gatsby-source-lever@4.17.0
     - gatsby-source-medium@4.17.0
     - gatsby-source-mongodb@4.17.0
     - gatsby-source-npm-package-search@4.17.0
     - gatsby-source-shopify@7.6.0
     - gatsby-source-wikipedia@4.17.0
     - gatsby-source-wordpress@6.17.0
     - gatsby-telemetry@3.17.0
     - gatsby-transformer-asciidoc@3.17.0
     - gatsby-transformer-csv@4.17.0
     - gatsby-transformer-documentationjs@6.17.0
     - gatsby-transformer-excel@4.17.0
     - gatsby-transformer-hjson@4.17.0
     - gatsby-transformer-javascript-frontmatter@4.17.0
     - gatsby-transformer-javascript-static-exports@4.17.0
     - gatsby-transformer-json@4.17.0
     - gatsby-transformer-pdf@3.17.0
     - gatsby-transformer-react-docgen@7.17.0
     - gatsby-transformer-remark@5.17.0
     - gatsby-transformer-screenshot@4.17.0
     - gatsby-transformer-sharp@4.17.0
     - gatsby-transformer-sqip@4.17.0
     - gatsby-transformer-toml@4.17.0
     - gatsby-transformer-xml@4.17.0
     - gatsby-transformer-yaml@4.17.0
     - gatsby-worker@1.17.0
     - gatsby@4.17.0
    tyhopp committed Jun 21, 2022
    Copy the full SHA
    4046323 View commit details
Showing 395 changed files with 10,548 additions and 8,599 deletions.
21 changes: 3 additions & 18 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -429,25 +429,13 @@ jobs:

mdx_e2e_tests:
<<: *e2e-executor
environment:
<<: *e2e-executor-env
CYPRESS_PROJECT_ID: spbj28
CYPRESS_RECORD_KEY: af30ea46-121f-4fb7-97dd-f17ec224402e
steps:
- e2e-test:
test_path: e2e-tests/mdx
test_command: yarn test

e2e_tests_gatsby-static-image:
<<: *e2e-executor
environment:
<<: *e2e-executor-env
CYPRESS_PROJECT_ID: zstawi
CYPRESS_RECORD_KEY: 389326a6-c0d2-4215-bc5e-3be29483ed13
steps:
test_command: CYPRESS_PROJECT_ID=spbj28 CYPRESS_RECORD_KEY=af30ea46-121f-4fb7-97dd-f17ec224402e yarn test
- e2e-test:
test_path: e2e-tests/gatsby-static-image
test_command: yarn test
test_path: e2e-tests/mdx-less-babel
test_command: CYPRESS_PROJECT_ID=xo139a CYPRESS_RECORD_KEY=74d485b5-3ba6-40e1-a7d4-e63c0a8d2a4d yarn test

e2e_tests_visual-regression:
<<: *e2e-executor
@@ -526,7 +514,6 @@ jobs:
- run: git config --global user.name "GatsbyJS Bot"
- run: git config --global user.email "core-team@gatsbyjs.com"
- run: node scripts/gatsby-changelog-generator/update-and-open-pr.js
- run: yarn format:other

windows_unit_tests:
parallelism: 4
@@ -645,8 +632,6 @@ workflows:
<<: *e2e-test-workflow
- e2e_tests_path-prefix:
<<: *e2e-test-workflow
- e2e_tests_gatsby-static-image:
<<: *e2e-test-workflow
- e2e_tests_visual-regression:
<<: *e2e-test-workflow
- e2e_tests_contentful:
1 change: 1 addition & 0 deletions .jestSetup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
process.env.GATSBY_RECIPES_NO_COLOR = "true"
process.env.GATSBY_SHOULD_TRACK_IMAGE_CDN_URLS = "true"

// Potrace has a dependency on giwrap which has a process.nextTick as a sideEffect which messes up with jest.
jest.mock(`gifwrap`, () => jest.fn())
4 changes: 4 additions & 0 deletions docs/docs/how-to/adding-common-features/adding-analytics.md
Original file line number Diff line number Diff line change
@@ -14,6 +14,10 @@ Gatsby offers a plugin for most common services, making first-class integration

When utilizing marketing analytics tools, one key tradeoff is that marketing analytics tools are often the culprit for poor website performance. As a result, tools that make it easier for marketers to add and remove analytics (via Google Tag Manager), can also make it easier for them to harm site performance without noticing.

## Adding scripts performantly

Gatsby has a built-in [Gatsby Script Component](/docs/reference/built-in-components/gatsby-script/) that aids in loading scripts performantly. It offers a convenient way to declare different loading strategies, and a default loading strategy that gives Gatsby users strong performance out of the box.

## Guides to common analytics tools

- [Google Analytics](/plugins/gatsby-plugin-google-analytics/)
25 changes: 0 additions & 25 deletions docs/docs/how-to/custom-configuration/typescript.md
Original file line number Diff line number Diff line change
@@ -292,31 +292,6 @@ Parcel is used for the compilation and it currently has [limitations on TypeScri
- No support for `baseUrl` or `paths` inside `tsconfig.json`
- It implicitly enables the [`isolatedModules`](https://www.typescriptlang.org/tsconfig#isolatedModules) option by default

### `__dirname`

You can't use `__dirname` and `__filename` in your files. You'll need to replace these instances with a `path.resolve` call. Example diff for a `gatsby-config` file:

```diff
+ import path from "path"

const config = {
plugins: [
{
resolve: `gatsby-source-filesystem`,
options: {
name: `your-name`,
+ path: path.resolve(`some/folder`),
- path: `${__dirname}/some/folder`,
},
},
]
}

export default config
```

Progress on this is tracked in [Parcel #7611](https://github.com/parcel-bundler/parcel/issues/7611).

### `require.resolve`

You can't use `require.resolve` in your files. You'll need to replace these instances with a `path.resolve` call. Example diff for a `gatsby-node` file:
Original file line number Diff line number Diff line change
@@ -133,7 +133,7 @@ The `gatsby-node.js` file:
```js:title=gatsby-node.js
const blogPostTemplate = require.resolve(`./src/templates/blog-post.js`)

export.createPages = async ({ graphql, actions, reporter }) => {
exports.createPages = async ({ graphql, actions, reporter }) => {
const { createPage } = actions

const result = await graphql(`
6 changes: 6 additions & 0 deletions docs/docs/how-to/testing/testing-react-components.md
Original file line number Diff line number Diff line change
@@ -18,6 +18,12 @@ Install the library as one of your project's `devDependencies`. Optionally you m
npm install --save-dev @testing-library/react @testing-library/jest-dom
```

If you are using Jest 28, you also need to install `jest-environment-jsdom`:

```shell
npm install --save-dev jest-environment-jsdom
```

Create the file `setup-test-env.js` at the root of your project. Insert this code into it:

```js:title=setup-test-env.js
113 changes: 103 additions & 10 deletions docs/docs/reference/built-in-components/gatsby-script.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---
title: Gatsby Script API
examples:
- label: Using Gatsby Script
href: "https://github.com/gatsbyjs/gatsby/tree/master/examples/using-gatsby-script"
---

> Support for the Gatsby Script API was added in `gatsby@4.15.0`.
@@ -133,17 +136,19 @@ The `idle` strategy is ideal for cases where you want to ensure a script loads i

The `off-main-thread` strategy, unlike `post-hydrate` and `idle`, loads your script in a [web worker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) via [Partytown](https://partytown.builder.io).

This means that the burden of evaluation of your script is no longer the conern of the main thread, freeing it up to take care of other crucial tasks.
This means that the burden of evaluation of your script is no longer the concern of the main thread, freeing it up to take care of other crucial tasks.

> Note - Due to Partytown's status as **beta** software, the `off-main-thread` strategy is considered **experimental**. It is subject to certain [limitations](#limitations) and may require more configuration than other loading strategies depending on your use case.
Here is an example configuring the `<Script>` component with the `off-main-thread` strategy to load [Google Analytics](https://analytics.google.com/analytics/web/):

```jsx
import { Script } from "gatsby"

// `process.env.GTM` is your Google Analytics 4 identifier defined in your `.env.production` and `.env.development` files
// `process.env.GTAG` is your Google Analytics 4 identifier defined in your `.env.production` and `.env.development` files

<Script
src={`https://www.googletagmanager.com/gtag/js?id=${process.env.GTM}`}
src={`https://www.googletagmanager.com/gtag/js?id=${process.env.GTAG}`}
strategy="off-main-thread"
forward={[`gtag`]}
/>
@@ -152,7 +157,7 @@ import { Script } from "gatsby"
window.dataLayer = window.dataLayer || []
window.gtag = function gtag() { window.dataLayer.push(arguments) }
gtag('js', new Date())
gtag('config', ${process.env.GTM}, { send_page_view: false })
gtag('config', ${process.env.GTAG}, { send_page_view: false })
`}
</Script>
```
@@ -163,7 +168,7 @@ Gatsby will collect all `off-main-thread` scripts on a page, and automatically m

```jsx
<Script
src={`https://www.googletagmanager.com/gtag/js?id=${process.env.GTM}`}
src={`https://www.googletagmanager.com/gtag/js?id=${process.env.GTAG}`}
strategy="off-main-thread"
// highlight-next-line
forward={[`gtag`]}
@@ -195,7 +200,7 @@ module.exports = {
},
// highlight-start
partytownProxiedURLs: [
`https://www.googletagmanager.com/gtag/js?id=${process.env.GTM}`
`https://www.googletagmanager.com/gtag/js?id=${process.env.GTAG}`
],
// highlight-end
}
@@ -205,18 +210,108 @@ This works out of the box when running your site via `gatsby develop`, `gatsby s

Hosting on other providers requires support for Gatsby's [`createRedirect`](/docs/reference/config-files/actions/) action to rewrite requests from `/__third-party-proxy?url=${YOUR_URL}` to `YOUR_URL` with a 200 status code. You may need to check with your hosting provider to see if this is supported.

#### Resolving URLs

You can leverage Partytown's [vanilla config](https://partytown.builder.io/configuration#vanilla-config) to handle Partytown-specific behavior in your `off-main-thread` scripts. One such option is `resolveUrl`, which allows you to modify URLs handled by Partytown.

One example of a use case for `resolveUrl` is when using tag manager scripts such as [Google Tag Manager](https://tagmanager.google.com). These scripts are challenging to use with Partytown since they contain _other_ scripts that make _other_ requests that may or may not need to be proxied depending on the CORS setting. In this scenario you can use `resolveUrl` to handle those child script URLs.

Here's an example using [Google Tag Manager](https://tagmanager.google.com) to load [Google Analytics](http://analytics.google.com) (Universal Analytics in this case):

Note - This assumes you have [set up Google Tag Manager to use Universal Analytics](https://support.google.com/tagmanager/answer/6107124?hl=en) in the Google Tag Manager web application.

First you load your Google Tag Manager (GTM) script and send an initialization event:

```jsx
import { Script } from "gatsby"

// `process.env.GTM` is your Google Tag Manager identifier defined in your `.env.production` and `.env.development` files

<Script
// highlight-next-line
src={`https://www.googletagmanager.com/gtm.js?id=${process.env.GTM}`}
strategy="off-main-thread"
// highlight-next-line
forward={[`dataLayer.push`]}
/>
<Script id="gtm-init" strategy="off-main-thread">
{`
window.dataLayer = window.dataLayer || []
window.dataLayer.push({ 'gtm.start': new Date().getTime(), 'event': 'gtm.js' })
`}
</Script>
```

Then you define `resolveUrl` in Partytown's vanilla config to handle the Google Analytics script loaded by Google Tag Manager:

```jsx:title=gatsby-ssr.js
import React from "react"

export const onRenderBody = ({ setHeadComponents }) => {
setHeadComponents([
<script
key="partytown-vanilla-config"
dangerouslySetInnerHTML={{
__html: `partytown = {
resolveUrl(url, location) {
if (url.hostname.includes('google-analytics')) {
// Use a secure connection
if (url?.protocol === 'http:') {
url = new URL(url.href.replace('http', 'https'))
}
// Point to our proxied URL
const proxyUrl = new URL(location.origin + '/__third-party-proxy')
proxyUrl.searchParams.append('url', url)
return proxyUrl
}
return url
}
}`,
}}
/>,
])
}
```

Lastly, you need to add the Google Analytics URL to `partytownProxiedURLs` so that Gatsby knows the URL is safe to proxy:

```js:title=gatsby-config.js
import dotenv from "dotenv"

dotenv.config({
path: `.env.${process.env.NODE_ENV}`,
})

module.exports = {
siteMetadata: {
title: `Gatsby`,
},
partytownProxiedURLs: [
`https://www.googletagmanager.com/gtm.js?id=${process.env.GTM}`,
// highlight-next-line
`https://www.google-analytics.com/analytics.js`,
]
}
```

At this point both your Google Tag Manager and Google Analytics scripts should load successfully in your site.

#### Debugging

You can leverage Partytown's [vanilla config](https://partytown.builder.io/configuration#vanilla-config) to enable debug mode for your off-main-thread scripts:
You can also leverage Partytown's [vanilla config](https://partytown.builder.io/configuration#vanilla-config) to enable debug mode for your off-main-thread scripts:

```jsx:title=gatsby-ssr.js
import React from "react"

export const onRenderBody = ({ setHeadComponents }) => {
setHeadComponents([
<script
key="test"
key="partytown-vanilla-config"
dangerouslySetInnerHTML={{
// highlight-next-line
__html: `partytown = { debug: true }`,
}}
/>,
@@ -226,8 +321,6 @@ export const onRenderBody = ({ setHeadComponents }) => {

You may need to adjust your dev tools to the verbose log level in order to see the extra logs in your console.

It is recommended that you only make use of the `debug` property in Partytown's vanilla config to avoid unexpected behavior.

#### Limitations

By leveraging [Partytown](https://partytown.builder.io), scripts that use the `off-main-thread` strategy must also be aware of the [limitations mentioned in the Partytown documentation](https://partytown.builder.io/trade-offs). While the strategy can be powerful, it may not be the best solution for all scenarios.
28 changes: 26 additions & 2 deletions docs/docs/reference/gatsby-cli.md
Original file line number Diff line number Diff line change
@@ -258,9 +258,33 @@ Which package manager would you like to use ? › - Use arrow-keys. Return to su
npm
```
Once you’ve made your choice, the CLI won’t ask for your preference again for any subsequent project.
Once you’ve made your choice, the CLI won’t ask for your preference again for any subsequent project. If you want to change the preference, there are two ways to change the default package manager for your next project:
If you want to change this for your next project you have to edit the config file created automatically by the CLI.
1. [Using options command from CLI](#using-options-command-from-cli)
1. [Editing the config file](#editing-the-config-file)
### Using options command from CLI
You can use the `gatsby options` command to change the default package manager.
```shell
gatsby options set [<key> <value>]
```
| Argument | Description |
| -------- | ------------------------------------------------------------------------------- |
| key | Set the package manager `gatsby new` is using. choices: `pm`, `package-manager` |
| value | Set the package manager as `npm` or `yarn`. |
To set the default package manager as `yarn` you'd run:
```shell
gatsby options set package-manager yarn
```
### Editing the config file
You can also manually change the default package manager by editing the config file created automatically by the CLI.
This file is available on your system at: `~/.config/gatsby/config.json`
In it you’re going to see something like this.
Loading