file-entry-cache 10.0.2 → 10.0.4

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 CHANGED
@@ -68,7 +68,7 @@ var FileEntryDefault = class {
68
68
  static createFromFile = createFromFile;
69
69
  };
70
70
  var FileEntryCache = class {
71
- _cache = new import_flat_cache.FlatCache();
71
+ _cache = new import_flat_cache.FlatCache({ useClone: false });
72
72
  _useCheckSum = false;
73
73
  _currentWorkingDirectory;
74
74
  _hashAlgorithm = "md5";
@@ -219,6 +219,7 @@ var FileEntryCache = class {
219
219
  changed: false,
220
220
  meta: {}
221
221
  };
222
+ result.meta = this._cache.getKey(result.key) ?? {};
222
223
  filePath = this.getAbsolutePath(filePath, { currentWorkingDirectory: options?.currentWorkingDirectory });
223
224
  const useCheckSumValue = options?.useCheckSum ?? this._useCheckSum;
224
225
  try {
@@ -250,15 +251,16 @@ var FileEntryCache = class {
250
251
  this._cache.setKey(result.key, result.meta);
251
252
  return result;
252
253
  }
253
- result.meta.data = metaCache.data;
254
+ if (result.meta.data === void 0) {
255
+ result.meta.data = metaCache.data;
256
+ }
254
257
  if (metaCache?.mtime !== result.meta?.mtime || metaCache?.size !== result.meta?.size) {
255
258
  result.changed = true;
256
- this._cache.setKey(result.key, result.meta);
257
259
  }
258
260
  if (useCheckSumValue && metaCache?.hash !== result.meta?.hash) {
259
261
  result.changed = true;
260
- this._cache.setKey(result.key, result.meta);
261
262
  }
263
+ this._cache.setKey(result.key, result.meta);
262
264
  return result;
263
265
  }
264
266
  /**
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ var FileEntryDefault = class {
31
31
  static createFromFile = createFromFile;
32
32
  };
33
33
  var FileEntryCache = class {
34
- _cache = new FlatCache();
34
+ _cache = new FlatCache({ useClone: false });
35
35
  _useCheckSum = false;
36
36
  _currentWorkingDirectory;
37
37
  _hashAlgorithm = "md5";
@@ -182,6 +182,7 @@ var FileEntryCache = class {
182
182
  changed: false,
183
183
  meta: {}
184
184
  };
185
+ result.meta = this._cache.getKey(result.key) ?? {};
185
186
  filePath = this.getAbsolutePath(filePath, { currentWorkingDirectory: options?.currentWorkingDirectory });
186
187
  const useCheckSumValue = options?.useCheckSum ?? this._useCheckSum;
187
188
  try {
@@ -213,15 +214,16 @@ var FileEntryCache = class {
213
214
  this._cache.setKey(result.key, result.meta);
214
215
  return result;
215
216
  }
216
- result.meta.data = metaCache.data;
217
+ if (result.meta.data === void 0) {
218
+ result.meta.data = metaCache.data;
219
+ }
217
220
  if (metaCache?.mtime !== result.meta?.mtime || metaCache?.size !== result.meta?.size) {
218
221
  result.changed = true;
219
- this._cache.setKey(result.key, result.meta);
220
222
  }
221
223
  if (useCheckSumValue && metaCache?.hash !== result.meta?.hash) {
222
224
  result.changed = true;
223
- this._cache.setKey(result.key, result.meta);
224
225
  }
226
+ this._cache.setKey(result.key, result.meta);
225
227
  return result;
226
228
  }
227
229
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "file-entry-cache",
3
- "version": "10.0.2",
3
+ "version": "10.0.4",
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
- "@types/node": "^22.9.0",
33
- "@vitest/coverage-v8": "^2.1.4",
32
+ "@types/node": "^22.9.3",
33
+ "@vitest/coverage-v8": "^2.1.5",
34
34
  "rimraf": "^6.0.1",
35
35
  "tsup": "^8.3.5",
36
- "typescript": "^5.6.3",
37
- "vitest": "^2.1.4",
36
+ "typescript": "^5.7.2",
37
+ "vitest": "^2.1.5",
38
38
  "xo": "^0.59.3"
39
39
  },
40
40
  "dependencies": {