From 6e00be42138426fe84f7326ecf0b9556d20172e7 Mon Sep 17 00:00:00 2001 From: Tyler Barnes Date: Thu, 18 Mar 2021 13:44:43 -0700 Subject: [PATCH 01/20] simplify with optional chaining --- .../src/steps/create-schema-customization/build-types.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/gatsby-source-wordpress/src/steps/create-schema-customization/build-types.js b/packages/gatsby-source-wordpress/src/steps/create-schema-customization/build-types.js index d5d30bfc87c67..fc0ef42cc0c4e 100644 --- a/packages/gatsby-source-wordpress/src/steps/create-schema-customization/build-types.js +++ b/packages/gatsby-source-wordpress/src/steps/create-schema-customization/build-types.js @@ -104,7 +104,7 @@ const interfaceType = typeBuilderApi => { } else { // otherwise this is a regular interface type so we need to resolve the type name typeDef.resolveType = node => - node && node.__typename ? buildTypeName(node.__typename) : null + node?.__typename ? buildTypeName(node.__typename) : null } // @todo add this as a plugin option From 76da8b345c815260e36fb6c5d7306addcb9c130c Mon Sep 17 00:00:00 2001 From: Tyler Barnes Date: Thu, 18 Mar 2021 13:49:27 -0700 Subject: [PATCH 02/20] use new reporter.panic signature with error code --- .../src/steps/create-schema-customization/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/gatsby-source-wordpress/src/steps/create-schema-customization/index.js b/packages/gatsby-source-wordpress/src/steps/create-schema-customization/index.js index e72877387a96f..7d8f89a3069b5 100644 --- a/packages/gatsby-source-wordpress/src/steps/create-schema-customization/index.js +++ b/packages/gatsby-source-wordpress/src/steps/create-schema-customization/index.js @@ -5,6 +5,8 @@ import { fieldOfTypeWasFetched } from "./helpers" import buildType from "./build-types" import { getGatsbyNodeTypeNames } from "../source-nodes/fetch-nodes/fetch-nodes" import { typeIsExcluded } from "~/steps/ingest-remote-schema/is-excluded" +import { formatLogMessage } from "../../utils/format-log-message" +import { CODES } from "../../utils/report" /** * createSchemaCustomization @@ -96,7 +98,12 @@ const createSchemaCustomization = async api => { try { await customizeSchema(api) } catch (e) { - api.reporter.panic(e) + api.reporter.panic({ + id: CODES.SourcePluginCodeError, + context: { + sourceMessage: formatLogMessage(e.stack), + }, + }) } } From 7ae6078d0281c1d9afae9266804a551073b9bbea Mon Sep 17 00:00:00 2001 From: Tyler Barnes Date: Thu, 18 Mar 2021 13:50:05 -0700 Subject: [PATCH 03/20] add the prefixed typename as a node property when creating nodes to prevent gql errors with interfaces --- .../src/steps/source-nodes/create-nodes/create-nodes.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/create-nodes.js b/packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/create-nodes.js index 262056ebd449d..e99f4bd2ba751 100644 --- a/packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/create-nodes.js +++ b/packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/create-nodes.js @@ -48,13 +48,16 @@ export const createNodeWithSideEffects = ({ }) } + const builtTypename = buildTypeName(node.__typename) + let remoteNode = { ...node, + __typename: builtTypename, id: node.id, parent: null, internal: { contentDigest: createContentDigest(node), - type: type || buildTypeName(node.type), + type: type || builtTypename, }, } From 22504a2a74c381a68608435c918432b2ad8e7bc2 Mon Sep 17 00:00:00 2001 From: Tyler Barnes Date: Thu, 18 Mar 2021 14:24:10 -0700 Subject: [PATCH 04/20] fix union types that have a field called "type" --- .../create-schema-customization/build-types.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/gatsby-source-wordpress/src/steps/create-schema-customization/build-types.js b/packages/gatsby-source-wordpress/src/steps/create-schema-customization/build-types.js index fc0ef42cc0c4e..1753c7f10e278 100644 --- a/packages/gatsby-source-wordpress/src/steps/create-schema-customization/build-types.js +++ b/packages/gatsby-source-wordpress/src/steps/create-schema-customization/build-types.js @@ -7,6 +7,7 @@ import { getTypeSettingsByType, filterTypeDefinition, } from "./helpers" +import { getPluginOptions } from "../../utils/get-gatsby-api" const unionType = typeBuilderApi => { const { schema, type, pluginOptions } = typeBuilderApi @@ -29,12 +30,14 @@ const unionType = typeBuilderApi => { name: buildTypeName(type.name), types, resolveType: node => { - if (node.type) { - return buildTypeName(node.type) - } - if (node.__typename) { - return buildTypeName(node.__typename) + const { + schema: { typePrefix: prefix }, + } = getPluginOptions() + + return node.__typename.startsWith(prefix) + ? node.__typename + : buildTypeName(node.__typename) } return null From 13d51c229111de9e2182190dcce42b792b0e7f05 Mon Sep 17 00:00:00 2001 From: Tyler Barnes Date: Thu, 18 Mar 2021 15:05:46 -0700 Subject: [PATCH 05/20] prevent excluded types from throwing errors in connection fields --- .../transform-fields/transform-object.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/gatsby-source-wordpress/src/steps/create-schema-customization/transform-fields/transform-object.js b/packages/gatsby-source-wordpress/src/steps/create-schema-customization/transform-fields/transform-object.js index d3940964e6d26..2fcb59b4b94ec 100644 --- a/packages/gatsby-source-wordpress/src/steps/create-schema-customization/transform-fields/transform-object.js +++ b/packages/gatsby-source-wordpress/src/steps/create-schema-customization/transform-fields/transform-object.js @@ -64,6 +64,12 @@ export const buildGatsbyNodeObjectResolver = ({ field, fieldName }) => async ( const queryInfo = getQueryInfoByTypeName(field.type.name) + if (!queryInfo) { + // if we don't have query info for a type + // it probably means this type is excluded in plugin options + return null + } + const isLazyMediaItem = queryInfo.typeInfo.nodesTypeName === `MediaItem` && queryInfo.settings.lazyNodes From f21c4f36fb923efe42fbba160f1299c236fa7646 Mon Sep 17 00:00:00 2001 From: Tyler Barnes Date: Fri, 19 Mar 2021 15:02:13 -0700 Subject: [PATCH 06/20] test node interface resolution --- .../test-fns/data-resolution.js | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/integration-tests/gatsby-source-wordpress/test-fns/data-resolution.js b/integration-tests/gatsby-source-wordpress/test-fns/data-resolution.js index 5e8e508e35b93..cb731ce97eebf 100644 --- a/integration-tests/gatsby-source-wordpress/test-fns/data-resolution.js +++ b/integration-tests/gatsby-source-wordpress/test-fns/data-resolution.js @@ -29,12 +29,10 @@ describe(`data resolution`, () => { expect(data[`allWpPage`].totalCount).toBe(1) expect(data[`allWpPost`].totalCount).toBe(1) expect(data[`allWpComment`].totalCount).toBe(1) - // expect(data[`allWpProject`].totalCount).toBe(1) expect(data[`allWpTaxonomy`].totalCount).toBe(3) expect(data[`allWpCategory`].totalCount).toBe(9) expect(data[`allWpMenu`].totalCount).toBe(1) expect(data[`allWpMenuItem`].totalCount).toBe(4) - // expect(data[`allWpTeamMember`].totalCount).toBe(1) expect(data[`allWpPostFormat`].totalCount).toBe(0) expect(data[`allWpContentType`].totalCount).toBe(6) }) @@ -53,6 +51,33 @@ describe(`data resolution`, () => { }, }) + it(`resolves node interfaces without errors`, async () => { + const query = /* GraphQL */ ` + query { + allWpTermNode { + nodes { + id + } + } + + allWpContentNode { + nodes { + id + } + } + } + ` + + // this will throw if there are gql errors + const gatsbyResult = await fetchGraphQL({ + url, + query, + }) + + expect(gatsbyResult.data.allWpTermNode.length).toBe(14) + expect(gatsbyResult.data.allWpContentNode.length).toBe(17) + }) + it(`resolves hierarchichal categories`, async () => { const gatsbyResult = await fetchGraphql({ url, From ebb13ead343c3699e114466a17aaf8b5d131179c Mon Sep 17 00:00:00 2001 From: Tyler Barnes Date: Fri, 19 Mar 2021 15:22:27 -0700 Subject: [PATCH 07/20] prevent double-prefixing --- .../src/steps/create-schema-customization/helpers.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/gatsby-source-wordpress/src/steps/create-schema-customization/helpers.js b/packages/gatsby-source-wordpress/src/steps/create-schema-customization/helpers.js index d08ab8ce82697..0afa669a0dd34 100644 --- a/packages/gatsby-source-wordpress/src/steps/create-schema-customization/helpers.js +++ b/packages/gatsby-source-wordpress/src/steps/create-schema-customization/helpers.js @@ -24,6 +24,10 @@ export const buildTypeName = name => { name = `FilterType` } + if (name.startsWith(prefix)) { + return name + } + return prefix + name } From 4c57fe768e8c48e8cac616b8c8c935374d3553c9 Mon Sep 17 00:00:00 2001 From: Tyler Barnes Date: Fri, 19 Mar 2021 17:25:04 -0700 Subject: [PATCH 08/20] test that interfaces that are mixed node and non-node resolve --- .../test-fns/data-resolution.js | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/integration-tests/gatsby-source-wordpress/test-fns/data-resolution.js b/integration-tests/gatsby-source-wordpress/test-fns/data-resolution.js index cb731ce97eebf..4ebcdcd2e08bb 100644 --- a/integration-tests/gatsby-source-wordpress/test-fns/data-resolution.js +++ b/integration-tests/gatsby-source-wordpress/test-fns/data-resolution.js @@ -78,6 +78,34 @@ describe(`data resolution`, () => { expect(gatsbyResult.data.allWpContentNode.length).toBe(17) }) + it(`resolves interface fields which are a mix of Gatsby nodes and regular object data with no node`, async () => { + const query = /* GraphQL */ ` + query { + wpPost(id: { eq: "cG9zdDox" }) { + id + comments { + nodes { + author { + # this is an interface of WpUser (Gatsby node type) and WpCommentAuthor (no node for this so needs to be fetched on the comment) + node { + name + } + } + } + } + } + } + ` + + // this will throw an error if there are gql errors + const gatsbyResult = await fetchGraphQL({ + url, + query, + }) + + expect(gatsbyResult.data.wpPost.comments.length).toBe(1) + }) + it(`resolves hierarchichal categories`, async () => { const gatsbyResult = await fetchGraphql({ url, From 43d1dbe1b43b7c43fad9b7b81be334894bac68ab Mon Sep 17 00:00:00 2001 From: Tyler Barnes Date: Fri, 19 Mar 2021 17:40:27 -0700 Subject: [PATCH 09/20] prefix the __typename field in the default resolver for Gatsby v3 --- .../transform-fields/default-resolver.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/gatsby-source-wordpress/src/steps/create-schema-customization/transform-fields/default-resolver.js b/packages/gatsby-source-wordpress/src/steps/create-schema-customization/transform-fields/default-resolver.js index de217f48e02f9..1c3c8e55ad8ec 100644 --- a/packages/gatsby-source-wordpress/src/steps/create-schema-customization/transform-fields/default-resolver.js +++ b/packages/gatsby-source-wordpress/src/steps/create-schema-customization/transform-fields/default-resolver.js @@ -1,6 +1,7 @@ import { findTypeName } from "~/steps/create-schema-customization/helpers" import { buildGatsbyNodeObjectResolver } from "~/steps/create-schema-customization/transform-fields/transform-object" +import { buildTypeName } from "../helpers" export const buildDefaultResolver = transformerApi => (source, _, context) => { const { fieldName, field, gatsbyNodeTypes } = transformerApi @@ -45,6 +46,12 @@ export const buildDefaultResolver = transformerApi => (source, _, context) => { finalFieldValue = aliasedField2 } + if (finalFieldValue?.__typename) { + // in Gatsby V3 this property is used to determine the type of an interface field + // instead of the resolveType fn. This means we need to prefix it so that gql doesn't throw errors about missing types. + finalFieldValue.__typename = buildTypeName(finalFieldValue.__typename) + } + const isANodeConnection = // if this field has just an id and typename finalFieldValue?.id && From e45fa4b460f79bf499e58406d311bfe077cead25 Mon Sep 17 00:00:00 2001 From: Tyler Barnes Date: Fri, 19 Mar 2021 17:41:31 -0700 Subject: [PATCH 10/20] an interface type is only a gatsby node type if all implementing types are gatsby node types --- .../recursively-transform-fields.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/gatsby-source-wordpress/src/steps/ingest-remote-schema/build-queries-from-introspection/recursively-transform-fields.js b/packages/gatsby-source-wordpress/src/steps/ingest-remote-schema/build-queries-from-introspection/recursively-transform-fields.js index bd7e5d0735c70..652e3310e098e 100644 --- a/packages/gatsby-source-wordpress/src/steps/ingest-remote-schema/build-queries-from-introspection/recursively-transform-fields.js +++ b/packages/gatsby-source-wordpress/src/steps/ingest-remote-schema/build-queries-from-introspection/recursively-transform-fields.js @@ -306,7 +306,7 @@ export function transformField({ // or this type has a possible type which is a gatsby node type typeMap .get(typeName) - ?.possibleTypes?.find(possibleType => + ?.possibleTypes?.every(possibleType => gatsbyNodesInfo.typeNames.includes(possibleType.name) ) From 2d5d070e029feaeffa06d8640c3cb7d426deecea Mon Sep 17 00:00:00 2001 From: Tyler Barnes Date: Mon, 22 Mar 2021 17:06:48 -0700 Subject: [PATCH 11/20] exclude Commenter.databaseId in int tests to get around WPGQL bug --- integration-tests/gatsby-source-wordpress/gatsby-config.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/integration-tests/gatsby-source-wordpress/gatsby-config.js b/integration-tests/gatsby-source-wordpress/gatsby-config.js index f94b45ce74135..b2a323b857d4c 100644 --- a/integration-tests/gatsby-source-wordpress/gatsby-config.js +++ b/integration-tests/gatsby-source-wordpress/gatsby-config.js @@ -48,6 +48,9 @@ const wpPluginOptions = !process.env.DEFAULT_PLUGIN_OPTIONS `registeredDate`, ], }, + Commenter: { + excludeFieldNames: [`databaseId`], + }, Post: { limit: process.env.NODE_ENV === `development` From c47f2b989c01661f1713586f472633d0a9510047 Mon Sep 17 00:00:00 2001 From: Tyler Barnes Date: Mon, 22 Mar 2021 17:35:12 -0700 Subject: [PATCH 12/20] only return null if there's no gatsby node AND no resolved field data --- .../transform-fields/transform-union.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/gatsby-source-wordpress/src/steps/create-schema-customization/transform-fields/transform-union.js b/packages/gatsby-source-wordpress/src/steps/create-schema-customization/transform-fields/transform-union.js index 052e57ced694a..b79f568344e66 100644 --- a/packages/gatsby-source-wordpress/src/steps/create-schema-customization/transform-fields/transform-union.js +++ b/packages/gatsby-source-wordpress/src/steps/create-schema-customization/transform-fields/transform-union.js @@ -16,12 +16,10 @@ export const transformUnion = ({ field, fieldName }) => { if (gatsbyNode) { return gatsbyNode - } else { - return null } } - return resolvedField + return resolvedField ?? null }, } } From 923a8eb73aac777a39151d7055bb6785fc5d3657 Mon Sep 17 00:00:00 2001 From: Tyler Barnes Date: Mon, 22 Mar 2021 17:54:05 -0700 Subject: [PATCH 13/20] fix util name spelling --- .../gatsby-source-wordpress/test-fns/data-resolution.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration-tests/gatsby-source-wordpress/test-fns/data-resolution.js b/integration-tests/gatsby-source-wordpress/test-fns/data-resolution.js index 4ebcdcd2e08bb..7117d220b8616 100644 --- a/integration-tests/gatsby-source-wordpress/test-fns/data-resolution.js +++ b/integration-tests/gatsby-source-wordpress/test-fns/data-resolution.js @@ -69,7 +69,7 @@ describe(`data resolution`, () => { ` // this will throw if there are gql errors - const gatsbyResult = await fetchGraphQL({ + const gatsbyResult = await fetchGraphql({ url, query, }) @@ -98,7 +98,7 @@ describe(`data resolution`, () => { ` // this will throw an error if there are gql errors - const gatsbyResult = await fetchGraphQL({ + const gatsbyResult = await fetchGraphql({ url, query, }) From 864d1d6826d6472393bc5fa845c83c7b3282fb5d Mon Sep 17 00:00:00 2001 From: Tyler Barnes Date: Mon, 22 Mar 2021 18:06:04 -0700 Subject: [PATCH 14/20] add comment author schema to snapshot --- .../__tests__/__snapshots__/index.js.snap | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/integration-tests/gatsby-source-wordpress/__tests__/__snapshots__/index.js.snap b/integration-tests/gatsby-source-wordpress/__tests__/__snapshots__/index.js.snap index fd6d2989ba730..595396781502d 100644 --- a/integration-tests/gatsby-source-wordpress/__tests__/__snapshots__/index.js.snap +++ b/integration-tests/gatsby-source-wordpress/__tests__/__snapshots__/index.js.snap @@ -551,6 +551,62 @@ Array [ ], "name": "WpComment", }, + Object { + "fields": Array [ + "databaseId", + "email", + "id", + "name", + "url", + "nodeType", + "parent", + "children", + "internal", + ], + "name": "WpCommentAuthor", + }, + Object { + "fields": Array [ + "totalCount", + "edges", + "nodes", + "pageInfo", + "distinct", + "group", + ], + "name": "WpCommentAuthorConnection", + }, + Object { + "fields": Array [ + "next", + "node", + "previous", + ], + "name": "WpCommentAuthorEdge", + }, + Object { + "fields": null, + "name": "WpCommentAuthorFieldsEnum", + }, + Object { + "fields": null, + "name": "WpCommentAuthorFilterInput", + }, + Object { + "fields": Array [ + "totalCount", + "edges", + "nodes", + "pageInfo", + "field", + "fieldValue", + ], + "name": "WpCommentAuthorGroupConnection", + }, + Object { + "fields": null, + "name": "WpCommentAuthorSortInput", + }, Object { "fields": Array [ "totalCount", From 4876a846d2f4936a06e72b5ca89aa9fdd35668a9 Mon Sep 17 00:00:00 2001 From: Tyler Barnes Date: Mon, 22 Mar 2021 18:06:22 -0700 Subject: [PATCH 15/20] add index page so wait-on doesn't think the 404 means it's not ready --- integration-tests/gatsby-source-wordpress/src/pages/index.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 integration-tests/gatsby-source-wordpress/src/pages/index.js diff --git a/integration-tests/gatsby-source-wordpress/src/pages/index.js b/integration-tests/gatsby-source-wordpress/src/pages/index.js new file mode 100644 index 0000000000000..1cf1659123a3a --- /dev/null +++ b/integration-tests/gatsby-source-wordpress/src/pages/index.js @@ -0,0 +1,5 @@ +import React from "react" + +export default function index() { + return
Index page
+} From 68994458699870b2aca3ebac981d032db2d0fefb Mon Sep 17 00:00:00 2001 From: Tyler Barnes Date: Mon, 22 Mar 2021 18:10:59 -0700 Subject: [PATCH 16/20] use correct property path in tests --- .../gatsby-source-wordpress/test-fns/data-resolution.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/integration-tests/gatsby-source-wordpress/test-fns/data-resolution.js b/integration-tests/gatsby-source-wordpress/test-fns/data-resolution.js index 7117d220b8616..d9ec8f17f6d98 100644 --- a/integration-tests/gatsby-source-wordpress/test-fns/data-resolution.js +++ b/integration-tests/gatsby-source-wordpress/test-fns/data-resolution.js @@ -74,8 +74,8 @@ describe(`data resolution`, () => { query, }) - expect(gatsbyResult.data.allWpTermNode.length).toBe(14) - expect(gatsbyResult.data.allWpContentNode.length).toBe(17) + expect(gatsbyResult.data.allWpTermNode.nodes.length).toBe(14) + expect(gatsbyResult.data.allWpContentNode.nodes.length).toBe(12) }) it(`resolves interface fields which are a mix of Gatsby nodes and regular object data with no node`, async () => { @@ -103,7 +103,7 @@ describe(`data resolution`, () => { query, }) - expect(gatsbyResult.data.wpPost.comments.length).toBe(1) + expect(gatsbyResult.data.wpPost.comments.nodes.length).toBe(1) }) it(`resolves hierarchichal categories`, async () => { From 0504d190ca9618fd35d7e9646474a41b9596c275 Mon Sep 17 00:00:00 2001 From: Tyler Barnes Date: Tue, 23 Mar 2021 10:25:48 -0700 Subject: [PATCH 17/20] update comment --- .../recursively-transform-fields.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/gatsby-source-wordpress/src/steps/ingest-remote-schema/build-queries-from-introspection/recursively-transform-fields.js b/packages/gatsby-source-wordpress/src/steps/ingest-remote-schema/build-queries-from-introspection/recursively-transform-fields.js index 652e3310e098e..e07f0e6665052 100644 --- a/packages/gatsby-source-wordpress/src/steps/ingest-remote-schema/build-queries-from-introspection/recursively-transform-fields.js +++ b/packages/gatsby-source-wordpress/src/steps/ingest-remote-schema/build-queries-from-introspection/recursively-transform-fields.js @@ -303,7 +303,7 @@ export function transformField({ const isAGatsbyNode = // if this is a gatsby node type gatsbyNodesInfo.typeNames.includes(typeName) || - // or this type has a possible type which is a gatsby node type + // or all possible types on this type are Gatsby node types typeMap .get(typeName) ?.possibleTypes?.every(possibleType => From 5112a66a5299dafeba156a0c8daf0a515a19fcb5 Mon Sep 17 00:00:00 2001 From: Tyler Barnes Date: Tue, 23 Mar 2021 16:47:51 -0700 Subject: [PATCH 18/20] remove duplicate logic --- .../src/steps/create-schema-customization/build-types.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/gatsby-source-wordpress/src/steps/create-schema-customization/build-types.js b/packages/gatsby-source-wordpress/src/steps/create-schema-customization/build-types.js index 1753c7f10e278..f6b4c218f2ea7 100644 --- a/packages/gatsby-source-wordpress/src/steps/create-schema-customization/build-types.js +++ b/packages/gatsby-source-wordpress/src/steps/create-schema-customization/build-types.js @@ -31,13 +31,7 @@ const unionType = typeBuilderApi => { types, resolveType: node => { if (node.__typename) { - const { - schema: { typePrefix: prefix }, - } = getPluginOptions() - - return node.__typename.startsWith(prefix) - ? node.__typename - : buildTypeName(node.__typename) + return buildTypeName(node.__typename) } return null From 9160d3bc4b37bf0c0ef639a8391c3dd01454c882 Mon Sep 17 00:00:00 2001 From: Tyler Barnes Date: Tue, 23 Mar 2021 16:48:43 -0700 Subject: [PATCH 19/20] remove unused import --- .../src/steps/create-schema-customization/build-types.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/gatsby-source-wordpress/src/steps/create-schema-customization/build-types.js b/packages/gatsby-source-wordpress/src/steps/create-schema-customization/build-types.js index f6b4c218f2ea7..2c61e1b95b988 100644 --- a/packages/gatsby-source-wordpress/src/steps/create-schema-customization/build-types.js +++ b/packages/gatsby-source-wordpress/src/steps/create-schema-customization/build-types.js @@ -7,7 +7,6 @@ import { getTypeSettingsByType, filterTypeDefinition, } from "./helpers" -import { getPluginOptions } from "../../utils/get-gatsby-api" const unionType = typeBuilderApi => { const { schema, type, pluginOptions } = typeBuilderApi From d5ef7ce1c4f58b530fe295ce490f37ac073c120d Mon Sep 17 00:00:00 2001 From: Tyler Barnes Date: Tue, 23 Mar 2021 16:52:33 -0700 Subject: [PATCH 20/20] pass full error object to reporter.panic --- .../src/steps/create-schema-customization/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/gatsby-source-wordpress/src/steps/create-schema-customization/index.js b/packages/gatsby-source-wordpress/src/steps/create-schema-customization/index.js index 7d8f89a3069b5..fa6dd48b747f2 100644 --- a/packages/gatsby-source-wordpress/src/steps/create-schema-customization/index.js +++ b/packages/gatsby-source-wordpress/src/steps/create-schema-customization/index.js @@ -100,8 +100,9 @@ const createSchemaCustomization = async api => { } catch (e) { api.reporter.panic({ id: CODES.SourcePluginCodeError, + error: e, context: { - sourceMessage: formatLogMessage(e.stack), + sourceMessage: formatLogMessage(e.message), }, }) }