diff --git a/packages/gatsby-plugin-image/src/components/hooks.ts b/packages/gatsby-plugin-image/src/components/hooks.ts index 361aa70eaef68..810f939471d8e 100644 --- a/packages/gatsby-plugin-image/src/components/hooks.ts +++ b/packages/gatsby-plugin-image/src/components/hooks.ts @@ -97,7 +97,7 @@ export interface IUrlBuilderArgs { format: ImageFormat options: OptionsType } -export interface IUseGatsbyImageArgs { +export interface IGetImageDataArgs { baseUrl: string /** * For constrained and fixed images, the size of the image element @@ -145,7 +145,7 @@ export interface IUseGatsbyImageArgs { /** * Use this hook to generate gatsby-plugin-image data in the browser. */ -export function useGatsbyImage({ +export function getImageData({ baseUrl, urlBuilder, sourceWidth, @@ -155,7 +155,7 @@ export function useGatsbyImage({ breakpoints = EVERY_BREAKPOINT, options, ...props -}: IUseGatsbyImageArgs): IGatsbyImageData { +}: IGetImageDataArgs): IGatsbyImageData { const generateImageSource = ( baseUrl: string, width: number, @@ -393,7 +393,7 @@ export interface IArtDirectedImage { * @param artDirected Array of objects which each contains a `media` string which is a media query * such as `(min-width: 320px)`, and the image object to use when that query matches. */ -export function useArtDirection( +export function withArtDirection( defaultImage: IGatsbyImageData, artDirected: Array ): IGatsbyImageData { diff --git a/packages/gatsby-plugin-image/src/index.browser.ts b/packages/gatsby-plugin-image/src/index.browser.ts index 25b9b82b2a296..992793af4491c 100644 --- a/packages/gatsby-plugin-image/src/index.browser.ts +++ b/packages/gatsby-plugin-image/src/index.browser.ts @@ -10,10 +10,10 @@ export { LaterHydrator } from "./components/later-hydrator" export { getImage, getSrc, - useGatsbyImage, - useArtDirection, + getImageData, + withArtDirection, IArtDirectedImage, - IUseGatsbyImageArgs, + IGetImageDataArgs, IUrlBuilderArgs, } from "./components/hooks" export { diff --git a/packages/gatsby-plugin-image/src/index.ts b/packages/gatsby-plugin-image/src/index.ts index dda22dcd2f1ad..1723b79de5780 100644 --- a/packages/gatsby-plugin-image/src/index.ts +++ b/packages/gatsby-plugin-image/src/index.ts @@ -9,10 +9,10 @@ export { StaticImage } from "./components/static-image.server" export { getImage, getSrc, - useGatsbyImage, - useArtDirection, + getImageData, + withArtDirection, IArtDirectedImage, - IUseGatsbyImageArgs, + IGetImageDataArgs, IUrlBuilderArgs, } from "./components/hooks" export {