@@ -90,6 +90,7 @@ const PathsSchema = z.object({
9090 publicDirectory : z . coerce . string < string > ( ) . describe ( "The path of the public directory" ) . default ( "public" ) ,
9191 layoutsDirectory : z . coerce . string < string > ( ) . describe ( "The path of the layout directory" ) . default ( "src/components/layouts" ) ,
9292 mdComponentsDirectory : z . coerce . string < string > ( ) . describe ( "The path of the markdown components directory" ) . default ( "src/components/markdowns" ) ,
93+ middlewaresDirectory : z . coerce . string < string > ( ) . describe ( "The path of the middlewares directory" ) . default ( "src/middlewares" ) ,
9394 configDirectory : z . coerce . string < string > ( ) . describe ( "The path of the config directory" ) . default ( "config" ) ,
9495 imagesDirectory : z . coerce . string < string > ( ) . describe ( "The path of the image directory" ) . default ( "images" ) ,
9596 // https://vite.dev/config/build-options#build-outdir
@@ -263,7 +264,6 @@ let configStyleSchema = z.object({
263264export type styleConfigType = z . output < typeof configStyleSchema > ;
264265
265266
266-
267267/**
268268 * Components
269269 * Base schema shared by all components
@@ -318,28 +318,10 @@ const MiddlewareConfigSchema = z.object({
318318 importPath : z . coerce . string < string > ( ) ,
319319 props : z . record ( z . string ( ) , z . unknown ( ) ) . optional ( ) ,
320320} ) . describe ( "Provider Properties" ) ;
321- const PagesConfigSchema = z . object ( {
322- providers : z . array ( MiddlewareConfigSchema ) . optional ( ) ,
323- } ) ;
324-
325- export type MiddlewareConfig = z . output < typeof MiddlewareConfigSchema > ;
326- export type PagesConfig = z . output < typeof PagesConfigSchema > ;
327321
328- export type ComponentsSet = z . output < typeof ComponentsConfigSetSchema > ;
322+ const MiddlewaresSchema = z . array ( MiddlewareConfigSchema ) . default ( [ ] ) ;
329323
330324
331- /**
332- * Plugins
333- */
334- const PluginConfigSchema = z . object ( {
335- path : z . coerce . string < string > ( ) . optional ( ) ,
336- props : z . record ( z . coerce . string < string > ( ) , z . any ( ) ) . optional ( ) ,
337- type : z . enum ( [ 'remark' , 'rehype' ] ) . optional ( ) ,
338- } ) ;
339-
340- const PluginConfigSetSchema = z . record ( z . coerce . string < string > ( ) , PluginConfigSchema . nullable ( ) ) ;
341- export type pluginsConfigType = z . output < typeof PluginConfigSetSchema > ;
342-
343325const OutlineSchema = z . object ( {
344326 numbering : outlineNumberingSchema . default ( outlineNumberingSchema . parse ( { } ) ) ,
345327} )
@@ -353,15 +335,15 @@ let MarkdownConfigSchema = z.object({
353335} ) ;
354336
355337/**
356- * The JSON Schema used to parse the Json file
338+ * The JSON Schema used to parse the JSON file
357339 */
358340export const JsonConfigSchema = z . object ( {
359341 $schema : z . coerce . string ( ) . optional ( ) ,
360342 site : SiteSchema . default ( SiteSchema . parse ( { } ) ) ,
361343 outline : OutlineSchema . default ( OutlineSchema . parse ( { } ) ) ,
362344 paths : PathsSchema . default ( PathsSchema . parse ( { } ) ) ,
363345 aliases : AliasesSchema . default ( AliasesSchema . parse ( { } ) ) ,
364- pages : PagesConfigSchema . default ( PagesConfigSchema . parse ( { } ) ) ,
346+ middlewares : MiddlewaresSchema . default ( [ ] ) ,
365347 images : ImageSchema . default ( ImageSchema . parse ( { } ) ) ,
366348 style : configStyleSchema . default ( configStyleSchema . parse ( { } ) ) ,
367349 components : ComponentsConfigSetSchema . default ( ComponentsConfigSetSchema . parse ( { } ) ) ,
@@ -375,4 +357,5 @@ export type aliasesConfigType = z.output<typeof AliasesSchema>;
375357export type siteConfigType = z . output < typeof SiteSchema > ;
376358export type outlineConfigType = z . output < typeof OutlineSchema > ;
377359export type markdownConfigType = z . output < typeof MarkdownConfigSchema > ;
378-
360+ export type MiddlewareConfig = z . output < typeof MiddlewaresSchema > ;
361+ export type ComponentsSet = z . output < typeof ComponentsConfigSetSchema > ;
0 commit comments