@ff-labs/fff-bun 0.6.1 → 0.6.2-nightly.464f9d8
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 +9 -9
- package/src/index.test.ts +50 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ff-labs/fff-bun",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2-nightly.464f9d8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "High-performance fuzzy file finder for Bun - perfect for LLM agent tools",
|
|
6
6
|
"type": "module",
|
|
@@ -62,14 +62,14 @@
|
|
|
62
62
|
},
|
|
63
63
|
"homepage": "https://github.com/dmtrKovalenko/fff.nvim#readme",
|
|
64
64
|
"optionalDependencies": {
|
|
65
|
-
"@ff-labs/fff-bin-darwin-arm64": "0.6.
|
|
66
|
-
"@ff-labs/fff-bin-darwin-x64": "0.6.
|
|
67
|
-
"@ff-labs/fff-bin-linux-x64-gnu": "0.6.
|
|
68
|
-
"@ff-labs/fff-bin-linux-arm64-gnu": "0.6.
|
|
69
|
-
"@ff-labs/fff-bin-linux-x64-musl": "0.6.
|
|
70
|
-
"@ff-labs/fff-bin-linux-arm64-musl": "0.6.
|
|
71
|
-
"@ff-labs/fff-bin-win32-x64": "0.6.
|
|
72
|
-
"@ff-labs/fff-bin-win32-arm64": "0.6.
|
|
65
|
+
"@ff-labs/fff-bin-darwin-arm64": "0.6.2-nightly.464f9d8",
|
|
66
|
+
"@ff-labs/fff-bin-darwin-x64": "0.6.2-nightly.464f9d8",
|
|
67
|
+
"@ff-labs/fff-bin-linux-x64-gnu": "0.6.2-nightly.464f9d8",
|
|
68
|
+
"@ff-labs/fff-bin-linux-arm64-gnu": "0.6.2-nightly.464f9d8",
|
|
69
|
+
"@ff-labs/fff-bin-linux-x64-musl": "0.6.2-nightly.464f9d8",
|
|
70
|
+
"@ff-labs/fff-bin-linux-arm64-musl": "0.6.2-nightly.464f9d8",
|
|
71
|
+
"@ff-labs/fff-bin-win32-x64": "0.6.2-nightly.464f9d8",
|
|
72
|
+
"@ff-labs/fff-bin-win32-arm64": "0.6.2-nightly.464f9d8"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@types/bun": "^1.3.8",
|
package/src/index.test.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
2
4
|
import { findBinary } from "./download";
|
|
3
5
|
import { FileFinder } from "./index";
|
|
4
6
|
import { getLibExtension, getLibFilename, getTriple } from "./platform";
|
|
@@ -280,6 +282,54 @@ describe("FileFinder - Full Lifecycle", () => {
|
|
|
280
282
|
});
|
|
281
283
|
});
|
|
282
284
|
|
|
285
|
+
describe("FileFinder - Directory Search", () => {
|
|
286
|
+
let finder: FileFinder;
|
|
287
|
+
const tmpDir = path.join(testDir, "__test_dirs__");
|
|
288
|
+
const sep = path.sep;
|
|
289
|
+
|
|
290
|
+
beforeAll(() => {
|
|
291
|
+
fs.mkdirSync(path.join(tmpDir, "alpha", "nested"), { recursive: true });
|
|
292
|
+
fs.mkdirSync(path.join(tmpDir, "beta"), { recursive: true });
|
|
293
|
+
fs.writeFileSync(path.join(tmpDir, "alpha", "file.txt"), "x");
|
|
294
|
+
fs.writeFileSync(path.join(tmpDir, "alpha", "nested", "deep.txt"), "x");
|
|
295
|
+
fs.writeFileSync(path.join(tmpDir, "beta", "file.txt"), "x");
|
|
296
|
+
|
|
297
|
+
const result = FileFinder.create({ basePath: testDir });
|
|
298
|
+
expect(result.ok).toBe(true);
|
|
299
|
+
if (result.ok) {
|
|
300
|
+
finder = result.value;
|
|
301
|
+
}
|
|
302
|
+
finder.waitForScan(5000);
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
afterAll(() => {
|
|
306
|
+
finder?.destroy();
|
|
307
|
+
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
test("known directories are returned with correct paths", () => {
|
|
311
|
+
const result = finder.directorySearch("__test_dirs__");
|
|
312
|
+
expect(result.ok).toBe(true);
|
|
313
|
+
if (!result.ok) return;
|
|
314
|
+
|
|
315
|
+
const paths = result.value.items.map((i) => i.relativePath);
|
|
316
|
+
expect(paths).toContain(`__test_dirs__${sep}alpha${sep}`);
|
|
317
|
+
expect(paths).toContain(`__test_dirs__${sep}beta${sep}`);
|
|
318
|
+
expect(paths).toContain(`__test_dirs__${sep}alpha${sep}nested${sep}`);
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
test("nested directory uses native separators and correct dirName", () => {
|
|
322
|
+
const result = finder.directorySearch("nested");
|
|
323
|
+
expect(result.ok).toBe(true);
|
|
324
|
+
if (!result.ok) return;
|
|
325
|
+
|
|
326
|
+
const nested = result.value.items.find((i) => i.relativePath.includes("nested"));
|
|
327
|
+
expect(nested).toBeDefined();
|
|
328
|
+
expect(nested!.relativePath).toBe(`__test_dirs__${sep}alpha${sep}nested${sep}`);
|
|
329
|
+
expect(nested!.dirName).toBe(`nested${sep}`);
|
|
330
|
+
});
|
|
331
|
+
});
|
|
332
|
+
|
|
283
333
|
describe("FileFinder - Error Handling", () => {
|
|
284
334
|
test("search fails on destroyed instance", () => {
|
|
285
335
|
const createResult = FileFinder.create({ basePath: testDir });
|