@ff-labs/fff-bun 0.4.3-nightly.d794e43 → 0.4.3-nightly.eb577ea
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/ffi.ts +17 -27
- package/src/finder.ts +0 -1
- package/src/types.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ff-labs/fff-bun",
|
|
3
|
-
"version": "0.4.3-nightly.
|
|
3
|
+
"version": "0.4.3-nightly.eb577ea",
|
|
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.4.3-nightly.
|
|
66
|
-
"@ff-labs/fff-bin-darwin-x64": "0.4.3-nightly.
|
|
67
|
-
"@ff-labs/fff-bin-linux-x64-gnu": "0.4.3-nightly.
|
|
68
|
-
"@ff-labs/fff-bin-linux-arm64-gnu": "0.4.3-nightly.
|
|
69
|
-
"@ff-labs/fff-bin-linux-x64-musl": "0.4.3-nightly.
|
|
70
|
-
"@ff-labs/fff-bin-linux-arm64-musl": "0.4.3-nightly.
|
|
71
|
-
"@ff-labs/fff-bin-win32-x64": "0.4.3-nightly.
|
|
72
|
-
"@ff-labs/fff-bin-win32-arm64": "0.4.3-nightly.
|
|
65
|
+
"@ff-labs/fff-bin-darwin-arm64": "0.4.3-nightly.eb577ea",
|
|
66
|
+
"@ff-labs/fff-bin-darwin-x64": "0.4.3-nightly.eb577ea",
|
|
67
|
+
"@ff-labs/fff-bin-linux-x64-gnu": "0.4.3-nightly.eb577ea",
|
|
68
|
+
"@ff-labs/fff-bin-linux-arm64-gnu": "0.4.3-nightly.eb577ea",
|
|
69
|
+
"@ff-labs/fff-bin-linux-x64-musl": "0.4.3-nightly.eb577ea",
|
|
70
|
+
"@ff-labs/fff-bin-linux-arm64-musl": "0.4.3-nightly.eb577ea",
|
|
71
|
+
"@ff-labs/fff-bin-win32-x64": "0.4.3-nightly.eb577ea",
|
|
72
|
+
"@ff-labs/fff-bin-win32-arm64": "0.4.3-nightly.eb577ea"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@types/bun": "^1.3.8",
|
package/src/ffi.ts
CHANGED
|
@@ -241,9 +241,7 @@ function snakeToCamel(obj: unknown): unknown {
|
|
|
241
241
|
|
|
242
242
|
const result: Record<string, unknown> = {};
|
|
243
243
|
for (const [key, value] of Object.entries(obj as Record<string, unknown>)) {
|
|
244
|
-
const camelKey = key.replace(/_([a-z])/g, (_, letter) =>
|
|
245
|
-
letter.toUpperCase(),
|
|
246
|
-
);
|
|
244
|
+
const camelKey = key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
247
245
|
result[camelKey] = snakeToCamel(value);
|
|
248
246
|
}
|
|
249
247
|
return result;
|
|
@@ -253,16 +251,18 @@ function snakeToCamel(obj: unknown): unknown {
|
|
|
253
251
|
// FffResult byte offsets (must match #[repr(C)] layout on 64-bit)
|
|
254
252
|
// { success: bool(1+7pad), error: *char(8), handle: *void(8), int_value: i64(8) }
|
|
255
253
|
// ---------------------------------------------------------------------------
|
|
256
|
-
const RES_SUCCESS
|
|
257
|
-
const RES_ERROR
|
|
258
|
-
const RES_HANDLE
|
|
259
|
-
const RES_INT_VALUE = 24;
|
|
254
|
+
const RES_SUCCESS = 0; // bool (1 + 7 padding)
|
|
255
|
+
const RES_ERROR = 8; // *mut c_char (8)
|
|
256
|
+
const RES_HANDLE = 16; // *mut c_void (8)
|
|
257
|
+
const RES_INT_VALUE = 24; // i64 (8)
|
|
260
258
|
|
|
261
259
|
/**
|
|
262
260
|
* Read the FffResult envelope: check success, extract payload, free envelope.
|
|
263
261
|
* On error returns a Result<never>. On success returns the raw handle pointer and int_value.
|
|
264
262
|
*/
|
|
265
|
-
function readResultEnvelope(
|
|
263
|
+
function readResultEnvelope(
|
|
264
|
+
resultPtr: Pointer | null,
|
|
265
|
+
): { success: true; handlePtr: number; intValue: number } | Result<never> {
|
|
266
266
|
if (resultPtr === null) {
|
|
267
267
|
return err("FFI returned null pointer");
|
|
268
268
|
}
|
|
@@ -651,16 +651,10 @@ function readGrepMatchStruct(p: number): GrepMatch {
|
|
|
651
651
|
match.fuzzyScore = read.u16(pp, GM_FUZZY_SCORE);
|
|
652
652
|
}
|
|
653
653
|
if (ctxBeforeCount > 0) {
|
|
654
|
-
match.contextBefore = readCStringArray(
|
|
655
|
-
read.ptr(pp, GM_CTX_BEFORE),
|
|
656
|
-
ctxBeforeCount,
|
|
657
|
-
);
|
|
654
|
+
match.contextBefore = readCStringArray(read.ptr(pp, GM_CTX_BEFORE), ctxBeforeCount);
|
|
658
655
|
}
|
|
659
656
|
if (ctxAfterCount > 0) {
|
|
660
|
-
match.contextAfter = readCStringArray(
|
|
661
|
-
read.ptr(pp, GM_CTX_AFTER),
|
|
662
|
-
ctxAfterCount,
|
|
663
|
-
);
|
|
657
|
+
match.contextAfter = readCStringArray(read.ptr(pp, GM_CTX_AFTER), ctxAfterCount);
|
|
664
658
|
}
|
|
665
659
|
|
|
666
660
|
return match;
|
|
@@ -824,13 +818,15 @@ export function ffiIsScanning(handle: NativeHandle): boolean {
|
|
|
824
818
|
}
|
|
825
819
|
|
|
826
820
|
// FffScanProgress { scanned_files_count: u64(8), is_scanning: bool(1+7pad) }
|
|
827
|
-
const SP_COUNT
|
|
828
|
-
const SP_SCANNING = 8;
|
|
821
|
+
const SP_COUNT = 0; // u64 (8)
|
|
822
|
+
const SP_SCANNING = 8; // bool (1 + 7 pad)
|
|
829
823
|
|
|
830
824
|
/**
|
|
831
825
|
* Get scan progress.
|
|
832
826
|
*/
|
|
833
|
-
export function ffiGetScanProgress(
|
|
827
|
+
export function ffiGetScanProgress(
|
|
828
|
+
handle: NativeHandle,
|
|
829
|
+
): Result<{ scannedFilesCount: number; isScanning: boolean }> {
|
|
834
830
|
const library = loadLibrary();
|
|
835
831
|
const resultPtr = library.symbols.fff_get_scan_progress(handle);
|
|
836
832
|
const envelope = readResultEnvelope(resultPtr);
|
|
@@ -852,10 +848,7 @@ export function ffiGetScanProgress(handle: NativeHandle): Result<{ scannedFilesC
|
|
|
852
848
|
/**
|
|
853
849
|
* Wait for scan to complete.
|
|
854
850
|
*/
|
|
855
|
-
export function ffiWaitForScan(
|
|
856
|
-
handle: NativeHandle,
|
|
857
|
-
timeoutMs: number,
|
|
858
|
-
): Result<boolean> {
|
|
851
|
+
export function ffiWaitForScan(handle: NativeHandle, timeoutMs: number): Result<boolean> {
|
|
859
852
|
const library = loadLibrary();
|
|
860
853
|
const resultPtr = library.symbols.fff_wait_for_scan(handle, BigInt(timeoutMs));
|
|
861
854
|
return parseBoolResult(resultPtr);
|
|
@@ -864,10 +857,7 @@ export function ffiWaitForScan(
|
|
|
864
857
|
/**
|
|
865
858
|
* Restart index in new path.
|
|
866
859
|
*/
|
|
867
|
-
export function ffiRestartIndex(
|
|
868
|
-
handle: NativeHandle,
|
|
869
|
-
newPath: string,
|
|
870
|
-
): Result<void> {
|
|
860
|
+
export function ffiRestartIndex(handle: NativeHandle, newPath: string): Result<void> {
|
|
871
861
|
const library = loadLibrary();
|
|
872
862
|
const resultPtr = library.symbols.fff_restart_index(handle, ptr(encodeString(newPath)));
|
|
873
863
|
return parseVoidResult(resultPtr);
|
package/src/finder.ts
CHANGED
package/src/types.ts
CHANGED