Skip to content

Commit

Permalink
chore(gatsby-transformer-sharp): Replace alpha warning for gatsbyImag…
Browse files Browse the repository at this point in the history
…eData (#28123)
  • Loading branch information
ascorbic authored Nov 17, 2020
1 parent ab96f1e commit e21a71d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/gatsby-plugin-image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ Because this no longer uses fragments to specify which fields to return, it inst
- `BLURRED`: (default) a blurred, low resolution image, encoded as a base64 data URI
- `TRACED_SVG`: a low-resolution traced SVG of the image.
- `NONE`: no placeholder. Set "background" to use a fixed background color.
- `DOMINANT_COLOR`: a solid color, calculated from the dominant color of the image. _Currently disabled until sharp is updated_
- `DOMINANT_COLOR`: a solid color, calculated from the dominant color of the image.
- `layout`: The layout for the image.
- `FIXED:` A static image sized, that does not resize according to the screen width
- `FLUID`: The image resizes to fit its container. Pass a "sizes" option if it isn't going to be the full width of the screen.
Expand Down
9 changes: 4 additions & 5 deletions packages/gatsby-transformer-sharp/src/customize-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ const fluidNodeType = ({
}
}

let warnedForAlpha = false
let warnedForBeta = false

const imageNodeType = ({
pathPrefix,
Expand Down Expand Up @@ -511,13 +511,12 @@ const imageNodeType = ({
reporter.warn(`Please upgrade gatsby-plugin-sharp`)
return null
}
if (!warnedForAlpha) {
if (!warnedForBeta) {
reporter.warn(
stripIndent`
You are using the alpha version of the \`gatsbyImageData\` sharp API, which is unstable and will change without notice.
Please do not use it in production.`
Thank you for trying the beta version of the \`gatsbyImageData\` API. Please provide feedback and report any issues at: https://github.com/gatsbyjs/gatsby/discussions/27950`
)
warnedForAlpha = true
warnedForBeta = true
}
const imageData = await generateImageData({
file,
Expand Down

0 comments on commit e21a71d

Please sign in to comment.