@@ -8,11 +8,7 @@ import { sentenceCase } from "change-case"
88import fs from "fs-extra"
99import grayMatter from "gray-matter"
1010
11- import {
12- defaultOptions ,
13- enhanceMdxOptions ,
14- IMdxPluginOptions ,
15- } from "./plugin-options"
11+ import { defaultOptions , enhanceMdxOptions } from "./plugin-options"
1612import { IGatsbyLayoutLoaderOptions } from "./gatsby-layout-loader"
1713import { compileMDX , compileMDXWithCustomOptions } from "./compile-mdx"
1814import { IGatsbyMDXLoaderOptions } from "./gatsby-mdx-loader"
@@ -25,7 +21,7 @@ import { ERROR_MAP } from "./error-utils"
2521export const onCreateWebpackConfig : GatsbyNode [ "onCreateWebpackConfig" ] =
2622 async (
2723 { actions, loaders, getNode, getNodesByType, pathPrefix, reporter, cache } ,
28- pluginOptions : IMdxPluginOptions
24+ pluginOptions
2925 ) => {
3026 const mdxNodes = getNodesByType ( `Mdx` )
3127 const nodeMap : NodeMap = new Map ( )
@@ -105,17 +101,18 @@ export const onCreateWebpackConfig: GatsbyNode["onCreateWebpackConfig"] =
105101 */
106102export const resolvableExtensions : GatsbyNode [ "resolvableExtensions" ] = (
107103 _data ,
108- pluginOptions : IMdxPluginOptions
104+ pluginOptions
109105) => defaultOptions ( pluginOptions ) . extensions
110106
111107/**
112108 * Convert MDX to JSX so that Gatsby can extract the GraphQL queries and render the pages.
113109 */
114110export const preprocessSource : GatsbyNode [ "preprocessSource" ] = async (
115111 { filename, getNode, getNodesByType, pathPrefix, reporter, cache } ,
116- pluginOptions : IMdxPluginOptions
112+ pluginOptions
117113) => {
118- const { extensions } = defaultOptions ( pluginOptions )
114+ const options = defaultOptions ( pluginOptions )
115+ const { extensions } = options
119116 const splitPath = filename . split ( `__mdxPath=` )
120117 const mdxPath = splitPath . length === 2 ? splitPath [ 1 ] : splitPath [ 0 ]
121118
@@ -169,7 +166,7 @@ export const preprocessSource: GatsbyNode["preprocessSource"] = async (
169166export const createSchemaCustomization : GatsbyNode [ "createSchemaCustomization" ] =
170167 async (
171168 { getNode, getNodesByType, pathPrefix, reporter, cache, actions, schema } ,
172- pluginOptions : IMdxPluginOptions
169+ pluginOptions
173170 ) => {
174171 const { createTypes } = actions
175172 const typeDefs = [
@@ -271,7 +268,7 @@ export const createSchemaCustomization: GatsbyNode["createSchemaCustomization"]
271268
272269// eslint-disable-next-line @typescript-eslint/naming-convention
273270export const unstable_shouldOnCreateNode : GatsbyNode [ "unstable_shouldOnCreateNode" ] =
274- ( { node } : { node : FileSystemNode } , pluginOptions : IMdxPluginOptions ) => {
271+ ( { node } : { node : FileSystemNode } , pluginOptions ) => {
275272 const { extensions } = defaultOptions ( pluginOptions )
276273 return node . internal . type === `File` && extensions . includes ( node . ext )
277274 }
@@ -324,7 +321,7 @@ export const onCreateNode: GatsbyNode<FileSystemNode>["onCreateNode"] = async ({
324321 */
325322export const onCreatePage : GatsbyNode [ "onCreatePage" ] = async (
326323 { page, actions } ,
327- pluginOptions : IMdxPluginOptions
324+ pluginOptions
328325) => {
329326 const { createPage, deletePage } = actions
330327 const { extensions } = defaultOptions ( pluginOptions )
0 commit comments