File tree 7 files changed +8
-66
lines changed 7 files changed +8
-66
lines changed Original file line number Diff line number Diff line change @@ -533,16 +533,12 @@ export default defineNuxtModule<ModuleOptions>({
533
533
nitro . options . runtimeConfig . public . content . wsUrl = url . replace ( 'http' , 'ws' )
534
534
535
535
// Watch contents
536
- await nitro . storage . watch ( async ( event : WatchEvent , key : string ) => {
536
+ await nitro . storage . watch ( ( event : WatchEvent , key : string ) => {
537
537
// Ignore events that are not related to content
538
538
if ( ! key . startsWith ( MOUNT_PREFIX ) ) {
539
539
return
540
540
}
541
541
key = key . substring ( MOUNT_PREFIX . length )
542
-
543
- // Remove content Index
544
- await nitro . storage . removeItem ( 'cache:content:content-index.json' )
545
-
546
542
// Broadcast a message to the server to refresh the page
547
543
ws . broadcast ( { event, key } )
548
544
} )
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ export const createQueryFetch = <T = ParsedContent>(path?: string) => (query: Qu
35
35
} )
36
36
}
37
37
38
- return $fetch ( apiPath as any , {
38
+ return $fetch < T | T [ ] > ( apiPath as any , {
39
39
method : 'GET' ,
40
40
responseType : 'json' ,
41
41
params : {
Original file line number Diff line number Diff line change 1
1
import { defineEventHandler } from 'h3'
2
- import { getContentIndex } from '../content-index'
3
- import { cacheStorage , serverQueryContent } from '../storage'
2
+ import { serverQueryContent } from '../storage'
4
3
5
4
// This route is used to cache all the parsed content
6
5
export default defineEventHandler ( async ( event ) => {
7
6
const now = Date . now ( )
8
7
// Fetch all content
9
8
await serverQueryContent ( event ) . find ( )
10
9
11
- // Generate Index
12
- await getContentIndex ( event )
13
-
14
- const navigation = await $fetch ( '/api/_content/navigation' )
15
- await cacheStorage . setItem ( 'content-navigation.json' , navigation )
16
-
17
10
return {
18
11
generatedAt : now ,
19
12
generateTime : Date . now ( ) - now
Original file line number Diff line number Diff line change 1
1
import { defineEventHandler } from 'h3'
2
- import { cacheStorage , serverQueryContent } from '../storage'
2
+ import { serverQueryContent } from '../storage'
3
3
import { createNav } from '../navigation'
4
4
import { ParsedContentMeta } from '../../types'
5
5
import { getContentQuery } from '../../utils/query'
6
- import { isPreview } from '../preview'
7
6
8
7
export default defineEventHandler ( async ( event ) => {
9
8
const query = getContentQuery ( event )
10
9
11
- // Read from cache if not preview and there is no query
12
- if ( ! isPreview ( event ) && Object . keys ( query ) . length === 0 ) {
13
- const cache = cacheStorage . getItem ( 'content-navigation.json' )
14
- if ( cache ) {
15
- return cache
16
- }
17
- }
18
-
19
10
const contents = await serverQueryContent ( event , query )
20
11
. where ( {
21
12
/**
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ import { createPipelineFetcher } from '../query/match/pipeline'
10
10
import { transformContent } from '../transformers'
11
11
import type { ModuleOptions } from '../../module'
12
12
import { getPreview , isPreview } from './preview'
13
- import { getIndexedContentsList } from './content-index'
14
13
// eslint-disable-next-line import/named
15
14
// @ts -ignore
16
15
import { useNitroApp , useRuntimeConfig , useStorage } from '#imports'
@@ -201,7 +200,9 @@ export const createServerQueryFetch = <T = ParsedContent>(event: CompatibilityEv
201
200
query . sort ( { _file : 1 , $numeric : true } )
202
201
}
203
202
204
- return createPipelineFetcher < T > ( ( ) => getIndexedContentsList < T > ( event , query ) ) ( query )
203
+ return createPipelineFetcher < T > (
204
+ ( ) => getContentsList ( event ) as unknown as Promise < T [ ] >
205
+ ) ( query )
205
206
}
206
207
207
208
/**
Original file line number Diff line number Diff line change @@ -471,7 +471,7 @@ export interface QueryBuilder<T = ParsedContentMeta> {
471
471
/**
472
472
* Fetch sorround contents
473
473
*/
474
- findSurround ( query : string | QueryBuilderWhere , options ?: Partial < { before : number ; after : number } > ) : Promise < Array < T > >
474
+ findSurround ( query : string | object , options ?: Partial < { before : number ; after : number } > ) : Promise < Array < T > >
475
475
476
476
/**
477
477
* Filter contents based on locale
You can’t perform that action at this time.
0 commit comments