File tree 4 files changed +13
-20
lines changed
4 files changed +13
-20
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,6 @@ export async function BundleSize() {
10
10
return prettyBytes ( size )
11
11
} catch ( error ) {
12
12
console . error ( error )
13
- return 'less than 4KB '
13
+ return 'less than 5KB '
14
14
}
15
15
}
Original file line number Diff line number Diff line change 1
1
import * as cheerio from 'cheerio'
2
+ import { unstable_cache } from 'next/cache'
2
3
3
4
enum PackageId {
4
5
nuqs = 'UGFja2FnZS00MjczNzAxNTA5' ,
@@ -12,7 +13,15 @@ export type Result = {
12
13
avatarID : string
13
14
}
14
15
15
- export async function crawlDependents ( ) {
16
+ export const crawlDependents = unstable_cache (
17
+ _crawlDependents ,
18
+ [ 'crawlDependents' ] ,
19
+ {
20
+ revalidate : 86_400
21
+ }
22
+ )
23
+
24
+ async function _crawlDependents ( ) {
16
25
const allResults : Result [ ] = [ ]
17
26
let url = `https://github.com/47ng/nuqs/network/dependents?package_id=${ PackageId . nuqs } `
18
27
while ( true ) {
Original file line number Diff line number Diff line change 1
1
import { cn } from '@/src/lib/utils'
2
2
import Image from 'next/image'
3
- import type { Result } from './crawler'
3
+ import { crawlDependents } from './crawler'
4
4
5
5
export async function DependentsSection ( ) {
6
- const dependents : Result [ ] = await fetch (
7
- 'https://nuqs.47ng.com/api/dependents' ,
8
- {
9
- next : {
10
- revalidate : 86_400
11
- }
12
- }
13
- ) . then ( res => res . json ( ) )
6
+ const dependents = await crawlDependents ( )
14
7
return (
15
8
< section className = "container" >
16
9
< h2 className = "mb-8 text-center text-3xl font-bold tracking-tighter dark:text-white md:text-4xl xl:text-5xl" >
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments