@ff-labs/fff-bun 0.1.0-nightly.f0ce2dd → 0.1.0-nightly.fcdf4a9

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.
Files changed (2) hide show
  1. package/package.json +9 -9
  2. package/src/ffi.ts +10 -37
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ff-labs/fff-bun",
3
- "version": "0.1.0-nightly.f0ce2dd",
3
+ "version": "0.1.0-nightly.fcdf4a9",
4
4
  "private": false,
5
5
  "description": "High-performance fuzzy file finder for Bun - perfect for LLM agent tools",
6
6
  "type": "module",
@@ -67,14 +67,14 @@
67
67
  },
68
68
  "homepage": "https://github.com/dmtrKovalenko/fff.nvim#readme",
69
69
  "optionalDependencies": {
70
- "@ff-labs/fff-bun-darwin-arm64": "0.1.0-nightly.f0ce2dd",
71
- "@ff-labs/fff-bun-darwin-x64": "0.1.0-nightly.f0ce2dd",
72
- "@ff-labs/fff-bun-linux-x64-gnu": "0.1.0-nightly.f0ce2dd",
73
- "@ff-labs/fff-bun-linux-arm64-gnu": "0.1.0-nightly.f0ce2dd",
74
- "@ff-labs/fff-bun-linux-x64-musl": "0.1.0-nightly.f0ce2dd",
75
- "@ff-labs/fff-bun-linux-arm64-musl": "0.1.0-nightly.f0ce2dd",
76
- "@ff-labs/fff-bun-win32-x64": "0.1.0-nightly.f0ce2dd",
77
- "@ff-labs/fff-bun-win32-arm64": "0.1.0-nightly.f0ce2dd"
70
+ "@ff-labs/fff-bun-darwin-arm64": "0.1.0-nightly.fcdf4a9",
71
+ "@ff-labs/fff-bun-darwin-x64": "0.1.0-nightly.fcdf4a9",
72
+ "@ff-labs/fff-bun-linux-x64-gnu": "0.1.0-nightly.fcdf4a9",
73
+ "@ff-labs/fff-bun-linux-arm64-gnu": "0.1.0-nightly.fcdf4a9",
74
+ "@ff-labs/fff-bun-linux-x64-musl": "0.1.0-nightly.fcdf4a9",
75
+ "@ff-labs/fff-bun-linux-arm64-musl": "0.1.0-nightly.fcdf4a9",
76
+ "@ff-labs/fff-bun-win32-x64": "0.1.0-nightly.fcdf4a9",
77
+ "@ff-labs/fff-bun-win32-arm64": "0.1.0-nightly.fcdf4a9"
78
78
  },
79
79
  "devDependencies": {
80
80
  "@types/bun": "^1.3.8",
package/src/ffi.ts CHANGED
@@ -148,9 +148,7 @@ function snakeToCamel(obj: unknown): unknown {
148
148
 
149
149
  const result: Record<string, unknown> = {};
150
150
  for (const [key, value] of Object.entries(obj as Record<string, unknown>)) {
151
- const camelKey = key.replace(/_([a-z])/g, (_, letter) =>
152
- letter.toUpperCase(),
153
- );
151
+ const camelKey = key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());
154
152
  result[camelKey] = snakeToCamel(value);
155
153
  }
156
154
  return result;
@@ -298,15 +296,9 @@ export function ffiGetScanProgress(handle: NativeHandle): Result<unknown> {
298
296
  /**
299
297
  * Wait for scan to complete.
300
298
  */
301
- export function ffiWaitForScan(
302
- handle: NativeHandle,
303
- timeoutMs: number,
304
- ): Result<boolean> {
299
+ export function ffiWaitForScan(handle: NativeHandle, timeoutMs: number): Result<boolean> {
305
300
  const library = loadLibrary();
306
- const resultPtr = library.symbols.fff_wait_for_scan(
307
- handle,
308
- BigInt(timeoutMs),
309
- );
301
+ const resultPtr = library.symbols.fff_wait_for_scan(handle, BigInt(timeoutMs));
310
302
  const result = parseResult<boolean | string>(resultPtr);
311
303
  if (!result.ok) return result;
312
304
  // JSON.parse("true") returns boolean true, but we also handle
@@ -317,15 +309,9 @@ export function ffiWaitForScan(
317
309
  /**
318
310
  * Restart index in new path.
319
311
  */
320
- export function ffiRestartIndex(
321
- handle: NativeHandle,
322
- newPath: string,
323
- ): Result<void> {
312
+ export function ffiRestartIndex(handle: NativeHandle, newPath: string): Result<void> {
324
313
  const library = loadLibrary();
325
- const resultPtr = library.symbols.fff_restart_index(
326
- handle,
327
- ptr(encodeString(newPath)),
328
- );
314
+ const resultPtr = library.symbols.fff_restart_index(handle, ptr(encodeString(newPath)));
329
315
  return parseResult<void>(resultPtr);
330
316
  }
331
317
 
@@ -340,10 +326,7 @@ export function ffiRefreshGitStatus(handle: NativeHandle): Result<number> {
340
326
  // JSON.parse("3") returns 3 (number), parseInt handles both
341
327
  return {
342
328
  ok: true,
343
- value:
344
- typeof result.value === "number"
345
- ? result.value
346
- : parseInt(result.value, 10),
329
+ value: typeof result.value === "number" ? result.value : parseInt(result.value, 10),
347
330
  };
348
331
  }
349
332
 
@@ -374,14 +357,10 @@ export function ffiGetHistoricalQuery(
374
357
  offset: number,
375
358
  ): Result<string | null> {
376
359
  const library = loadLibrary();
377
- const resultPtr = library.symbols.fff_get_historical_query(
378
- handle,
379
- BigInt(offset),
380
- );
360
+ const resultPtr = library.symbols.fff_get_historical_query(handle, BigInt(offset));
381
361
  const result = parseResult<string | null>(resultPtr);
382
362
  if (!result.ok) return result;
383
- if (result.value === null || result.value === "null")
384
- return { ok: true, value: null };
363
+ if (result.value === null || result.value === "null") return { ok: true, value: null };
385
364
  return result as Result<string>;
386
365
  }
387
366
 
@@ -431,15 +410,9 @@ export function ffiLiveGrep(
431
410
  /**
432
411
  * Multi-pattern grep - Aho-Corasick multi-needle search.
433
412
  */
434
- export function ffiMultiGrep(
435
- handle: NativeHandle,
436
- optsJson: string,
437
- ): Result<unknown> {
413
+ export function ffiMultiGrep(handle: NativeHandle, optsJson: string): Result<unknown> {
438
414
  const library = loadLibrary();
439
- const resultPtr = library.symbols.fff_multi_grep(
440
- handle,
441
- ptr(encodeString(optsJson)),
442
- );
415
+ const resultPtr = library.symbols.fff_multi_grep(handle, ptr(encodeString(optsJson)));
443
416
  return parseResult<unknown>(resultPtr);
444
417
  }
445
418