@kisaragi-hiu/cached-fetch 0.1.1 → 0.1.2
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/index.d.ts +19 -0
- package/package.json +2 -2
package/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A cache designed to cache some text.
|
|
3
|
+
*/
|
|
4
|
+
export declare function cached(
|
|
5
|
+
/**
|
|
6
|
+
* The key of the value.
|
|
7
|
+
* Subsequent calls with the same key will return the cached value.
|
|
8
|
+
*/
|
|
9
|
+
key: string,
|
|
10
|
+
/**
|
|
11
|
+
* A fetcher function, called when the value isn't cached.
|
|
12
|
+
*
|
|
13
|
+
* Should return a Promise<{ text: () => string | Promise<string> }>. This is
|
|
14
|
+
* usually a Response, but ProcessOutput from the zx library also fits
|
|
15
|
+
* this signature.
|
|
16
|
+
*/
|
|
17
|
+
fetcher: () => Promise<{
|
|
18
|
+
text: () => string | Promise<string>;
|
|
19
|
+
}>): Promise<string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kisaragi-hiu/cached-fetch",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "A cache in OS tmpdir useful for fetch()",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"homepage": "https://github.com/kisaragi-hiu/cached-fetch",
|
|
15
15
|
"author": "Kisaragi Hiu <mail@kisaragi-hiu.com>",
|
|
16
16
|
"license": "MIT",
|
|
17
|
-
"files": ["index.js"],
|
|
17
|
+
"files": ["index.js", "index.d.ts"],
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@typescript/native-preview": "^7.0.0-dev.20250822.1"
|
|
20
20
|
},
|