Skip to content

Commit 07098fb

Browse files
committed
Add RelayParser to convertASTDocuments call (#2736)
1 parent ecd25be commit 07098fb

File tree

3 files changed

+28
-20
lines changed

3 files changed

+28
-20
lines changed

packages/gatsby-plugin-sharp/src/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,9 @@ async function responsiveSizes({ file, args = {} }) {
402402
// images are intended to be displayed at their native resolution.
403403
const { width, height, density } = await sharp(file.absolutePath).metadata()
404404
const pixelRatio =
405-
options.sizeByPixelDensity && typeof density === `number` && density > 0 ? density / 72 : 1
405+
options.sizeByPixelDensity && typeof density === `number` && density > 0
406+
? density / 72
407+
: 1
406408
const presentationWidth = Math.min(
407409
options.maxWidth,
408410
Math.round(width / pixelRatio)

packages/gatsby/src/internal-plugins/query-runner/query-compiler.js

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
// @flow
2-
import path from 'path'
2+
import path from "path"
33
const normalize = require(`normalize-path`)
4-
import glob from 'glob'
5-
6-
import { validate } from 'graphql'
7-
import { IRTransforms } from 'relay-compiler'
8-
import ASTConvert from 'relay-compiler/lib/ASTConvert'
9-
import GraphQLCompilerContext from 'relay-compiler/lib/GraphQLCompilerContext'
10-
import filterContextForNode from 'relay-compiler/lib/filterContextForNode'
4+
import glob from "glob"
5+
6+
import { validate } from "graphql"
7+
import { IRTransforms } from "relay-compiler"
8+
import RelayParser from "relay-compiler/lib/RelayParser"
9+
import ASTConvert from "relay-compiler/lib/ASTConvert"
10+
import GraphQLCompilerContext from "relay-compiler/lib/GraphQLCompilerContext"
11+
import filterContextForNode from "relay-compiler/lib/filterContextForNode"
1112
const _ = require(`lodash`)
1213

13-
import { store } from '../../redux'
14-
import FileParser from './file-parser'
15-
import GraphQLIRPrinter from 'relay-compiler/lib/GraphQLIRPrinter'
14+
import { store } from "../../redux"
15+
import FileParser from "./file-parser"
16+
import GraphQLIRPrinter from "relay-compiler/lib/GraphQLIRPrinter"
1617
import {
1718
graphqlError,
1819
graphqlValidationError,
1920
multipleRootQueriesError,
20-
} from './graphql-errors'
21-
import report from 'gatsby-cli/lib/reporter'
21+
} from "./graphql-errors"
22+
import report from "gatsby-cli/lib/reporter"
2223

23-
import type { DocumentNode, GraphQLSchema } from 'graphql'
24+
import type { DocumentNode, GraphQLSchema } from "graphql"
2425

2526
const { printTransforms } = IRTransforms
2627

@@ -125,7 +126,12 @@ class Runner {
125126
let compilerContext = new GraphQLCompilerContext(this.schema)
126127
try {
127128
compilerContext = compilerContext.addAll(
128-
ASTConvert.convertASTDocuments(this.schema, documents, validationRules)
129+
ASTConvert.convertASTDocuments(
130+
this.schema,
131+
documents,
132+
validationRules,
133+
RelayParser.transform.bind(RelayParser)
134+
)
129135
)
130136
} catch (error) {
131137
this.reportError(graphqlError(namePathMap, nameDefMap, error))

packages/gatsby/src/redux/actions.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @flow
2-
import Joi from 'joi'
3-
import chalk from 'chalk'
2+
import Joi from "joi"
3+
import chalk from "chalk"
44
const _ = require(`lodash`)
55
const { bindActionCreators } = require(`redux`)
66
const { stripIndent } = require(`common-tags`)
@@ -10,8 +10,8 @@ const path = require(`path`)
1010
const { joinPath } = require(`../utils/path`)
1111
const { getNode, hasNodeChanged } = require(`./index`)
1212
const { store } = require(`./index`)
13-
import * as joiSchemas from '../joi-schemas/joi'
14-
import { generateComponentChunkName } from '../utils/js-chunk-names'
13+
import * as joiSchemas from "../joi-schemas/joi"
14+
import { generateComponentChunkName } from "../utils/js-chunk-names"
1515

1616
const actions = {}
1717

0 commit comments

Comments
 (0)