@synstack/fs-cache 1.4.19 → 1.4.20
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/README.md +2 -2
- package/package.json +3 -3
- package/src/fs-cache.lib.ts +4 -4
package/README.md
CHANGED
@@ -45,9 +45,9 @@ pnpm add @synstack/fs-cache
|
|
45
45
|
Cache directory can be initialized using an `FsDir` instance:
|
46
46
|
|
47
47
|
```typescript
|
48
|
-
import {
|
48
|
+
import { fsDir } from "@synstack/fs";
|
49
49
|
|
50
|
-
const cacheDir =
|
50
|
+
const cacheDir = fsDir(".cache");
|
51
51
|
const cache = fsCache(cacheDir);
|
52
52
|
```
|
53
53
|
|
package/package.json
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
"publishConfig": {
|
5
5
|
"access": "public"
|
6
6
|
},
|
7
|
-
"version": "1.4.
|
7
|
+
"version": "1.4.20",
|
8
8
|
"description": "Human-friendly file system caching",
|
9
9
|
"keywords": [
|
10
10
|
"cache",
|
@@ -43,7 +43,7 @@
|
|
43
43
|
}
|
44
44
|
},
|
45
45
|
"dependencies": {
|
46
|
-
"@synstack/fs": "^1.7.
|
46
|
+
"@synstack/fs": "^1.7.3"
|
47
47
|
},
|
48
48
|
"devDependencies": {
|
49
49
|
"@types/node": "^22.15.32",
|
@@ -55,5 +55,5 @@
|
|
55
55
|
"!src/**/*.test.ts",
|
56
56
|
"dist/**/*"
|
57
57
|
],
|
58
|
-
"gitHead": "
|
58
|
+
"gitHead": "4f88a6531d6929376f4b134340a8975759643449"
|
59
59
|
}
|
package/src/fs-cache.lib.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { fsDir, FsDir } from "@synstack/fs";
|
2
2
|
import { type OneToN } from "../../shared/src/ts.utils.ts";
|
3
3
|
import { deepEqual } from "./deepEqual.lib.ts";
|
4
4
|
|
@@ -82,7 +82,7 @@ export class FsCache<
|
|
82
82
|
args: TFnArgs,
|
83
83
|
) {
|
84
84
|
const relativePath = FsCache.keyToRelativePath(this._config.key, args);
|
85
|
-
const cacheDir =
|
85
|
+
const cacheDir = fsDir(this._config.cwd);
|
86
86
|
const file = cacheDir.file(relativePath);
|
87
87
|
|
88
88
|
if (!(await file.exists())) {
|
@@ -105,7 +105,7 @@ export class FsCache<
|
|
105
105
|
args: TFnArgs,
|
106
106
|
): Promise<["miss", null] | ["hit", TValue]> {
|
107
107
|
const relativePath = FsCache.keyToRelativePath(this._config.key, args);
|
108
|
-
const cacheDir =
|
108
|
+
const cacheDir = fsDir(this._config.cwd);
|
109
109
|
|
110
110
|
if (!(await cacheDir.file(relativePath).exists())) return ["miss", null];
|
111
111
|
|
@@ -140,7 +140,7 @@ export class FsCache<
|
|
140
140
|
value: any,
|
141
141
|
) {
|
142
142
|
const relativePath = FsCache.keyToRelativePath(this._config.key, args);
|
143
|
-
const file =
|
143
|
+
const file = fsDir(this._config.cwd).file(relativePath);
|
144
144
|
return file.write.text(
|
145
145
|
JSON.stringify(
|
146
146
|
{
|