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@2.28.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@2.28.2
Choose a head ref
  • 10 commits
  • 29 files changed
  • 5 contributors

Commits on Dec 9, 2020

  1. fix(gatsby): better text for missing inferred extension (#28530) (#28542

    )
    
    * fix(gatsby): better text for missing extension
    
    * add SDL example on how to fix the problem
    
    * fix typo
    
    * Add a link to createTypes docs
    
    * formatting
    
    (cherry picked from commit 298110c)
    
    Co-authored-by: Vladimir Razuvaev <vladimir.razuvaev@gmail.com>
    GatsbyJS Bot and vladar authored Dec 9, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    fd9d872 View commit details
  2. fix(gatsby): improve deprecation text for missing childOf directive (#…

    …28532) (#28543)
    
    * fix(gatsby): improve deprecation text for missing childOf directive
    
    * text formatting
    
    * Add "many" argument
    
    (cherry picked from commit f733f4e)
    
    Co-authored-by: Vladimir Razuvaev <vladimir.razuvaev@gmail.com>
    GatsbyJS Bot and vladar authored Dec 9, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    7f10385 View commit details
  3. fix(gatsby): Wait for jobs to complete in onPostBuild (#28534) (#28557)

    Co-authored-by: gatsbybot <mathews.kyle+gatsbybot@gmail.com>
    (cherry picked from commit 98f22e7)
    
    Co-authored-by: Sidhartha Chatterjee <me@sidharthachatterjee.com>
    GatsbyJS Bot and sidharthachatterjee authored Dec 9, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d0dce3f View commit details
  4. fix(gatsby-remark-images): allow tracedSVG to accept object with sett…

    …ings (#28242) (#28552)
    
    * fix(gatsby-remark-images): allow tracedSVG to accept object with settings
    
    * fix test setup that was testing same thing twice
    
    (cherry picked from commit 23ecf2d)
    
    Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
    GatsbyJS Bot and pieh authored Dec 9, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    9752489 View commit details
  5. fix(gatsby-recipes): Add postcss as a dependency (#28556) (#28559)

    (cherry picked from commit c5bf981)
    
    Co-authored-by: Sidhartha Chatterjee <me@sidharthachatterjee.com>
    GatsbyJS Bot and sidharthachatterjee authored Dec 9, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    4f50275 View commit details
  6. fix(gatsby-source-drupal): Do not swallow errors (#28549) (#28558)

    (cherry picked from commit c3dfb09)
    
    Co-authored-by: Sidhartha Chatterjee <me@sidharthachatterjee.com>
    GatsbyJS Bot and sidharthachatterjee authored Dec 9, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    2cbe229 View commit details
  7. fix(gatsby): correct GraphQL warning text (#28563) (#28567)

    (cherry picked from commit 2bb4214)
    
    Co-authored-by: Vladimir Razuvaev <vladimir.razuvaev@gmail.com>
    GatsbyJS Bot and vladar authored Dec 9, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0b306c5 View commit details

Commits on Dec 10, 2020

  1. fix(gatsby): show multiple invites together & at end where people are…

    … more likely to see them (#28450) (#28541)
    
    * fix(gatsby): show multiple invites together & at end where people are more likely to see them
    
    * Add telemetry
    
    * update copy from suggestions by @DSchau
    
    * Actually stop listening
    
    * Update packages/gatsby/src/utils/show-experiment-notice.ts
    
    Co-authored-by: Matt Kane <matt@gatsbyjs.com>
    
    * Add test for generating the message
    
    * rewrite messages & make shorter
    
    * make all the things happy
    
    * update flag
    
    * This breaking windows??
    
    * Don't use explicit \n to see if that helps snapshot
    
    * Maybe jest is fine w/ explicit new-lines 🤷‍♂️
    
    * Strip ansi for tests
    
    * Update packages/gatsby/src/services/initialize.ts
    
    Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
    
    * Update packages/gatsby/src/services/run-page-queries.ts
    
    Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
    
    * use trackCLI not trackFeatureIsUsed
    
    * only store that we showed the invite when we actually do show the invite
    
    * Call code directly from webpack's done callback
    
    * mock in jest
    
    * be more explicit about how the caching behavior changes
    
    * Show full code sample per @pelikhan's feedback
    
    * typescript fixes
    
    * Update packages/gatsby/src/services/initialize.ts
    
    Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
    
    * Update packages/gatsby/src/services/initialize.ts
    
    Co-authored-by: Matt Kane <matt@gatsbyjs.com>
    Co-authored-by: gatsbybot <mathews.kyle+gatsbybot@gmail.com>
    Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
    (cherry picked from commit 7e734cc)
    
    Co-authored-by: Kyle Mathews <mathews.kyle@gmail.com>
    GatsbyJS Bot and KyleAMathews authored Dec 10, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f8d5c9b View commit details
  2. feat(gatsby): track how long query-on-demand querying takes (#28544) (#…

    …28570)
    
    * feat(gatsby): track how long query-on-demand querying takes
    
    * typescript
    
    (cherry picked from commit fbf9694)
    
    Co-authored-by: Kyle Mathews <mathews.kyle@gmail.com>
    GatsbyJS Bot and KyleAMathews authored Dec 10, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    4dc4312 View commit details
  3. chore(release): Publish

     - gatsby-admin@0.4.2
     - gatsby-cli@2.15.1
     - gatsby-recipes@0.5.1
     - gatsby-remark-images@3.7.1
     - gatsby-source-drupal@3.9.1
     - gatsby@2.28.2
    pieh committed Dec 10, 2020
    Copy the full SHA
    2e9e36a View commit details
Showing with 545 additions and 115 deletions.
  1. +4 −0 packages/gatsby-admin/CHANGELOG.md
  2. +2 −2 packages/gatsby-admin/package.json
  3. +4 −0 packages/gatsby-cli/CHANGELOG.md
  4. +2 −2 packages/gatsby-cli/package.json
  5. +6 −0 packages/gatsby-recipes/CHANGELOG.md
  6. +1 −1 packages/gatsby-recipes/package.json
  7. +2 −1 packages/gatsby-recipes/recipes/tailwindcss.mdx
  8. +6 −0 packages/gatsby-remark-images/CHANGELOG.md
  9. +1 −1 packages/gatsby-remark-images/package.json
  10. +208 −1 packages/gatsby-remark-images/src/__tests__/gatsby-node.js
  11. +39 −1 packages/gatsby-remark-images/src/gatsby-node.js
  12. +6 −0 packages/gatsby-source-drupal/CHANGELOG.md
  13. +1 −1 packages/gatsby-source-drupal/package.json
  14. +29 −33 packages/gatsby-source-drupal/src/normalize.js
  15. +14 −0 packages/gatsby/CHANGELOG.md
  16. +3 −2 packages/gatsby/package.json
  17. +4 −0 packages/gatsby/src/commands/build.ts
  18. +8 −7 packages/gatsby/src/schema/extensions/__tests__/child-relations.js
  19. +51 −0 packages/gatsby/src/schema/infer/__tests__/infer.js
  20. +16 −4 packages/gatsby/src/schema/infer/add-inferred-fields.js
  21. +1 −0 packages/gatsby/src/schema/print.js
  22. +9 −7 packages/gatsby/src/schema/schema.js
  23. +8 −14 packages/gatsby/src/services/initialize.ts
  24. +8 −11 packages/gatsby/src/services/run-page-queries.ts
  25. +4 −0 packages/gatsby/src/services/start-webpack-server.ts
  26. +11 −0 packages/gatsby/src/utils/__tests__/__snapshots__/show-experiment-notice.js.snap
  27. +20 −0 packages/gatsby/src/utils/__tests__/show-experiment-notice.js
  28. +51 −6 packages/gatsby/src/utils/show-experiment-notice.ts
  29. +26 −21 packages/gatsby/src/utils/start-server.ts
4 changes: 4 additions & 0 deletions packages/gatsby-admin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.4.2](https://github.com/gatsbyjs/gatsby/compare/gatsby-admin@0.4.1...gatsby-admin@0.4.2) (2020-12-10)

**Note:** Version bump only for package gatsby-admin

## [0.4.1](https://github.com/gatsbyjs/gatsby/compare/gatsby-admin@0.4.0...gatsby-admin@0.4.1) (2020-12-07)

**Note:** Version bump only for package gatsby-admin
4 changes: 2 additions & 2 deletions packages/gatsby-admin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gatsby-admin",
"version": "0.4.1",
"version": "0.4.2",
"main": "index.js",
"author": "Max Stoiber",
"license": "MIT",
@@ -20,7 +20,7 @@
"@typescript-eslint/parser": "^2.34.0",
"csstype": "^2.6.13",
"formik": "^2.2.5",
"gatsby": "^2.28.1",
"gatsby": "^2.28.2",
"gatsby-interface": "^0.0.225",
"gatsby-plugin-typescript": "^2.8.0",
"gatsby-plugin-webfonts": "^1.1.3",
4 changes: 4 additions & 0 deletions packages/gatsby-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [2.15.1](https://github.com/gatsbyjs/gatsby/compare/gatsby-cli@2.15.0...gatsby-cli@2.15.1) (2020-12-10)

**Note:** Version bump only for package gatsby-cli

# [2.15.0](https://github.com/gatsbyjs/gatsby/compare/gatsby-cli@2.15.0-next.2...gatsby-cli@2.15.0) (2020-12-02)

### Bug Fixes
4 changes: 2 additions & 2 deletions packages/gatsby-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gatsby-cli",
"description": "Gatsby command-line interface for creating new sites and running Gatsby commands",
"version": "2.15.0",
"version": "2.15.1",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"bin": {
"gatsby": "cli.js"
@@ -25,7 +25,7 @@
"fs-exists-cached": "^1.0.0",
"fs-extra": "^8.1.0",
"gatsby-core-utils": "^1.6.0",
"gatsby-recipes": "^0.5.0",
"gatsby-recipes": "^0.5.1",
"gatsby-telemetry": "^1.6.0",
"hosted-git-info": "^3.0.6",
"is-valid-path": "^0.1.1",
6 changes: 6 additions & 0 deletions packages/gatsby-recipes/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.5.1](https://github.com/gatsbyjs/gatsby/compare/gatsby-recipes@0.5.0...gatsby-recipes@0.5.1) (2020-12-10)

### Bug Fixes

- **gatsby-recipes:** Add postcss as a dependency ([#28556](https://github.com/gatsbyjs/gatsby/issues/28556)) ([#28559](https://github.com/gatsbyjs/gatsby/issues/28559)) ([4f50275](https://github.com/gatsbyjs/gatsby/commit/4f5027532b85130a0179b14142c4a40142a62380))

# [0.5.0](https://github.com/gatsbyjs/gatsby/compare/gatsby-recipes@0.5.0-next.2...gatsby-recipes@0.5.0) (2020-12-02)

### Bug Fixes
2 changes: 1 addition & 1 deletion packages/gatsby-recipes/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gatsby-recipes",
"description": "Core functionality for Gatsby Recipes",
"version": "0.5.0",
"version": "0.5.1",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
3 changes: 2 additions & 1 deletion packages/gatsby-recipes/recipes/tailwindcss.mdx
Original file line number Diff line number Diff line change
@@ -9,13 +9,14 @@ This recipe:
Installs necessary NPM packages.

<NPMPackage name="tailwindcss" />
<NPMPackage name="postcss" />
<NPMPackage name="gatsby-plugin-postcss" />

---

Installs necessary Gatsby plugins.

<GatsbyPlugin name="gatsby-plugin-postcss"/>
<GatsbyPlugin name="gatsby-plugin-postcss" />

---

6 changes: 6 additions & 0 deletions packages/gatsby-remark-images/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [3.7.1](https://github.com/gatsbyjs/gatsby/compare/gatsby-remark-images@3.7.0...gatsby-remark-images@3.7.1) (2020-12-10)

### Bug Fixes

- **gatsby-remark-images:** allow tracedSVG to accept object with settings ([#28242](https://github.com/gatsbyjs/gatsby/issues/28242)) ([#28552](https://github.com/gatsbyjs/gatsby/issues/28552)) ([9752489](https://github.com/gatsbyjs/gatsby/commit/97524891202985fb1c6ac57b7822742980ff54cd))

# [3.7.0](https://github.com/gatsbyjs/gatsby/compare/gatsby-remark-images@3.7.0-next.0...gatsby-remark-images@3.7.0) (2020-12-02)

**Note:** Version bump only for package gatsby-remark-images
2 changes: 1 addition & 1 deletion packages/gatsby-remark-images/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gatsby-remark-images",
"description": "Processes images in markdown so they can be used in the production build.",
"version": "3.7.0",
"version": "3.7.1",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
209 changes: 208 additions & 1 deletion packages/gatsby-remark-images/src/__tests__/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { testPluginOptionsSchema } from "gatsby-plugin-utils"
import { pluginOptionsSchema } from "../gatsby-node"
import { Potrace } from "potrace"

describe(`pluginOptionsSchema`, () => {
it(`should provide meaningful errors when fields are invalid`, async () => {
@@ -13,7 +14,7 @@ describe(`pluginOptionsSchema`, () => {
`"backgroundColor" must be a string`,
`"quality" must be a number`,
`"withWebp" must be one of [object, boolean]`,
`"tracedSVG" must be a boolean`,
`"tracedSVG" must be one of [boolean, object]`,
`"loading" must be one of [lazy, eager, auto]`,
`"disableBgImageOnAlpha" must be a boolean`,
`"disableBgImage" must be a boolean`,
@@ -102,4 +103,210 @@ describe(`pluginOptionsSchema`, () => {
expect(isValid).toBe(false)
})
})

describe(`allow different variants of "tracedSVG" option`, () => {
describe(`supports boolean variant`, () => {
it.each([
[`true`, true],
[`false`, false],
])(`%s`, async (_title, booleanValue) => {
const { isValid } = await testPluginOptionsSchema(pluginOptionsSchema, {
tracedSVG: booleanValue,
})

expect(isValid).toBe(true)
})
})

describe(`supports object notation`, () => {
it(`should validate when all fields are set`, async () => {
const { isValid } = await testPluginOptionsSchema(pluginOptionsSchema, {
tracedSVG: {
turnPolicy: Potrace.TURNPOLICY_RIGHT,
turdSize: 50,
alphaMax: 0.5,
optCurve: false,
optTolerance: 0.9,
threshold: 230,
blackOnWhite: false,
color: `red`,
background: `green`,
},
})

expect(isValid).toBe(true)
})

it(`should validate when some fields are set`, async () => {
const { isValid } = await testPluginOptionsSchema(pluginOptionsSchema, {
tracedSVG: {
turnPolicy: Potrace.TURNPOLICY_RIGHT,
turdSize: 50,
// alphaMax: 0.5,
// optCurve: 0.2,
// optTolerance: 0.9,
// threshold: 230,
// blackOnWhite: false,
color: `red`,
background: `green`,
},
})

expect(isValid).toBe(true)
})

it(`should fail validation when unknown fields are set`, async () => {
const { isValid, errors } = await testPluginOptionsSchema(
pluginOptionsSchema,
{
tracedSVG: {
foo: `bar`,
},
}
)

expect(isValid).toBe(false)
expect(errors).toMatchInlineSnapshot(`
Array [
"\\"tracedSVG.foo\\" is not allowed",
]
`)
})

describe(`turnPolicy variants`, () => {
it.each([
`TURNPOLICY_BLACK`,
`TURNPOLICY_WHITE`,
`TURNPOLICY_LEFT`,
`TURNPOLICY_RIGHT`,
`TURNPOLICY_MINORITY`,
`TURNPOLICY_MAJORITY`,
])(`supports setting by policy name (%s)`, async name => {
const { isValid } = await testPluginOptionsSchema(
pluginOptionsSchema,
{
tracedSVG: { turnPolicy: name },
}
)

expect(isValid).toBe(true)
})

it.each([
Potrace.TURNPOLICY_BLACK,
Potrace.TURNPOLICY_WHITE,
Potrace.TURNPOLICY_LEFT,
Potrace.TURNPOLICY_RIGHT,
Potrace.TURNPOLICY_MINORITY,
Potrace.TURNPOLICY_MAJORITY,
])(`supports setting by policy value (%s)`, async value => {
const { isValid } = await testPluginOptionsSchema(
pluginOptionsSchema,
{
tracedSVG: { turnPolicy: value },
}
)

expect(isValid).toBe(true)
})

it(`Doesn't support arbitrary string values`, async () => {
const { isValid, errors } = await testPluginOptionsSchema(
pluginOptionsSchema,
{
tracedSVG: { turnPolicy: `foo` },
}
)

expect(isValid).toBe(false)
expect(errors).toMatchInlineSnapshot(`
Array [
"\\"tracedSVG.turnPolicy\\" must be one of [TURNPOLICY_BLACK, TURNPOLICY_WHITE, TURNPOLICY_LEFT, TURNPOLICY_RIGHT, TURNPOLICY_MINORITY, TURNPOLICY_MAJORITY, black, white, left, right, minority, majority]",
]
`)
})
})

describe(`threshold`, () => {
// valid settings
it.each([
[
`THRESHOLD_AUTO`,
{
value: Potrace.THRESHOLD_AUTO,
expectedIsValid: true,
},
],
[
0,
{
expectedIsValid: true,
},
],
[
128,
{
expectedIsValid: true,
},
],
[
255,
{
expectedIsValid: true,
},
],
])(`Allow setting %s`, async (titleAndMaybeValue, { value }) => {
if (typeof value === `undefined`) {
// if value wasn't explicitly set use title
value = titleAndMaybeValue
}

const { isValid } = await testPluginOptionsSchema(
pluginOptionsSchema,
{
tracedSVG: { threshold: value },
}
)

expect(isValid).toBe(true)
})

// invalid settings
it.each([
[
-5,
{
expectedIsValid: false,
errorMessage: `"tracedSVG.threshold" must be greater than or equal to 0`,
},
],
[
256,
{
expectedIsValid: false,
errorMessage: `"tracedSVG.threshold" must be less than or equal to 255`,
},
],
])(
`Doesn't allow setting %s`,
async (titleAndMaybeValue, { value, errorMessage }) => {
if (typeof value === `undefined`) {
// if value wasn't explicitly set use title
value = titleAndMaybeValue
}

const { isValid, errors } = await testPluginOptionsSchema(
pluginOptionsSchema,
{
tracedSVG: { threshold: value },
}
)

expect(isValid).toBe(false)
expect(errors[0]).toEqual(errorMessage)
}
)
})
})
})
})
40 changes: 39 additions & 1 deletion packages/gatsby-remark-images/src/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { Potrace } = require(`potrace`)

exports.pluginOptionsSchema = function ({ Joi }) {
return Joi.object({
maxWidth: Joi.number()
@@ -52,7 +54,43 @@ exports.pluginOptionsSchema = function ({ Joi }) {
.description(
`Additionally generate WebP versions alongside your chosen file format. They are added as a srcset with the appropriate mimetype and will be loaded in browsers that support the format. Pass true for default support, or an object of options to specifically override those for the WebP files. For example, pass { quality: 80 } to have the WebP images be at quality level 80.`
),
tracedSVG: Joi.boolean()
tracedSVG: Joi.alternatives()
.try(
Joi.boolean(),
Joi.object({
turnPolicy: Joi.string()
.valid(
// this plugin also allow to use key names and not exact values
`TURNPOLICY_BLACK`,
`TURNPOLICY_WHITE`,
`TURNPOLICY_LEFT`,
`TURNPOLICY_RIGHT`,
`TURNPOLICY_MINORITY`,
`TURNPOLICY_MAJORITY`,
// it also allow using actual policy values
Potrace.TURNPOLICY_BLACK,
Potrace.TURNPOLICY_WHITE,
Potrace.TURNPOLICY_LEFT,
Potrace.TURNPOLICY_RIGHT,
Potrace.TURNPOLICY_MINORITY,
Potrace.TURNPOLICY_MAJORITY
)
.default(Potrace.TURNPOLICY_MAJORITY),
turdSize: Joi.number().default(100),
alphaMax: Joi.number(),
optCurve: Joi.boolean().default(true),
optTolerance: Joi.number().default(0.4),
threshold: Joi.alternatives()
.try(
Joi.number().min(0).max(255),
Joi.number().valid(Potrace.THRESHOLD_AUTO)
)
.default(Potrace.THRESHOLD_AUTO),
blackOnWhite: Joi.boolean().default(true),
color: Joi.string().default(`lightgray`),
background: Joi.string().default(`transparent`),
})
)
.default(false)
.description(
`Use traced SVGs for placeholder images instead of the “blur up” effect. Pass true for traced SVGs with the default settings (seen here), or an object of options to override the default. For example, pass { color: "#F00", turnPolicy: "TURNPOLICY_MAJORITY" } to change the color of the trace to red and the turn policy to TURNPOLICY_MAJORITY. See node-potrace parameter documentation for a full listing and explanation of the available options.`
Loading