file-entry-cache 11.0.0-beta.2 → 11.0.0-beta.3
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/index.cjs +1 -20
- package/dist/index.d.cts +1 -14
- package/dist/index.d.ts +1 -14
- package/dist/index.js +1 -20
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -70,7 +70,6 @@ var FileEntryDefault = class {
|
|
|
70
70
|
var FileEntryCache = class {
|
|
71
71
|
_cache = new import_flat_cache.FlatCache({ useClone: false });
|
|
72
72
|
_useCheckSum = false;
|
|
73
|
-
_useModifiedTime = true;
|
|
74
73
|
_hashAlgorithm = "md5";
|
|
75
74
|
_cwd = process.cwd();
|
|
76
75
|
_strictPaths = true;
|
|
@@ -82,9 +81,6 @@ var FileEntryCache = class {
|
|
|
82
81
|
if (options?.cache) {
|
|
83
82
|
this._cache = new import_flat_cache.FlatCache(options.cache);
|
|
84
83
|
}
|
|
85
|
-
if (options?.useModifiedTime) {
|
|
86
|
-
this._useModifiedTime = options.useModifiedTime;
|
|
87
|
-
}
|
|
88
84
|
if (options?.useCheckSum) {
|
|
89
85
|
this._useCheckSum = options.useCheckSum;
|
|
90
86
|
}
|
|
@@ -126,20 +122,6 @@ var FileEntryCache = class {
|
|
|
126
122
|
set useCheckSum(value) {
|
|
127
123
|
this._useCheckSum = value;
|
|
128
124
|
}
|
|
129
|
-
/**
|
|
130
|
-
* Use the modified time to check if the file has changed
|
|
131
|
-
* @returns {boolean} if the modified time is used to check if the file has changed (default: true)
|
|
132
|
-
*/
|
|
133
|
-
get useModifiedTime() {
|
|
134
|
-
return this._useModifiedTime;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Set the useModifiedTime value
|
|
138
|
-
* @param {boolean} value - The value to set
|
|
139
|
-
*/
|
|
140
|
-
set useModifiedTime(value) {
|
|
141
|
-
this._useModifiedTime = value;
|
|
142
|
-
}
|
|
143
125
|
/**
|
|
144
126
|
* Get the hash algorithm
|
|
145
127
|
* @returns {string} The hash algorithm (default: 'md5')
|
|
@@ -278,7 +260,6 @@ var FileEntryCache = class {
|
|
|
278
260
|
result.meta = this._cache.getKey(result.key) ?? {};
|
|
279
261
|
const absolutePath = this.getAbsolutePath(filePath);
|
|
280
262
|
const useCheckSumValue = options?.useCheckSum ?? this._useCheckSum;
|
|
281
|
-
const useModifiedTimeValue = options?.useModifiedTime ?? this._useModifiedTime;
|
|
282
263
|
try {
|
|
283
264
|
fstat = import_node_fs.default.statSync(absolutePath);
|
|
284
265
|
result.meta = {
|
|
@@ -311,7 +292,7 @@ var FileEntryCache = class {
|
|
|
311
292
|
if (result.meta.data === void 0) {
|
|
312
293
|
result.meta.data = metaCache.data;
|
|
313
294
|
}
|
|
314
|
-
if (
|
|
295
|
+
if (useCheckSumValue === false && metaCache?.mtime !== result.meta?.mtime) {
|
|
315
296
|
result.changed = true;
|
|
316
297
|
}
|
|
317
298
|
if (metaCache?.size !== result.meta?.size) {
|
package/dist/index.d.cts
CHANGED
|
@@ -16,10 +16,8 @@ type FileEntryCacheOptions = {
|
|
|
16
16
|
cache?: FlatCacheOptions;
|
|
17
17
|
};
|
|
18
18
|
type GetFileDescriptorOptions = {
|
|
19
|
-
/** Whether to use checksum for this specific file check (overrides instance setting) */
|
|
19
|
+
/** Whether to use checksum for this specific file check instead of modified time (mtime) (overrides instance setting) */
|
|
20
20
|
useCheckSum?: boolean;
|
|
21
|
-
/** Whether to use modified time for this specific file check (overrides instance setting) */
|
|
22
|
-
useModifiedTime?: boolean;
|
|
23
21
|
};
|
|
24
22
|
type FileDescriptor = {
|
|
25
23
|
/** The cache key for this file (typically the file path) */
|
|
@@ -75,7 +73,6 @@ declare class FileEntryDefault {
|
|
|
75
73
|
declare class FileEntryCache {
|
|
76
74
|
private _cache;
|
|
77
75
|
private _useCheckSum;
|
|
78
|
-
private _useModifiedTime;
|
|
79
76
|
private _hashAlgorithm;
|
|
80
77
|
private _cwd;
|
|
81
78
|
private _strictPaths;
|
|
@@ -104,16 +101,6 @@ declare class FileEntryCache {
|
|
|
104
101
|
* @param {boolean} value - The value to set
|
|
105
102
|
*/
|
|
106
103
|
set useCheckSum(value: boolean);
|
|
107
|
-
/**
|
|
108
|
-
* Use the modified time to check if the file has changed
|
|
109
|
-
* @returns {boolean} if the modified time is used to check if the file has changed (default: true)
|
|
110
|
-
*/
|
|
111
|
-
get useModifiedTime(): boolean;
|
|
112
|
-
/**
|
|
113
|
-
* Set the useModifiedTime value
|
|
114
|
-
* @param {boolean} value - The value to set
|
|
115
|
-
*/
|
|
116
|
-
set useModifiedTime(value: boolean);
|
|
117
104
|
/**
|
|
118
105
|
* Get the hash algorithm
|
|
119
106
|
* @returns {string} The hash algorithm (default: 'md5')
|
package/dist/index.d.ts
CHANGED
|
@@ -16,10 +16,8 @@ type FileEntryCacheOptions = {
|
|
|
16
16
|
cache?: FlatCacheOptions;
|
|
17
17
|
};
|
|
18
18
|
type GetFileDescriptorOptions = {
|
|
19
|
-
/** Whether to use checksum for this specific file check (overrides instance setting) */
|
|
19
|
+
/** Whether to use checksum for this specific file check instead of modified time (mtime) (overrides instance setting) */
|
|
20
20
|
useCheckSum?: boolean;
|
|
21
|
-
/** Whether to use modified time for this specific file check (overrides instance setting) */
|
|
22
|
-
useModifiedTime?: boolean;
|
|
23
21
|
};
|
|
24
22
|
type FileDescriptor = {
|
|
25
23
|
/** The cache key for this file (typically the file path) */
|
|
@@ -75,7 +73,6 @@ declare class FileEntryDefault {
|
|
|
75
73
|
declare class FileEntryCache {
|
|
76
74
|
private _cache;
|
|
77
75
|
private _useCheckSum;
|
|
78
|
-
private _useModifiedTime;
|
|
79
76
|
private _hashAlgorithm;
|
|
80
77
|
private _cwd;
|
|
81
78
|
private _strictPaths;
|
|
@@ -104,16 +101,6 @@ declare class FileEntryCache {
|
|
|
104
101
|
* @param {boolean} value - The value to set
|
|
105
102
|
*/
|
|
106
103
|
set useCheckSum(value: boolean);
|
|
107
|
-
/**
|
|
108
|
-
* Use the modified time to check if the file has changed
|
|
109
|
-
* @returns {boolean} if the modified time is used to check if the file has changed (default: true)
|
|
110
|
-
*/
|
|
111
|
-
get useModifiedTime(): boolean;
|
|
112
|
-
/**
|
|
113
|
-
* Set the useModifiedTime value
|
|
114
|
-
* @param {boolean} value - The value to set
|
|
115
|
-
*/
|
|
116
|
-
set useModifiedTime(value: boolean);
|
|
117
104
|
/**
|
|
118
105
|
* Get the hash algorithm
|
|
119
106
|
* @returns {string} The hash algorithm (default: 'md5')
|
package/dist/index.js
CHANGED
|
@@ -36,7 +36,6 @@ var FileEntryDefault = class {
|
|
|
36
36
|
var FileEntryCache = class {
|
|
37
37
|
_cache = new FlatCache({ useClone: false });
|
|
38
38
|
_useCheckSum = false;
|
|
39
|
-
_useModifiedTime = true;
|
|
40
39
|
_hashAlgorithm = "md5";
|
|
41
40
|
_cwd = process.cwd();
|
|
42
41
|
_strictPaths = true;
|
|
@@ -48,9 +47,6 @@ var FileEntryCache = class {
|
|
|
48
47
|
if (options?.cache) {
|
|
49
48
|
this._cache = new FlatCache(options.cache);
|
|
50
49
|
}
|
|
51
|
-
if (options?.useModifiedTime) {
|
|
52
|
-
this._useModifiedTime = options.useModifiedTime;
|
|
53
|
-
}
|
|
54
50
|
if (options?.useCheckSum) {
|
|
55
51
|
this._useCheckSum = options.useCheckSum;
|
|
56
52
|
}
|
|
@@ -92,20 +88,6 @@ var FileEntryCache = class {
|
|
|
92
88
|
set useCheckSum(value) {
|
|
93
89
|
this._useCheckSum = value;
|
|
94
90
|
}
|
|
95
|
-
/**
|
|
96
|
-
* Use the modified time to check if the file has changed
|
|
97
|
-
* @returns {boolean} if the modified time is used to check if the file has changed (default: true)
|
|
98
|
-
*/
|
|
99
|
-
get useModifiedTime() {
|
|
100
|
-
return this._useModifiedTime;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Set the useModifiedTime value
|
|
104
|
-
* @param {boolean} value - The value to set
|
|
105
|
-
*/
|
|
106
|
-
set useModifiedTime(value) {
|
|
107
|
-
this._useModifiedTime = value;
|
|
108
|
-
}
|
|
109
91
|
/**
|
|
110
92
|
* Get the hash algorithm
|
|
111
93
|
* @returns {string} The hash algorithm (default: 'md5')
|
|
@@ -244,7 +226,6 @@ var FileEntryCache = class {
|
|
|
244
226
|
result.meta = this._cache.getKey(result.key) ?? {};
|
|
245
227
|
const absolutePath = this.getAbsolutePath(filePath);
|
|
246
228
|
const useCheckSumValue = options?.useCheckSum ?? this._useCheckSum;
|
|
247
|
-
const useModifiedTimeValue = options?.useModifiedTime ?? this._useModifiedTime;
|
|
248
229
|
try {
|
|
249
230
|
fstat = fs.statSync(absolutePath);
|
|
250
231
|
result.meta = {
|
|
@@ -277,7 +258,7 @@ var FileEntryCache = class {
|
|
|
277
258
|
if (result.meta.data === void 0) {
|
|
278
259
|
result.meta.data = metaCache.data;
|
|
279
260
|
}
|
|
280
|
-
if (
|
|
261
|
+
if (useCheckSumValue === false && metaCache?.mtime !== result.meta?.mtime) {
|
|
281
262
|
result.changed = true;
|
|
282
263
|
}
|
|
283
264
|
if (metaCache?.size !== result.meta?.size) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "file-entry-cache",
|
|
3
|
-
"version": "11.0.0-beta.
|
|
3
|
+
"version": "11.0.0-beta.3",
|
|
4
4
|
"description": "A lightweight cache for file metadata, ideal for processes that work on a specific set of files and only need to reprocess files that have changed since the last run",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"cache"
|
|
30
30
|
],
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@biomejs/biome": "^2.2.
|
|
33
|
-
"@types/node": "^24.
|
|
32
|
+
"@biomejs/biome": "^2.2.5",
|
|
33
|
+
"@types/node": "^24.6.2",
|
|
34
34
|
"@vitest/coverage-v8": "^3.2.4",
|
|
35
35
|
"rimraf": "^6.0.1",
|
|
36
36
|
"tsup": "^8.5.0",
|
|
37
|
-
"typescript": "^5.9.
|
|
37
|
+
"typescript": "^5.9.3",
|
|
38
38
|
"vitest": "^3.2.4"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|