Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
GraphQLEnumType,
} from 'gatsby/graphql'
import {GatsbyContext, GatsbyOnNodeTypeContext} from '../types/gatsby'
import {PluginConfig} from '../gatsby-node'
import {
getFixedGatsbyImage,
getFluidGatsbyImage,
ImageNode,
FixedArgs,
FluidArgs,
DEFAULT_FLUID_MAX_WIDTH,
DEFAULT_FIXED_WIDTH,
} from './getGatsbyImageProps'
import {getCacheKey, CACHE_KEYS} from '../util/cache'
const ImageFormatType = new GraphQLEnumType({
name: 'SanityImageFormat',
values: {
NO_CHANGE: {value: ''},
JPG: {value: 'jpg'},
PNG: {value: 'png'},
WEBP: {value: 'webp'},
},
})
const extensions = new Map()
export function extendImageNode(
context: GatsbyContext & GatsbyOnNodeTypeContext,
config: PluginConfig,
): {[key: string]: GraphQLFieldConfig} {
const key = getCacheKey(config, CACHE_KEYS.IMAGE_EXTENSIONS)
fields: {
value: {
type: GraphQLString,
resolve(heading) {
return heading.value;
}
},
depth: {
type: GraphQLInt,
resolve(heading) {
return heading.depth;
}
}
}
});
const Headings = new GraphQLEnumType({
name: `HeadingsMdx`,
values: {
h1: { value: 1 },
h2: { value: 2 },
h3: { value: 3 },
h4: { value: 4 },
h5: { value: 5 },
h6: { value: 6 }
}
});
return resolve({
code: {
resolve(mdxNode) {
return mdxNode;
},