fumadocs-core 12.0.5 → 12.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/index.d.ts +5 -2
- package/dist/server/index.js +10 -4
- package/dist/source/index.js +1 -0
- package/package.json +1 -1
package/dist/server/index.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ interface GetGithubLastCommitOptions {
|
|
|
31
31
|
*/
|
|
32
32
|
path: string;
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* GitHub access token
|
|
35
35
|
*/
|
|
36
36
|
token?: string;
|
|
37
37
|
/**
|
|
@@ -41,7 +41,10 @@ interface GetGithubLastCommitOptions {
|
|
|
41
41
|
options?: RequestInit;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
|
-
* Get the last edit time of a file
|
|
44
|
+
* Get the last edit time of a file using GitHub API
|
|
45
|
+
*
|
|
46
|
+
* By default, this will cache the result forever.
|
|
47
|
+
* Set `options.next.revalidate` to customise this.
|
|
45
48
|
*/
|
|
46
49
|
declare function getGithubLastEdit({ repo, token, owner, path, options, params: customParams, }: GetGithubLastCommitOptions): Promise<Date | null>;
|
|
47
50
|
|
package/dist/server/index.js
CHANGED
|
@@ -2,7 +2,9 @@ import {
|
|
|
2
2
|
remarkHeading
|
|
3
3
|
} from "../chunk-QRNTLL6S.js";
|
|
4
4
|
import {
|
|
5
|
-
__async
|
|
5
|
+
__async,
|
|
6
|
+
__spreadProps,
|
|
7
|
+
__spreadValues
|
|
6
8
|
} from "../chunk-CWMXXUWU.js";
|
|
7
9
|
|
|
8
10
|
// src/server/get-toc.ts
|
|
@@ -64,6 +66,7 @@ function getGithubLastEdit(_0) {
|
|
|
64
66
|
options = {},
|
|
65
67
|
params: customParams = {}
|
|
66
68
|
}) {
|
|
69
|
+
const headers = new Headers(options.headers);
|
|
67
70
|
const params = new URLSearchParams();
|
|
68
71
|
params.set("path", path);
|
|
69
72
|
params.set("page", "1");
|
|
@@ -72,12 +75,15 @@ function getGithubLastEdit(_0) {
|
|
|
72
75
|
params.set(key, value);
|
|
73
76
|
}
|
|
74
77
|
if (token) {
|
|
75
|
-
|
|
76
|
-
options.headers.append("authorization", token);
|
|
78
|
+
headers.append("authorization", token);
|
|
77
79
|
}
|
|
78
80
|
const res = yield fetch(
|
|
79
81
|
`https://api.github.com/repos/${owner}/${repo}/commits?${params.toString()}`,
|
|
80
|
-
|
|
82
|
+
__spreadProps(__spreadValues({
|
|
83
|
+
cache: "force-cache"
|
|
84
|
+
}, options), {
|
|
85
|
+
headers
|
|
86
|
+
})
|
|
81
87
|
);
|
|
82
88
|
if (!res.ok)
|
|
83
89
|
throw new Error(
|
package/dist/source/index.js
CHANGED