{node.description}
{product.price}
@@ -373,8 +371,7 @@ A few notes about this file: 1. The result of the query is added to the template component as the `data` prop. 2. The image path was automatically converted by the Sharp transformer into a “child node” that includes optimized versions of the image. -3. The query uses a [GraphQL fragment](/plugins/gatsby-image/#fragments) to query all the required data for optimized images. GraphQL fragments _do not work_ in the GraphQL Playground. -4. The `img` tag has been swapped out for a `gatsby-image` component named `Image`. Instead of a `src` attribute, it accepts an object with optimized image data. +3. The `img` tag has been swapped out for a `gatsby-plugin-image` component named `GatsbyImage`. Instead of a `src` attribute, it accepts an object with optimized image data. Save this file, run `gatsby develop`, then open `http://localhost:8000/gql/purple-hat/`: diff --git a/docs/docs/working-with-fonts-and-typography.md b/docs/docs/working-with-fonts-and-typography.md index 5bc7afa97ce63..ec78fd9c0e0b1 100644 --- a/docs/docs/working-with-fonts-and-typography.md +++ b/docs/docs/working-with-fonts-and-typography.md @@ -10,4 +10,4 @@ The three different kinds of fonts covered in this section are: - **[Web fonts](/docs/how-to/styling/using-web-fonts/)**: For when you want to use a font from a service like [Google Fonts](https://fonts.google.com/) or [Typekit Web Fonts](https://fonts.adobe.com/typekit). - **[Typography.js framework](/docs/using-typography-js/)**: For when you want to use a predefined set of fonts from the [Typography.js](https://kyleamathews.github.io/typography.js/) library. -Gatsby doesn’t have an opinion about which [styling approach](/docs/styling/) you choose. Most every possible option is supported through official and community plugins. (If there isn’t a plugin yet for your favorite option, consider [contributing](/docs/creating-plugins) one!) +Gatsby doesn’t have an opinion about which [styling approach](/docs/styling/) you choose. Almost every possible option is supported through official and community plugins. (If there isn’t a plugin yet for your favorite option, consider [contributing](/docs/creating-plugins) one!) diff --git a/docs/docs/working-with-images.md b/docs/docs/working-with-images.md index 67f1ac060c897..f9b6c26b9df4f 100644 --- a/docs/docs/working-with-images.md +++ b/docs/docs/working-with-images.md @@ -6,7 +6,7 @@ _This document uses the deprecated image plugin. Please check out how to work wi Optimizing images is a challenge on any website. To utilize best practices for performance across devices, you need multiple sizes and resolutions of each image. Luckily, Gatsby has several useful [plugins](/docs/plugins/) that work together to do that for images on [page components](/docs/conceptual/building-with-components/#page-components). -The recommended approach is to use [GraphQL queries](/docs/conceptual/graphql-concepts/) to get images of the optimal size or resolution, then, display them with the [`gatsby-image`](/plugins/gatsby-image/) component. +The recommended approach is to use [GraphQL queries](/docs/conceptual/graphql-concepts/) to get images of the optimal size or resolution, then, display them with the [`gatsby-plugin-image`](/plugins/gatsby-plugin-image/) component. ## Query images with GraphQL @@ -15,7 +15,7 @@ Querying images with GraphQL allows you to access the image's data as well as pe You'll need a few plugins for this: - [`gatsby-source-filesystem`](/plugins/gatsby-source-filesystem/) plugin allows you to [query files with GraphQL](/docs/conceptual/graphql-concepts/#images) -- [`gatsby-plugin-sharp`](/plugins/gatsby-plugin-sharp) powers the connections between Sharp and Gatsby Plugins +- [`gatsby-plugin-sharp`](/plugins/gatsby-plugin-sharp/) powers the connections between Sharp and Gatsby Plugins - [`gatsby-transformer-sharp`](/plugins/gatsby-transformer-sharp/) allows you to create multiples images of the right sizes and resolutions with a query If the final image is of a fixed size, optimization relies on having multiple resolutions of the image. If it is responsive, meaning it stretches to fill a container or page, optimization relies on having different sizes of the same image. See the [Gatsby Image documentation for more information](/plugins/gatsby-image/#two-types-of-responsive-images). @@ -38,9 +38,9 @@ export const query = graphql` ` ``` -## Optimizing images with gatsby-image +## Optimizing images with gatsby-plugin-image -[`gatsby-image`](/plugins/gatsby-image/) is a plugin that automatically creates React components for optimized images that: +[`gatsby-image`](/plugins/gatsby-plugin-image/) is a plugin that automatically creates React components for optimized images that: > - Loads the optimal size of image for each device size and screen resolution > - Holds the image position while loading so your page doesn't jump around as images load diff --git a/e2e-tests/contentful/schema.gql b/e2e-tests/contentful/schema.gql index 2a8e30403f33d..7a501577d38cb 100644 --- a/e2e-tests/contentful/schema.gql +++ b/e2e-tests/contentful/schema.gql @@ -1,4 +1,4 @@ -### Type definitions saved at 2021-05-21T17:02:49.951Z ### +### Type definitions saved at 2021-09-25T11:33:25.217Z ### type File implements Node @dontInfer { sourceInstanceName: String! @@ -96,43 +96,23 @@ type SitePage implements Node @dontInfer { internalComponentName: String! componentChunkName: String! matchPath: String + pageContext: JSON } -type MarkdownHeading { - id: String - value: String - depth: Int -} - -enum MarkdownHeadingLevels { - h1 - h2 - h3 - h4 - h5 - h6 -} - -enum MarkdownExcerptFormats { - PLAIN - HTML - MARKDOWN -} - -type MarkdownWordCount { - paragraphs: Int - sentences: Int - words: Int -} - -type MarkdownRemark implements Node @childOf(mimeTypes: ["text/markdown", "text/x-markdown"], types: ["contentfulTextLongPlainTextNode", "contentfulTextLongMarkdownTextNode", "contentfulTextLongLocalizedTextNode"]) @derivedTypes @dontInfer { - frontmatter: MarkdownRemarkFrontmatter - excerpt: String - rawMarkdownBody: String +type SitePlugin implements Node @dontInfer { + resolve: String + name: String + version: String + nodeAPIs: [String] + browserAPIs: [String] + ssrAPIs: [String] + pluginFilepath: String + pluginOptions: JSON + packageJson: JSON } -type MarkdownRemarkFrontmatter { - title: String +type SiteBuildMetadata implements Node @dontInfer { + buildTime: Date @dateformat } interface ContentfulEntry implements Node { @@ -184,15 +164,16 @@ type ContentfulNumber implements ContentfulReference & ContentfulEntry & Node @d contentful_id: String! node_locale: String! title: String - decimal: Float + integerLocalized: Int spaceId: String createdAt: Date @dateformat updatedAt: Date @dateformat sys: ContentfulNumberSys + metadata: ContentfulNumberMetadata + decimal: Float integer: Int content_reference: [ContentfulContentReference] @link(by: "id", from: "content reference___NODE") @proxy(from: "content reference___NODE") decimalLocalized: Float - integerLocalized: Int } type ContentfulNumberSys @derivedTypes { @@ -211,22 +192,31 @@ type ContentfulNumberSysContentTypeSys { id: String } +type ContentfulNumberMetadata { + tags: [ContentfulTag] @link(by: "id", from: "tags___NODE") +} + +type ContentfulTag implements Node @dontInfer { + name: String! + contentful_id: String! +} + type ContentfulContentReference implements ContentfulReference & ContentfulEntry & Node @derivedTypes @dontInfer { contentful_id: String! node_locale: String! title: String - manyLocalized: [ContentfulNumberContentfulTextUnion] @link(by: "id", from: "manyLocalized___NODE") + one: ContentfulContentReferenceContentfulTextUnion @link(by: "id", from: "one___NODE") + content_reference: [ContentfulContentReference] @link(by: "id", from: "content reference___NODE") @proxy(from: "content reference___NODE") spaceId: String createdAt: Date @dateformat updatedAt: Date @dateformat sys: ContentfulContentReferenceSys oneLocalized: ContentfulNumber @link(by: "id", from: "oneLocalized___NODE") - one: ContentfulContentReferenceContentfulTextUnion @link(by: "id", from: "one___NODE") - content_reference: [ContentfulContentReference] @link(by: "id", from: "content reference___NODE") @proxy(from: "content reference___NODE") many: [ContentfulContentReferenceContentfulNumberContentfulTextUnion] @link(by: "id", from: "many___NODE") + manyLocalized: [ContentfulNumberContentfulTextUnion] @link(by: "id", from: "manyLocalized___NODE") } -union ContentfulNumberContentfulTextUnion = ContentfulNumber | ContentfulText +union ContentfulContentReferenceContentfulTextUnion = ContentfulContentReference | ContentfulText type ContentfulContentReferenceSys @derivedTypes { type: String @@ -244,10 +234,10 @@ type ContentfulContentReferenceSysContentTypeSys { id: String } -union ContentfulContentReferenceContentfulTextUnion = ContentfulContentReference | ContentfulText - union ContentfulContentReferenceContentfulNumberContentfulTextUnion = ContentfulContentReference | ContentfulNumber | ContentfulText +union ContentfulNumberContentfulTextUnion = ContentfulNumber | ContentfulText + type ContentfulText implements ContentfulReference & ContentfulEntry & Node @derivedTypes @dontInfer { contentful_id: String! node_locale: String! @@ -257,12 +247,12 @@ type ContentfulText implements ContentfulReference & ContentfulEntry & Node @der createdAt: Date @dateformat updatedAt: Date @dateformat sys: ContentfulTextSys - shortLocalized: String longMarkdown: contentfulTextLongMarkdownTextNode @link(by: "id", from: "longMarkdown___NODE") + shortLocalized: String longPlain: contentfulTextLongPlainTextNode @link(by: "id", from: "longPlain___NODE") + shortList: [String] short: String content_reference: [ContentfulContentReference] @link(by: "id", from: "content reference___NODE") @proxy(from: "content reference___NODE") - shortList: [String] } type contentfulTextLongLocalizedTextNode implements Node @derivedTypes @childOf(types: ["ContentfulText"]) @dontInfer { @@ -312,14 +302,14 @@ type ContentfulMediaReference implements ContentfulReference & ContentfulEntry & contentful_id: String! node_locale: String! title: String - manyLocalized: [ContentfulAsset] @link(by: "id", from: "manyLocalized___NODE") + one: ContentfulAsset @link(by: "id", from: "one___NODE") spaceId: String createdAt: Date @dateformat updatedAt: Date @dateformat sys: ContentfulMediaReferenceSys - many: [ContentfulAsset] @link(by: "id", from: "many___NODE") oneLocalized: ContentfulAsset @link(by: "id", from: "oneLocalized___NODE") - one: ContentfulAsset @link(by: "id", from: "one___NODE") + many: [ContentfulAsset] @link(by: "id", from: "many___NODE") + manyLocalized: [ContentfulAsset] @link(by: "id", from: "manyLocalized___NODE") } type ContentfulMediaReferenceSys @derivedTypes { @@ -370,14 +360,14 @@ type ContentfulDate implements ContentfulReference & ContentfulEntry & Node @der contentful_id: String! node_locale: String! title: String - dateLocalized: Date @dateformat + dateTimeTimezone: Date @dateformat spaceId: String createdAt: Date @dateformat updatedAt: Date @dateformat sys: ContentfulDateSys - dateTime: Date @dateformat - dateTimeTimezone: Date @dateformat date: Date @dateformat + dateLocalized: Date @dateformat + dateTime: Date @dateformat } type ContentfulDateSys @derivedTypes { @@ -409,8 +399,8 @@ type ContentfulLocation implements ContentfulReference & ContentfulEntry & Node } type ContentfulLocationLocationLocalized { - lat: Float lon: Float + lat: Float } type ContentfulLocationSys @derivedTypes { @@ -438,25 +428,39 @@ type ContentfulJson implements ContentfulReference & ContentfulEntry & Node @der contentful_id: String! node_locale: String! title: String - jsonLocalized: contentfulJsonJsonLocalizedJsonNode @link(by: "id", from: "jsonLocalized___NODE") + json: contentfulJsonJsonJsonNode @link(by: "id", from: "json___NODE") spaceId: String createdAt: Date @dateformat updatedAt: Date @dateformat sys: ContentfulJsonSys - json: contentfulJsonJsonJsonNode @link(by: "id", from: "json___NODE") + jsonLocalized: contentfulJsonJsonLocalizedJsonNode @link(by: "id", from: "jsonLocalized___NODE") } -type contentfulJsonJsonLocalizedJsonNode implements Node @derivedTypes @childOf(types: ["ContentfulJson"]) @dontInfer { +type contentfulJsonJsonJsonNode implements Node @derivedTypes @childOf(types: ["ContentfulJson"]) @dontInfer { age: Int city: String name: String - sys: contentfulJsonJsonLocalizedJsonNodeSys + sys: contentfulJsonJsonJsonNodeSys + Actors: [contentfulJsonJsonJsonNodeActors] } -type contentfulJsonJsonLocalizedJsonNodeSys { +type contentfulJsonJsonJsonNodeSys { type: String } +type contentfulJsonJsonJsonNodeActors { + age: Int + name: String + wife: String + photo: String + weight: Float + Born_At: String @proxy(from: "Born At") + children: [String] + Birthdate: String + hasChildren: Boolean + hasGreyHair: Boolean +} + type ContentfulJsonSys @derivedTypes { type: String revision: Int @@ -473,28 +477,14 @@ type ContentfulJsonSysContentTypeSys { id: String } -type contentfulJsonJsonJsonNode implements Node @derivedTypes @childOf(types: ["ContentfulJson"]) @dontInfer { - Actors: [contentfulJsonJsonJsonNodeActors] - sys: contentfulJsonJsonJsonNodeSys +type contentfulJsonJsonLocalizedJsonNode implements Node @derivedTypes @childOf(types: ["ContentfulJson"]) @dontInfer { name: String age: Int city: String + sys: contentfulJsonJsonLocalizedJsonNodeSys } -type contentfulJsonJsonJsonNodeActors { - name: String - age: Int - Born_At: String @proxy(from: "Born At") - Birthdate: String - photo: String - wife: String - weight: Float - hasChildren: Boolean - hasGreyHair: Boolean - children: [String] -} - -type contentfulJsonJsonJsonNodeSys { +type contentfulJsonJsonLocalizedJsonNodeSys { type: String } @@ -502,21 +492,21 @@ type ContentfulRichText implements ContentfulReference & ContentfulEntry & Node contentful_id: String! node_locale: String! title: String - richTextValidated: ContentfulRichTextRichTextValidated + richText: ContentfulRichTextRichText spaceId: String createdAt: Date @dateformat updatedAt: Date @dateformat sys: ContentfulRichTextSys + richTextValidated: ContentfulRichTextRichTextValidated richTextLocalized: ContentfulRichTextRichTextLocalized - richText: ContentfulRichTextRichText } -type ContentfulRichTextRichTextValidated { +type ContentfulRichTextRichText { raw: String - references: [ContentfulAssetContentfulLocationContentfulNumberContentfulTextUnion] @link(by: "id", from: "references___NODE") + references: [ContentfulAssetContentfulContentReferenceContentfulLocationContentfulTextUnion] @link(by: "id", from: "references___NODE") } -union ContentfulAssetContentfulLocationContentfulNumberContentfulTextUnion = ContentfulAsset | ContentfulLocation | ContentfulNumber | ContentfulText +union ContentfulAssetContentfulContentReferenceContentfulLocationContentfulTextUnion = ContentfulAsset | ContentfulContentReference | ContentfulLocation | ContentfulText type ContentfulRichTextSys @derivedTypes { type: String @@ -534,22 +524,59 @@ type ContentfulRichTextSysContentTypeSys { id: String } -type ContentfulRichTextRichTextLocalized { +type ContentfulRichTextRichTextValidated { raw: String + references: [ContentfulAssetContentfulLocationContentfulNumberContentfulTextUnion] @link(by: "id", from: "references___NODE") } -type ContentfulRichTextRichText { +union ContentfulAssetContentfulLocationContentfulNumberContentfulTextUnion = ContentfulAsset | ContentfulLocation | ContentfulNumber | ContentfulText + +type ContentfulRichTextRichTextLocalized { raw: String - references: [ContentfulAssetContentfulContentReferenceContentfulLocationContentfulTextUnion] @link(by: "id", from: "references___NODE") } -union ContentfulAssetContentfulContentReferenceContentfulLocationContentfulTextUnion = ContentfulAsset | ContentfulContentReference | ContentfulLocation | ContentfulText - type ContentfulValidatedContentReference implements ContentfulReference & ContentfulEntry & Node @dontInfer { contentful_id: String! node_locale: String! } +type MarkdownHeading { + id: String + value: String + depth: Int +} + +enum MarkdownHeadingLevels { + h1 + h2 + h3 + h4 + h5 + h6 +} + +enum MarkdownExcerptFormats { + PLAIN + HTML + MARKDOWN +} + +type MarkdownWordCount { + paragraphs: Int + sentences: Int + words: Int +} + +type MarkdownRemark implements Node @childOf(mimeTypes: ["text/markdown", "text/x-markdown"], types: ["contentfulTextLongPlainTextNode", "contentfulTextLongMarkdownTextNode", "contentfulTextLongLocalizedTextNode"]) @derivedTypes @dontInfer { + frontmatter: MarkdownRemarkFrontmatter + excerpt: String + rawMarkdownBody: String +} + +type MarkdownRemarkFrontmatter { + title: String +} + type ContentfulContentType implements Node @derivedTypes @dontInfer { name: String displayField: String diff --git a/e2e-tests/contentful/snapshots.js b/e2e-tests/contentful/snapshots.js index eebeb902df067..2207ca7c22e03 100644 --- a/e2e-tests/contentful/snapshots.js +++ b/e2e-tests/contentful/snapshots.js @@ -28,7 +28,7 @@ module.exports = { }, "rich-text": { "rich-text: All Features": { - "1": "are members of the same family. Their separate existence is a myth. For:
\nscience
\nmusic
\nsport
\netc
\nEurope uses the same vocabulary.
\n \n \nThe languages only differ in:
\ntheir grammar
\ntheir pronunciation
\ntheir most common words
\n[Inline-ContentfulText]\n Text: Short\n :\n The quick brown fox jumps over the lazy dog.
\nEveryone realizes why a new common language would be desirable: one could\n refuse to pay expensive translators.
\n{\n \"userId\": 1,\n \"id\": 1,\n \"title\": \"delectus aut autem\",\n \"completed\": false\n }
To achieve this, it would be necessary to have uniform grammar,\n pronunciation and more common words.
\n[ContentfulLocation] Lat:\n 52.51627\n , Long:\n 13.3777
\n\n\nIf several languages coalesce, the grammar of the resulting language is\n more simple and regular than that of the individual languages.
\n
The new common language will be more simple and regular than the existing\n European languages. It will be as simple as Occidental; in fact, it will be\n
\nare members of the same family. Their separate existence is a myth. For:
\nscience
\nmusic
\nsport
\netc
\nEurope uses the same vocabulary.
\n \n \nThe languages only differ in:
\ntheir grammar
\ntheir pronunciation
\ntheir most common words
\n[Inline-ContentfulText]\n Text: Short\n :\n The quick brown fox jumps over the lazy dog.
\nEveryone realizes why a new common language would be desirable: one could\n refuse to pay expensive translators.
\n{\n \"userId\": 1,\n \"id\": 1,\n \"title\": \"delectus aut autem\",\n \"completed\": false\n }
To achieve this, it would be necessary to have uniform grammar,\n pronunciation and more common words.
\n[ContentfulLocation] Lat:\n 52.51627\n , Long:\n 13.3777
\n\n\nIf several languages coalesce, the grammar of the resulting language is\n more simple and regular than that of the individual languages.
\n
The new common language will be more simple and regular than the existing\n European languages. It will be as simple as Occidental; in fact, it will be\n
\nare members of the same family. Their separate existence is a myth. For:
\nscience
\nmusic
\nsport
\netc
\nEurope uses the same vocabulary.
\nThe languages only differ in:
\ntheir grammar
\ntheir pronunciation
\ntheir most common words
\nEveryone realizes why a new common language would be desirable: one could\n refuse to pay expensive translators.
\n{\n \"userId\": 1,\n \"id\": 1,\n \"title\": \"delectus aut autem\",\n \"completed\": false\n }
To achieve this, it would be necessary to have uniform grammar,\n pronunciation and more common words.
\n\n\nIf several languages coalesce, the grammar of the resulting language is\n more simple and regular than that of the individual languages.
\n
The new common language will be more simple and regular than the existing\n European languages. It will be as simple as Occidental; in fact, it will be\n
\n[ContentfulText]\n The quick brown fox jumps over the lazy dog.
\n \n \n[ContentfulReference]\n Content Reference: Many (2nd level loop)\n : [\n Number: Integer, Text: Short, Content Reference: One (Loop A ->\n B)\n ]
\n \n \n{JSON.stringify(serverData?.arg?.query)}+
{JSON.stringify(serverData?.arg?.params)}+
{JSON.stringify({ serverData }, null, 2)}+
{JSON.stringify(serverData?.arg?.query)}+
{JSON.stringify(serverData?.arg?.params)}+
{JSON.stringify({ serverData }, null, 2)}+
{JSON.stringify(serverData?.arg?.query)}+
{JSON.stringify(serverData?.arg?.params)}+
{JSON.stringify({ serverData }, null, 2)}+
Page could not be displayed
+500+ + Go to Index + +
{JSON.stringify(serverData?.arg?.query)}+
{JSON.stringify(serverData?.arg?.params)}+
{JSON.stringify({ serverData }, null, 2)}+
{JSON.stringify(serverData?.arg?.query)}+
{JSON.stringify(serverData?.arg?.params)}+
{JSON.stringify({ serverData }, null, 2)}+
{JSON.stringify(serverData?.arg?.query)}+
{JSON.stringify(serverData?.arg?.params)}+
{JSON.stringify({ serverData }, null, 2)}+
Wysiwyh Editor Field test content.
--
-" -`; - exports[`[gatsby-source-wordpress] Run tests on develop build data resolution resolves correct number of nodes 1`] = ` Array [ Object { diff --git a/integration-tests/gatsby-source-wordpress/gatsby-config.js b/integration-tests/gatsby-source-wordpress/gatsby-config.js index 7c1f214ab9caf..17166e55442f5 100644 --- a/integration-tests/gatsby-source-wordpress/gatsby-config.js +++ b/integration-tests/gatsby-source-wordpress/gatsby-config.js @@ -65,13 +65,6 @@ const wpPluginOptions = !process.env.DEFAULT_PLUGIN_OPTIONS 50 : // and we don't actually need more than 1000 in production 1000, - - beforeChangeNode: ({ remoteNode }) => { - console.log(`Hi from an inline fn!`) - remoteNode.beforeChangeNodeTest = `TEST-${remoteNode.id}` - - return remoteNode - }, }, // excluding this because it causes Gatsby to throw errors BlockEditorContentNode: { exclude: true }, diff --git a/integration-tests/gatsby-source-wordpress/package.json b/integration-tests/gatsby-source-wordpress/package.json index cafc0b6f5ebb6..ae4d9268f2430 100644 --- a/integration-tests/gatsby-source-wordpress/package.json +++ b/integration-tests/gatsby-source-wordpress/package.json @@ -17,6 +17,7 @@ "gatsby-source-filesystem": "next", "gatsby-source-wordpress": "next", "gatsby-transformer-sharp": "next", + "gatsby-plugin-image": "next", "react": "^17.0.2", "react-dom": "^17.0.2" }, 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 6696ca4e164ad..ee7736045c3d4 100644 --- a/integration-tests/gatsby-source-wordpress/test-fns/data-resolution.js +++ b/integration-tests/gatsby-source-wordpress/test-fns/data-resolution.js @@ -231,14 +231,6 @@ describe(`data resolution`, () => { beforeChangeNodeTest } } - # inline fn in gatsby-config.js - # support for this will be removed in future versions - allWpPost { - nodes { - id - beforeChangeNodeTest - } - } } `, }) @@ -246,9 +238,6 @@ describe(`data resolution`, () => { result.data.allWpPage.nodes.forEach(node => { expect(node.beforeChangeNodeTest).toBe(`TEST-${node.id}`) }) - result.data.allWpPost.nodes.forEach(node => { - expect(node.beforeChangeNodeTest).toBe(`TEST-${node.id}`) - }) }) it(`resolves root fields`, async () => { diff --git a/integration-tests/gatsby-source-wordpress/test-fns/gatsby-image.js b/integration-tests/gatsby-source-wordpress/test-fns/gatsby-image.js index dd6a7d577f3f5..d36d488204e2d 100644 --- a/integration-tests/gatsby-source-wordpress/test-fns/gatsby-image.js +++ b/integration-tests/gatsby-source-wordpress/test-fns/gatsby-image.js @@ -5,68 +5,25 @@ const { const execall = require("execall") const countGatsbyImgs = string => - // divide by 2 because we now have two classes gatsby-image-wrapper and inline-gatsby-image-wrapper - execall(/gatsby-image-wrapper/gim, string).length / 2 + execall(/[^-]gatsby-image-wrapper[^-]/gim, string).length describe(`Gatsby image processing`, () => { it(`transforms inline-html images properly`, async () => { const { - data: { - // wpPage, - // gute, - // editedInline, - // editedMediaLibrary, - acfPage, - // httpProtocolPage, - }, + data: { acfPage }, } = await fetchGraphql({ url: `http://localhost:8000/__graphql`, query: /* GraphQL */ ` { - # Inline gatsby-image Gutenberg test #8964 - # wpPage(id: { eq: "cG9zdDo4OTY0" }) { - # content - # } - # edited Inline gatsby-image test - # editedInline: wpPage(databaseId: { eq: 9208 }) { - # content - # } - # edited via media library Inline gatsby-image test - # editedMediaLibrary: wpPage(databaseId: { eq: 9219 }) { - # content - # } - # inline html ACF test acfPage: wpPage(databaseId: { eq: 7646 }) { acfPageFields { wysiwygEditorField } } - # Page with img src hardcoded to http isntead of https - # httpProtocolPage: wpPage(databaseId: { eq: 10513 }) { - # content - # } } `, }) - - // expect(wpPage.content).toBeTruthy() - // expect(countGatsbyImgs(wpPage.content)).toBe(2) - // expect(wpPage.content).toMatchSnapshot() - - // expect(editedInline.content).toBeTruthy() - // expect(countGatsbyImgs(editedInline.content)).toBe(1) - // expect(editedInline.content).toMatchSnapshot() - - // expect(editedMediaLibrary.content).toBeTruthy() - // expect(countGatsbyImgs(editedMediaLibrary.content)).toBe(1) - // expect(editedMediaLibrary.content).toMatchSnapshot() - expect(acfPage.acfPageFields.wysiwygEditorField).toBeTruthy() expect(countGatsbyImgs(acfPage.acfPageFields.wysiwygEditorField)).toBe(2) - expect(acfPage.acfPageFields.wysiwygEditorField).toMatchSnapshot() - - // expect(httpProtocolPage.content).toBeTruthy() - // expect(countGatsbyImgs(httpProtocolPage.content)).toBe(1) - // expect(httpProtocolPage.content).toMatchSnapshot() }) }) diff --git a/integration-tests/long-term-caching/__tests__/long-term-caching.js b/integration-tests/long-term-caching/__tests__/long-term-caching.js index d66098e4a2986..1325237caa23f 100644 --- a/integration-tests/long-term-caching/__tests__/long-term-caching.js +++ b/integration-tests/long-term-caching/__tests__/long-term-caching.js @@ -59,7 +59,8 @@ describe(`long term caching`, () => { const indexPath = `${rootPath}/src/pages/index.js` const data = await readFile(indexPath, `utf8`) - const import1 = `import gray from "gray-percentage"` + // unused imports are removed, so we need to use it somehow + const import1 = `import gray from "gray-percentage"\nconsole.log(gray)` const modifiedData = `${import1}\n${data}` await writeFile(`${pagesPath}/index.js`, modifiedData) diff --git a/package.json b/package.json index f8c69fd499652..80e10b9b97c92 100644 --- a/package.json +++ b/package.json @@ -26,8 +26,8 @@ "@types/signal-exit": "^3.0.0", "@types/stack-trace": "^0.0.29", "@types/webpack-merge": "^4.1.5", - "@typescript-eslint/eslint-plugin": "^4.29.3", - "@typescript-eslint/parser": "^4.29.3", + "@typescript-eslint/eslint-plugin": "^4.33.0", + "@typescript-eslint/parser": "^4.33.0", "babel-jest": "^24.9.0", "chalk": "^4.1.2", "chokidar": "^3.5.2", @@ -39,11 +39,11 @@ "eslint-config-google": "^0.14.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-filenames": "^1.3.2", - "eslint-plugin-flowtype": "^5.9.2", + "eslint-plugin-flowtype": "^6.1.0", "eslint-plugin-import": "^2.24.2", "eslint-plugin-jsx-a11y": "^6.4.1", - "eslint-plugin-prettier": "^3.4.1", - "eslint-plugin-react": "^7.25.1", + "eslint-plugin-prettier": "^4.0.0", + "eslint-plugin-react": "^7.26.1", "fs-extra": "^10.0.0", "glob": "^7.1.7", "husky": "3.1.0", @@ -63,7 +63,7 @@ "npm-packlist": "^2.1.5", "npm-run-all": "4.1.5", "plop": "^1.9.1", - "prettier": "2.3.2", + "prettier": "2.4.1", "remark": "^13.0.0", "remark-cli": "^9.0.0", "remark-frontmatter": "^3.0.0", @@ -87,7 +87,7 @@ "rimraf": "^3.0.2", "svgo": "1.3.2", "ts-jest": "^22", - "typescript": "^4.3.5", + "typescript": "^4.4.3", "unified": "^9.2.0", "yargs": "^15.4.1" }, @@ -130,7 +130,7 @@ "lerna": "lerna", "lerna-prepare": "lerna run prepare", "lint": "npm-run-all --continue-on-error -p lint:code lint:docs lint:other", - "lint:code": "eslint --ext .js,.jsx,.ts,.tsx .", + "lint:code": "eslint --ext .js,.jsx,.ts,.tsx --quiet .", "lint:docs": "remark docs/{contributing,docs,tutorial}", "lint:other": "npm run prettier -- --check", "lint:scripts": "sh scripts/lint-shell-scripts.sh", diff --git a/packages/babel-plugin-remove-graphql-queries/package.json b/packages/babel-plugin-remove-graphql-queries/package.json index 608965f295cba..8ff87b7703735 100644 --- a/packages/babel-plugin-remove-graphql-queries/package.json +++ b/packages/babel-plugin-remove-graphql-queries/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-remove-graphql-queries", - "version": "4.0.0-zz-next.1", + "version": "4.0.0-zz-next.3", "author": "Jason Quense
+ {error?.context?.sourceMessage} +
+
- {`There's not a page ${
- functionsEnabled ? `or function ` : ``
- }yet at `}
+ There's not a page or function yet at{` `}
{pathname}
- If you were trying to reach another page - {functionsEnabled ? ` or function` : ``}, perhaps you can find it - below. + If you were trying to reach another page or function, perhaps you + can find it below.
- {functionsEnabled && ( - <> -