Skip to content

Commit

Permalink
feat(gatsby): drop SitePage inference and schema update (#33319)
Browse files Browse the repository at this point in the history
* feat(gatsby): drop SitePage inference and schema update

* fix cli integration tests

* add missing field to built-it SitePage type

* update snapshots

* correct link between nodes

* infer -> dontInfer

* trigger tests re-run

* trigger tests re-run

* Restore `assignChangedPages`
  • Loading branch information
vladar authored Sep 28, 2021
1 parent 08c5b2a commit 17a3f9f
Show file tree
Hide file tree
Showing 20 changed files with 148 additions and 409 deletions.
1 change: 0 additions & 1 deletion integration-tests/gatsby-cli/__tests__/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ describe(`gatsby build`, () => {
logs.should.contain(`success createPages`)
logs.should.contain(`success createPagesStatefully`)
logs.should.contain(`success onPreExtractQueries`)
logs.should.contain(`success update schema`)
logs.should.contain(`success extract queries from components`)
logs.should.contain(`success write out requires`)
logs.should.contain(`success write out redirect data`)
Expand Down
1 change: 0 additions & 1 deletion integration-tests/gatsby-cli/__tests__/develop.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ describe(`gatsby develop`, () => {
logs.should.contain(`success createPages`)
logs.should.contain(`success createPagesStatefully`)
logs.should.contain(`success onPreExtractQueries`)
logs.should.contain(`success update schema`)
logs.should.contain(`success extract queries from components`)
logs.should.contain(`success write out requires`)
logs.should.contain(`success write out redirect data`)
Expand Down
1 change: 0 additions & 1 deletion integration-tests/gatsby-cli/__tests__/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ describe(`gatsby repl`, () => {
logs.should.contain(`success createPages`)
logs.should.contain(`success createPagesStatefully`)
logs.should.contain(`success onPreExtractQueries`)
logs.should.contain(`success update schema`)
logs.should.contain(`success extract queries from components`)
logs.should.contain(`success write out redirect data`)
logs.should.contain(`success onPostBootstrap`)
Expand Down
3 changes: 0 additions & 3 deletions packages/gatsby/src/bootstrap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
extractQueries,
writeOutRedirects,
postBootstrap,
rebuildSchemaWithSitePage,
} from "../services"
import { Runner, createGraphQLRunner } from "./create-graphql-runner"
import { globalTracer } from "opentracing"
Expand Down Expand Up @@ -70,8 +69,6 @@ export async function bootstrap(

await handleStalePageData(parentSpan)

await rebuildSchemaWithSitePage(context)

if (process.env.GATSBY_EXPERIMENTAL_PARALLEL_QUERY_RUNNING) {
savePartialStateToDisk([`inferenceMetadata`])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ type SitePage implements Node {
componentChunkName: String!
matchPath: String
pageContext: JSON
pluginCreator: SitePlugin
id: ID!
parent: Node
children: [Node!]!
Expand Down Expand Up @@ -482,7 +483,7 @@ type Query {
allSite(filter: SiteFilterInput, sort: SiteSortInput, skip: Int, limit: Int): SiteConnection!
siteFunction(functionRoute: StringQueryOperatorInput, pluginName: StringQueryOperatorInput, originalAbsoluteFilePath: StringQueryOperatorInput, originalRelativeFilePath: StringQueryOperatorInput, relativeCompiledFilePath: StringQueryOperatorInput, absoluteCompiledFilePath: StringQueryOperatorInput, matchPath: StringQueryOperatorInput, id: StringQueryOperatorInput, parent: NodeFilterInput, children: NodeFilterListInput, internal: InternalFilterInput): SiteFunction
allSiteFunction(filter: SiteFunctionFilterInput, sort: SiteFunctionSortInput, skip: Int, limit: Int): SiteFunctionConnection!
sitePage(path: StringQueryOperatorInput, component: StringQueryOperatorInput, internalComponentName: StringQueryOperatorInput, componentChunkName: StringQueryOperatorInput, matchPath: StringQueryOperatorInput, pageContext: JSONQueryOperatorInput, id: StringQueryOperatorInput, parent: NodeFilterInput, children: NodeFilterListInput, internal: InternalFilterInput): SitePage
sitePage(path: StringQueryOperatorInput, component: StringQueryOperatorInput, internalComponentName: StringQueryOperatorInput, componentChunkName: StringQueryOperatorInput, matchPath: StringQueryOperatorInput, pageContext: JSONQueryOperatorInput, pluginCreator: SitePluginFilterInput, id: StringQueryOperatorInput, parent: NodeFilterInput, children: NodeFilterListInput, internal: InternalFilterInput): SitePage
allSitePage(filter: SitePageFilterInput, sort: SitePageSortInput, skip: Int, limit: Int): SitePageConnection!
sitePlugin(resolve: StringQueryOperatorInput, name: StringQueryOperatorInput, version: StringQueryOperatorInput, nodeAPIs: StringQueryOperatorInput, browserAPIs: StringQueryOperatorInput, ssrAPIs: StringQueryOperatorInput, pluginFilepath: StringQueryOperatorInput, pluginOptions: JSONQueryOperatorInput, packageJson: JSONQueryOperatorInput, id: StringQueryOperatorInput, parent: NodeFilterInput, children: NodeFilterListInput, internal: InternalFilterInput): SitePlugin
allSitePlugin(filter: SitePluginFilterInput, sort: SitePluginSortInput, skip: Int, limit: Int): SitePluginConnection!
Expand Down Expand Up @@ -1265,6 +1266,22 @@ input JSONQueryOperatorInput {
glob: JSON
}
input SitePluginFilterInput {
resolve: StringQueryOperatorInput
name: StringQueryOperatorInput
version: StringQueryOperatorInput
nodeAPIs: StringQueryOperatorInput
browserAPIs: StringQueryOperatorInput
ssrAPIs: StringQueryOperatorInput
pluginFilepath: StringQueryOperatorInput
pluginOptions: JSONQueryOperatorInput
packageJson: JSONQueryOperatorInput
id: StringQueryOperatorInput
parent: NodeFilterInput
children: NodeFilterListInput
internal: InternalFilterInput
}
type SitePageConnection {
totalCount: Int!
edges: [SitePageEdge!]!
Expand All @@ -1290,6 +1307,53 @@ enum SitePageFieldsEnum {
componentChunkName
matchPath
pageContext
pluginCreator___resolve
pluginCreator___name
pluginCreator___version
pluginCreator___nodeAPIs
pluginCreator___browserAPIs
pluginCreator___ssrAPIs
pluginCreator___pluginFilepath
pluginCreator___pluginOptions
pluginCreator___packageJson
pluginCreator___id
pluginCreator___parent___id
pluginCreator___parent___parent___id
pluginCreator___parent___parent___children
pluginCreator___parent___children
pluginCreator___parent___children___id
pluginCreator___parent___children___children
pluginCreator___parent___internal___content
pluginCreator___parent___internal___contentDigest
pluginCreator___parent___internal___description
pluginCreator___parent___internal___fieldOwners
pluginCreator___parent___internal___ignoreType
pluginCreator___parent___internal___mediaType
pluginCreator___parent___internal___owner
pluginCreator___parent___internal___type
pluginCreator___children
pluginCreator___children___id
pluginCreator___children___parent___id
pluginCreator___children___parent___children
pluginCreator___children___children
pluginCreator___children___children___id
pluginCreator___children___children___children
pluginCreator___children___internal___content
pluginCreator___children___internal___contentDigest
pluginCreator___children___internal___description
pluginCreator___children___internal___fieldOwners
pluginCreator___children___internal___ignoreType
pluginCreator___children___internal___mediaType
pluginCreator___children___internal___owner
pluginCreator___children___internal___type
pluginCreator___internal___content
pluginCreator___internal___contentDigest
pluginCreator___internal___description
pluginCreator___internal___fieldOwners
pluginCreator___internal___ignoreType
pluginCreator___internal___mediaType
pluginCreator___internal___owner
pluginCreator___internal___type
id
parent___id
parent___parent___id
Expand Down Expand Up @@ -1399,6 +1463,7 @@ input SitePageFilterInput {
componentChunkName: StringQueryOperatorInput
matchPath: StringQueryOperatorInput
pageContext: JSONQueryOperatorInput
pluginCreator: SitePluginFilterInput
id: StringQueryOperatorInput
parent: NodeFilterInput
children: NodeFilterListInput
Expand Down Expand Up @@ -1540,22 +1605,6 @@ type SitePluginGroupConnection {
fieldValue: String
}
input SitePluginFilterInput {
resolve: StringQueryOperatorInput
name: StringQueryOperatorInput
version: StringQueryOperatorInput
nodeAPIs: StringQueryOperatorInput
browserAPIs: StringQueryOperatorInput
ssrAPIs: StringQueryOperatorInput
pluginFilepath: StringQueryOperatorInput
pluginOptions: JSONQueryOperatorInput
packageJson: JSONQueryOperatorInput
id: StringQueryOperatorInput
parent: NodeFilterInput
children: NodeFilterListInput
internal: InternalFilterInput
}
input SitePluginSortInput {
fields: [SitePluginFieldsEnum]
order: [SortOrderEnum] = [ASC]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ type SitePage implements Node @dontInfer {
componentChunkName: String!
matchPath: String
pageContext: JSON
pluginCreator: SitePlugin @link(by: \\"id\\", from: \\"pluginCreatorId\\")
}
type SitePlugin implements Node @dontInfer {
Expand Down Expand Up @@ -288,6 +289,7 @@ type SitePage implements Node @dontInfer {
componentChunkName: String!
matchPath: String
pageContext: JSON
pluginCreator: SitePlugin @link(by: \\"id\\", from: \\"pluginCreatorId\\")
}
type SitePlugin implements Node @dontInfer {
Expand Down Expand Up @@ -480,6 +482,7 @@ type SitePage implements Node @dontInfer {
componentChunkName: String!
matchPath: String
pageContext: JSON
pluginCreator: SitePlugin @link(by: \\"id\\", from: \\"pluginCreatorId\\")
}
type SitePlugin implements Node @dontInfer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ type SitePage implements Node {
componentChunkName: String!
matchPath: String
pageContext: JSON
pluginCreator: SitePlugin
id: ID!
parent: Node
children: [Node!]!
Expand Down Expand Up @@ -482,7 +483,7 @@ type Query {
allSite(filter: SiteFilterInput, sort: SiteSortInput, skip: Int, limit: Int): SiteConnection!
siteFunction(functionRoute: StringQueryOperatorInput, pluginName: StringQueryOperatorInput, originalAbsoluteFilePath: StringQueryOperatorInput, originalRelativeFilePath: StringQueryOperatorInput, relativeCompiledFilePath: StringQueryOperatorInput, absoluteCompiledFilePath: StringQueryOperatorInput, matchPath: StringQueryOperatorInput, id: StringQueryOperatorInput, parent: NodeFilterInput, children: NodeFilterListInput, internal: InternalFilterInput): SiteFunction
allSiteFunction(filter: SiteFunctionFilterInput, sort: SiteFunctionSortInput, skip: Int, limit: Int): SiteFunctionConnection!
sitePage(path: StringQueryOperatorInput, component: StringQueryOperatorInput, internalComponentName: StringQueryOperatorInput, componentChunkName: StringQueryOperatorInput, matchPath: StringQueryOperatorInput, pageContext: JSONQueryOperatorInput, id: StringQueryOperatorInput, parent: NodeFilterInput, children: NodeFilterListInput, internal: InternalFilterInput): SitePage
sitePage(path: StringQueryOperatorInput, component: StringQueryOperatorInput, internalComponentName: StringQueryOperatorInput, componentChunkName: StringQueryOperatorInput, matchPath: StringQueryOperatorInput, pageContext: JSONQueryOperatorInput, pluginCreator: SitePluginFilterInput, id: StringQueryOperatorInput, parent: NodeFilterInput, children: NodeFilterListInput, internal: InternalFilterInput): SitePage
allSitePage(filter: SitePageFilterInput, sort: SitePageSortInput, skip: Int, limit: Int): SitePageConnection!
sitePlugin(resolve: StringQueryOperatorInput, name: StringQueryOperatorInput, version: StringQueryOperatorInput, nodeAPIs: StringQueryOperatorInput, browserAPIs: StringQueryOperatorInput, ssrAPIs: StringQueryOperatorInput, pluginFilepath: StringQueryOperatorInput, pluginOptions: JSONQueryOperatorInput, packageJson: JSONQueryOperatorInput, id: StringQueryOperatorInput, parent: NodeFilterInput, children: NodeFilterListInput, internal: InternalFilterInput): SitePlugin
allSitePlugin(filter: SitePluginFilterInput, sort: SitePluginSortInput, skip: Int, limit: Int): SitePluginConnection!
Expand Down Expand Up @@ -1265,6 +1266,22 @@ input JSONQueryOperatorInput {
glob: JSON
}
input SitePluginFilterInput {
resolve: StringQueryOperatorInput
name: StringQueryOperatorInput
version: StringQueryOperatorInput
nodeAPIs: StringQueryOperatorInput
browserAPIs: StringQueryOperatorInput
ssrAPIs: StringQueryOperatorInput
pluginFilepath: StringQueryOperatorInput
pluginOptions: JSONQueryOperatorInput
packageJson: JSONQueryOperatorInput
id: StringQueryOperatorInput
parent: NodeFilterInput
children: NodeFilterListInput
internal: InternalFilterInput
}
type SitePageConnection {
totalCount: Int!
edges: [SitePageEdge!]!
Expand All @@ -1290,6 +1307,53 @@ enum SitePageFieldsEnum {
componentChunkName
matchPath
pageContext
pluginCreator___resolve
pluginCreator___name
pluginCreator___version
pluginCreator___nodeAPIs
pluginCreator___browserAPIs
pluginCreator___ssrAPIs
pluginCreator___pluginFilepath
pluginCreator___pluginOptions
pluginCreator___packageJson
pluginCreator___id
pluginCreator___parent___id
pluginCreator___parent___parent___id
pluginCreator___parent___parent___children
pluginCreator___parent___children
pluginCreator___parent___children___id
pluginCreator___parent___children___children
pluginCreator___parent___internal___content
pluginCreator___parent___internal___contentDigest
pluginCreator___parent___internal___description
pluginCreator___parent___internal___fieldOwners
pluginCreator___parent___internal___ignoreType
pluginCreator___parent___internal___mediaType
pluginCreator___parent___internal___owner
pluginCreator___parent___internal___type
pluginCreator___children
pluginCreator___children___id
pluginCreator___children___parent___id
pluginCreator___children___parent___children
pluginCreator___children___children
pluginCreator___children___children___id
pluginCreator___children___children___children
pluginCreator___children___internal___content
pluginCreator___children___internal___contentDigest
pluginCreator___children___internal___description
pluginCreator___children___internal___fieldOwners
pluginCreator___children___internal___ignoreType
pluginCreator___children___internal___mediaType
pluginCreator___children___internal___owner
pluginCreator___children___internal___type
pluginCreator___internal___content
pluginCreator___internal___contentDigest
pluginCreator___internal___description
pluginCreator___internal___fieldOwners
pluginCreator___internal___ignoreType
pluginCreator___internal___mediaType
pluginCreator___internal___owner
pluginCreator___internal___type
id
parent___id
parent___parent___id
Expand Down Expand Up @@ -1399,6 +1463,7 @@ input SitePageFilterInput {
componentChunkName: StringQueryOperatorInput
matchPath: StringQueryOperatorInput
pageContext: JSONQueryOperatorInput
pluginCreator: SitePluginFilterInput
id: StringQueryOperatorInput
parent: NodeFilterInput
children: NodeFilterListInput
Expand Down Expand Up @@ -1540,22 +1605,6 @@ type SitePluginGroupConnection {
fieldValue: String
}
input SitePluginFilterInput {
resolve: StringQueryOperatorInput
name: StringQueryOperatorInput
version: StringQueryOperatorInput
nodeAPIs: StringQueryOperatorInput
browserAPIs: StringQueryOperatorInput
ssrAPIs: StringQueryOperatorInput
pluginFilepath: StringQueryOperatorInput
pluginOptions: JSONQueryOperatorInput
packageJson: JSONQueryOperatorInput
id: StringQueryOperatorInput
parent: NodeFilterInput
children: NodeFilterListInput
internal: InternalFilterInput
}
input SitePluginSortInput {
fields: [SitePluginFieldsEnum]
order: [SortOrderEnum] = [ASC]
Expand Down
2 changes: 2 additions & 0 deletions packages/gatsby/src/schema/__tests__/build-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,7 @@ describe(`Build schema`, () => {
`componentChunkName`,
`matchPath`,
`pageContext`,
`pluginCreator`,
`bar`,
`id`,
`parent`,
Expand Down Expand Up @@ -1156,6 +1157,7 @@ describe(`Build schema`, () => {
`componentChunkName`,
`matchPath`,
`pageContext`,
`pluginCreator`,
`bar`,
`id`,
`parent`,
Expand Down
4 changes: 1 addition & 3 deletions packages/gatsby/src/schema/__tests__/rebuild-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const {
} = require(`graphql`)
const { store } = require(`../../redux`)
const { actions } = require(`../../redux/actions`)
const { build, rebuild, rebuildWithSitePage } = require(`..`)
const { build, rebuild } = require(`..`)
import { buildObjectType } from "../types/type-builders"

jest.mock(`../../utils/api-runner-node`)
Expand Down Expand Up @@ -60,7 +60,6 @@ const addNodeField = ({ node, name, value }) => {

const rebuildTestSchema = async () => {
await rebuild({})
await rebuildWithSitePage({})
return store.getState().schema
}

Expand Down Expand Up @@ -1178,7 +1177,6 @@ describe(`Compatibility with addThirdPartySchema`, () => {
})
createNodes().forEach(addNode)
await build({})
await rebuildWithSitePage({})
const schema = store.getState().schema
assertValidSchema(schema)
})
Expand Down
Loading

0 comments on commit 17a3f9f

Please sign in to comment.