file-entry-cache
Advanced tools
+1
-20
@@ -73,3 +73,2 @@ "use strict"; | ||
| _useCheckSum = false; | ||
| _useModifiedTime = true; | ||
| _hashAlgorithm = "md5"; | ||
@@ -86,5 +85,2 @@ _cwd = process.cwd(); | ||
| } | ||
| if (options?.useModifiedTime) { | ||
| this._useModifiedTime = options.useModifiedTime; | ||
| } | ||
| if (options?.useCheckSum) { | ||
@@ -132,16 +128,2 @@ this._useCheckSum = options.useCheckSum; | ||
| /** | ||
| * Use the modified time to check if the file has changed | ||
| * @returns {boolean} if the modified time is used to check if the file has changed (default: true) | ||
| */ | ||
| get useModifiedTime() { | ||
| return this._useModifiedTime; | ||
| } | ||
| /** | ||
| * Set the useModifiedTime value | ||
| * @param {boolean} value - The value to set | ||
| */ | ||
| set useModifiedTime(value) { | ||
| this._useModifiedTime = value; | ||
| } | ||
| /** | ||
| * Get the hash algorithm | ||
@@ -284,3 +266,2 @@ * @returns {string} The hash algorithm (default: 'md5') | ||
| const useCheckSumValue = options?.useCheckSum ?? this._useCheckSum; | ||
| const useModifiedTimeValue = options?.useModifiedTime ?? this._useModifiedTime; | ||
| try { | ||
@@ -318,3 +299,3 @@ fstat = import_node_fs.default.statSync(absolutePath); | ||
| } | ||
| if (useModifiedTimeValue && metaCache?.mtime !== result.meta?.mtime) { | ||
| if (useCheckSumValue === false && metaCache?.mtime !== result.meta?.mtime) { | ||
| result.changed = true; | ||
@@ -321,0 +302,0 @@ } |
+1
-14
@@ -19,6 +19,4 @@ import { Buffer } from 'node:buffer'; | ||
| type GetFileDescriptorOptions = { | ||
| /** Whether to use checksum for this specific file check (overrides instance setting) */ | ||
| /** Whether to use checksum for this specific file check instead of modified time (mtime) (overrides instance setting) */ | ||
| useCheckSum?: boolean; | ||
| /** Whether to use modified time for this specific file check (overrides instance setting) */ | ||
| useModifiedTime?: boolean; | ||
| }; | ||
@@ -79,3 +77,2 @@ type FileDescriptor = { | ||
| private _useCheckSum; | ||
| private _useModifiedTime; | ||
| private _hashAlgorithm; | ||
@@ -110,12 +107,2 @@ private _cwd; | ||
| /** | ||
| * Use the modified time to check if the file has changed | ||
| * @returns {boolean} if the modified time is used to check if the file has changed (default: true) | ||
| */ | ||
| get useModifiedTime(): boolean; | ||
| /** | ||
| * Set the useModifiedTime value | ||
| * @param {boolean} value - The value to set | ||
| */ | ||
| set useModifiedTime(value: boolean); | ||
| /** | ||
| * Get the hash algorithm | ||
@@ -122,0 +109,0 @@ * @returns {string} The hash algorithm (default: 'md5') |
+1
-14
@@ -19,6 +19,4 @@ import { Buffer } from 'node:buffer'; | ||
| type GetFileDescriptorOptions = { | ||
| /** Whether to use checksum for this specific file check (overrides instance setting) */ | ||
| /** Whether to use checksum for this specific file check instead of modified time (mtime) (overrides instance setting) */ | ||
| useCheckSum?: boolean; | ||
| /** Whether to use modified time for this specific file check (overrides instance setting) */ | ||
| useModifiedTime?: boolean; | ||
| }; | ||
@@ -79,3 +77,2 @@ type FileDescriptor = { | ||
| private _useCheckSum; | ||
| private _useModifiedTime; | ||
| private _hashAlgorithm; | ||
@@ -110,12 +107,2 @@ private _cwd; | ||
| /** | ||
| * Use the modified time to check if the file has changed | ||
| * @returns {boolean} if the modified time is used to check if the file has changed (default: true) | ||
| */ | ||
| get useModifiedTime(): boolean; | ||
| /** | ||
| * Set the useModifiedTime value | ||
| * @param {boolean} value - The value to set | ||
| */ | ||
| set useModifiedTime(value: boolean); | ||
| /** | ||
| * Get the hash algorithm | ||
@@ -122,0 +109,0 @@ * @returns {string} The hash algorithm (default: 'md5') |
+1
-20
@@ -39,3 +39,2 @@ // src/index.ts | ||
| _useCheckSum = false; | ||
| _useModifiedTime = true; | ||
| _hashAlgorithm = "md5"; | ||
@@ -52,5 +51,2 @@ _cwd = process.cwd(); | ||
| } | ||
| if (options?.useModifiedTime) { | ||
| this._useModifiedTime = options.useModifiedTime; | ||
| } | ||
| if (options?.useCheckSum) { | ||
@@ -98,16 +94,2 @@ this._useCheckSum = options.useCheckSum; | ||
| /** | ||
| * Use the modified time to check if the file has changed | ||
| * @returns {boolean} if the modified time is used to check if the file has changed (default: true) | ||
| */ | ||
| get useModifiedTime() { | ||
| return this._useModifiedTime; | ||
| } | ||
| /** | ||
| * Set the useModifiedTime value | ||
| * @param {boolean} value - The value to set | ||
| */ | ||
| set useModifiedTime(value) { | ||
| this._useModifiedTime = value; | ||
| } | ||
| /** | ||
| * Get the hash algorithm | ||
@@ -250,3 +232,2 @@ * @returns {string} The hash algorithm (default: 'md5') | ||
| const useCheckSumValue = options?.useCheckSum ?? this._useCheckSum; | ||
| const useModifiedTimeValue = options?.useModifiedTime ?? this._useModifiedTime; | ||
| try { | ||
@@ -284,3 +265,3 @@ fstat = fs.statSync(absolutePath); | ||
| } | ||
| if (useModifiedTimeValue && metaCache?.mtime !== result.meta?.mtime) { | ||
| if (useCheckSumValue === false && metaCache?.mtime !== result.meta?.mtime) { | ||
| result.changed = true; | ||
@@ -287,0 +268,0 @@ } |
+4
-4
| { | ||
| "name": "file-entry-cache", | ||
| "version": "11.0.0-beta.2", | ||
| "version": "11.0.0-beta.3", | ||
| "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", | ||
@@ -32,8 +32,8 @@ "type": "module", | ||
| "devDependencies": { | ||
| "@biomejs/biome": "^2.2.4", | ||
| "@types/node": "^24.5.0", | ||
| "@biomejs/biome": "^2.2.5", | ||
| "@types/node": "^24.6.2", | ||
| "@vitest/coverage-v8": "^3.2.4", | ||
| "rimraf": "^6.0.1", | ||
| "tsup": "^8.5.0", | ||
| "typescript": "^5.9.2", | ||
| "typescript": "^5.9.3", | ||
| "vitest": "^3.2.4" | ||
@@ -40,0 +40,0 @@ }, |
69312
-3.05%1139
-4.29%