sliftutils 1.4.0 → 1.4.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sliftutils",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -396,12 +396,15 @@ export const getFileStorageNested2 = cache(async function getFileStorage(pathStr
396
396
  } else {
397
397
  base = await getDirectoryHandle();
398
398
  let dirs: string[] = [];
399
+ let alls: string[] = [];
399
400
  for await (const [name, entry] of base) {
400
401
  if (entry.kind === "directory") {
401
402
  dirs.push(name);
402
403
  }
404
+ alls.push(name);
403
405
  }
404
- if (dirs.includes(".git") || dirs.includes("data")) {
406
+ // HACK: If there are enough files, it's almost certainly not a directory that contains collections. It's probably the user's data instead
407
+ if (dirs.includes(".git") || dirs.includes("data") || alls.length > 100) {
405
408
  base = await base.getDirectoryHandle("data", { create: true });
406
409
  }
407
410
  }