@edxeth/fff-node 0.7.2-edxeth.0
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/src/binary.d.ts +22 -0
- package/dist/src/binary.d.ts.map +1 -0
- package/dist/src/binary.js +135 -0
- package/dist/src/binary.js.map +1 -0
- package/dist/src/ffi.d.ts +133 -0
- package/dist/src/ffi.d.ts.map +1 -0
- package/dist/src/ffi.js +1141 -0
- package/dist/src/ffi.js.map +1 -0
- package/dist/src/finder.d.ts +313 -0
- package/dist/src/finder.d.ts.map +1 -0
- package/dist/src/finder.js +423 -0
- package/dist/src/finder.js.map +1 -0
- package/dist/src/index.d.ts +47 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +47 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/platform.d.ts +27 -0
- package/dist/src/platform.d.ts.map +1 -0
- package/dist/src/platform.js +117 -0
- package/dist/src/platform.js.map +1 -0
- package/dist/src/types.d.ts +462 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +19 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Binary resolution utilities for fff-node
|
|
3
|
+
*
|
|
4
|
+
* Resolves the native library from:
|
|
5
|
+
* 1. Platform-specific npm package (e.g. @edxeth/fff-bin-darwin-arm64)
|
|
6
|
+
* 2. Local dev build (target/release or target/debug)
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Check if the binary exists in any known location
|
|
10
|
+
*/
|
|
11
|
+
export declare function binaryExists(): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Find the native library binary.
|
|
14
|
+
*
|
|
15
|
+
* Resolution order:
|
|
16
|
+
* - Dev workspace: local dev build first, then npm package
|
|
17
|
+
* - Production: npm package first, then dev build
|
|
18
|
+
*
|
|
19
|
+
* @returns Absolute path to the library, or null if not found
|
|
20
|
+
*/
|
|
21
|
+
export declare function findBinary(): string | null;
|
|
22
|
+
//# sourceMappingURL=binary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary.d.ts","sourceRoot":"","sources":["../../src/binary.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA8CH;;GAEG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AA0DD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,IAAI,MAAM,GAAG,IAAI,CAuB1C"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Binary resolution utilities for fff-node
|
|
3
|
+
*
|
|
4
|
+
* Resolves the native library from:
|
|
5
|
+
* 1. Platform-specific npm package (e.g. @edxeth/fff-bin-darwin-arm64)
|
|
6
|
+
* 2. Local dev build (target/release or target/debug)
|
|
7
|
+
*/
|
|
8
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
9
|
+
import { createRequire } from "node:module";
|
|
10
|
+
import { dirname, join } from "node:path";
|
|
11
|
+
import { fileURLToPath } from "node:url";
|
|
12
|
+
import { getLibFilename, getNpmPackageName } from "./platform.js";
|
|
13
|
+
/**
|
|
14
|
+
* Get the current file's directory
|
|
15
|
+
*/
|
|
16
|
+
function getCurrentDir() {
|
|
17
|
+
const url = import.meta.url;
|
|
18
|
+
if (url.startsWith("file://")) {
|
|
19
|
+
return dirname(fileURLToPath(url));
|
|
20
|
+
}
|
|
21
|
+
return dirname(url);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get the package root directory
|
|
25
|
+
*/
|
|
26
|
+
function getPackageDir() {
|
|
27
|
+
const currentDir = getCurrentDir();
|
|
28
|
+
// In dev: src/ -> package root
|
|
29
|
+
// In dist: dist/src/ -> package root
|
|
30
|
+
// We look for package.json to find the actual root
|
|
31
|
+
let dir = currentDir;
|
|
32
|
+
for (let i = 0; i < 5; i++) {
|
|
33
|
+
if (existsSync(join(dir, "package.json"))) {
|
|
34
|
+
try {
|
|
35
|
+
const pkg = JSON.parse(readFileSync(join(dir, "package.json"), "utf-8"));
|
|
36
|
+
if (pkg.name === "@edxeth/fff-node") {
|
|
37
|
+
return dir;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
// Not our package.json, keep going up
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
dir = dirname(dir);
|
|
45
|
+
}
|
|
46
|
+
// Fallback: assume we're one level deep in src/
|
|
47
|
+
return dirname(currentDir);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Check if the binary exists in any known location
|
|
51
|
+
*/
|
|
52
|
+
export function binaryExists() {
|
|
53
|
+
return findBinary() !== null;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Try to resolve the binary from the platform-specific npm package.
|
|
57
|
+
*
|
|
58
|
+
* When users install @edxeth/fff-node, npm automatically installs the matching
|
|
59
|
+
* optionalDependency (e.g. @edxeth/fff-bin-darwin-arm64). We resolve the binary
|
|
60
|
+
* path by requiring that package's package.json and looking for the binary
|
|
61
|
+
* in the same directory.
|
|
62
|
+
*/
|
|
63
|
+
function resolveFromNpmPackage() {
|
|
64
|
+
const packageName = getNpmPackageName();
|
|
65
|
+
try {
|
|
66
|
+
// Use createRequire to resolve the platform package's location
|
|
67
|
+
const require = createRequire(join(getPackageDir(), "package.json"));
|
|
68
|
+
const packageJsonPath = require.resolve(`${packageName}/package.json`);
|
|
69
|
+
const packageDir = dirname(packageJsonPath);
|
|
70
|
+
const binaryPath = join(packageDir, getLibFilename());
|
|
71
|
+
if (existsSync(binaryPath)) {
|
|
72
|
+
return binaryPath;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
// Package not installed - this is expected on unsupported platforms
|
|
77
|
+
// or when installed without optional dependencies
|
|
78
|
+
}
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Get the development binary path (for local development)
|
|
83
|
+
*/
|
|
84
|
+
function getDevBinaryPath() {
|
|
85
|
+
const packageDir = getPackageDir();
|
|
86
|
+
const workspaceRoot = join(packageDir, "..", "..");
|
|
87
|
+
const possiblePaths = [
|
|
88
|
+
join(workspaceRoot, "target", "release", getLibFilename()),
|
|
89
|
+
join(workspaceRoot, "target", "debug", getLibFilename()),
|
|
90
|
+
];
|
|
91
|
+
for (const path of possiblePaths) {
|
|
92
|
+
if (existsSync(path)) {
|
|
93
|
+
return path;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
function isDevWorkspace() {
|
|
99
|
+
const packageDir = getPackageDir();
|
|
100
|
+
const workspaceRoot = join(packageDir, "..", "..");
|
|
101
|
+
return existsSync(join(workspaceRoot, "Cargo.toml"));
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Find the native library binary.
|
|
105
|
+
*
|
|
106
|
+
* Resolution order:
|
|
107
|
+
* - Dev workspace: local dev build first, then npm package
|
|
108
|
+
* - Production: npm package first, then dev build
|
|
109
|
+
*
|
|
110
|
+
* @returns Absolute path to the library, or null if not found
|
|
111
|
+
*/
|
|
112
|
+
export function findBinary() {
|
|
113
|
+
if (isDevWorkspace()) {
|
|
114
|
+
// 1. Local bin/ directory (populated by `make prepare-node`)
|
|
115
|
+
const binPath = join(getPackageDir(), "bin", getLibFilename());
|
|
116
|
+
if (existsSync(binPath))
|
|
117
|
+
return binPath;
|
|
118
|
+
// 2. Local dev build (target/release or target/debug)
|
|
119
|
+
const devPath = getDevBinaryPath();
|
|
120
|
+
if (devPath)
|
|
121
|
+
return devPath;
|
|
122
|
+
// 3. Fallback to npm package
|
|
123
|
+
const npmPath = resolveFromNpmPackage();
|
|
124
|
+
if (npmPath)
|
|
125
|
+
return npmPath;
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
// Production: npm package first
|
|
129
|
+
const npmPath = resolveFromNpmPackage();
|
|
130
|
+
if (npmPath)
|
|
131
|
+
return npmPath;
|
|
132
|
+
// Fallback: local dev build (e.g. user built from source)
|
|
133
|
+
return getDevBinaryPath();
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=binary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary.js","sourceRoot":"","sources":["../../src/binary.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElE;;GAEG;AACH,SAAS,aAAa;IACpB,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;IAE5B,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9B,OAAO,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;AACtB,CAAC;AAED;;GAEG;AACH,SAAS,aAAa;IACpB,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IACnC,+BAA+B;IAC/B,qCAAqC;IACrC,mDAAmD;IACnD,IAAI,GAAG,GAAG,UAAU,CAAC;IACrB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;YAC1C,IAAI,CAAC;gBACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,c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.js FFI bindings for the fff-c native library using ffi-rs
|
|
3
|
+
*
|
|
4
|
+
* This module uses ffi-rs to call into the Rust C library.
|
|
5
|
+
* All functions follow the Result pattern for error handling.
|
|
6
|
+
*
|
|
7
|
+
* The API is instance-based: `ffiCreate` returns an opaque handle that must
|
|
8
|
+
* be passed to all subsequent calls and freed with `ffiDestroy`.
|
|
9
|
+
*
|
|
10
|
+
* ## Memory management
|
|
11
|
+
*
|
|
12
|
+
* Every `fff_*` function returning `*mut FffResult` allocates with Rust's Box.
|
|
13
|
+
* We MUST call `fff_free_result` to properly deallocate (not libc::free).
|
|
14
|
+
*
|
|
15
|
+
* ## FffResult struct reading
|
|
16
|
+
*
|
|
17
|
+
* The FffResult struct layout (#[repr(C)]):
|
|
18
|
+
* offset 0: success (bool, 1 byte + 7 padding)
|
|
19
|
+
* offset 8: data pointer (8 bytes) - *mut c_char (JSON string or null)
|
|
20
|
+
* offset 16: error pointer (8 bytes) - *mut c_char (error message or null)
|
|
21
|
+
* offset 24: handle pointer (8 bytes) - *mut c_void (instance handle or null)
|
|
22
|
+
*
|
|
23
|
+
* ## Two-step approach for reading + freeing
|
|
24
|
+
*
|
|
25
|
+
* ffi-rs auto-dereferences struct retType pointers, losing the original pointer.
|
|
26
|
+
* We solve this by:
|
|
27
|
+
* 1. Calling the C function with `retType: DataType.External` to get the raw pointer
|
|
28
|
+
* 2. Using `restorePointer` to read the struct fields from the raw pointer
|
|
29
|
+
* 3. Calling `fff_free_result` with the original raw pointer
|
|
30
|
+
*
|
|
31
|
+
* ## Null pointer detection
|
|
32
|
+
*
|
|
33
|
+
* `isNullPointer` from ffi-rs correctly detects null C pointers wrapped as
|
|
34
|
+
* V8 External objects. We use this instead of truthy checks.
|
|
35
|
+
*/
|
|
36
|
+
import { type JsExternal } from "ffi-rs";
|
|
37
|
+
import type { DirSearchResult, GrepResult, MixedSearchResult, Result, SearchResult } from "./types.js";
|
|
38
|
+
/**
|
|
39
|
+
* Opaque native handle type. Callers must not inspect or modify this value.
|
|
40
|
+
*/
|
|
41
|
+
export type NativeHandle = JsExternal;
|
|
42
|
+
/**
|
|
43
|
+
* Create a new file finder instance.
|
|
44
|
+
*/
|
|
45
|
+
export declare function ffiCreate(basePath: string, frecencyDbPath: string, historyDbPath: string, useUnsafeNoLock: boolean, enableMmapCache: boolean, enableContentIndexing: boolean, watch: boolean, aiMode: boolean, logFilePath: string, logLevel: string, cacheBudgetMaxFiles: number, cacheBudgetMaxBytes: number, cacheBudgetMaxFileSize: number): Result<NativeHandle>;
|
|
46
|
+
/**
|
|
47
|
+
* Destroy and clean up an instance.
|
|
48
|
+
*/
|
|
49
|
+
export declare function ffiDestroy(handle: NativeHandle): void;
|
|
50
|
+
/**
|
|
51
|
+
* Perform fuzzy search.
|
|
52
|
+
*/
|
|
53
|
+
export declare function ffiSearch(handle: NativeHandle, query: string, currentFile: string, maxThreads: number, pageIndex: number, pageSize: number, comboBoostMultiplier: number, minComboCount: number): Result<SearchResult>;
|
|
54
|
+
/**
|
|
55
|
+
* Perform fuzzy directory search.
|
|
56
|
+
*/
|
|
57
|
+
export declare function ffiSearchDirectories(handle: NativeHandle, query: string, currentFile: string | null, maxThreads: number, pageIndex: number, pageSize: number): Result<DirSearchResult>;
|
|
58
|
+
/**
|
|
59
|
+
* Perform mixed (files + directories) fuzzy search.
|
|
60
|
+
*/
|
|
61
|
+
export declare function ffiSearchMixed(handle: NativeHandle, query: string, currentFile: string, maxThreads: number, pageIndex: number, pageSize: number, comboBoostMultiplier: number, minComboCount: number): Result<MixedSearchResult>;
|
|
62
|
+
/**
|
|
63
|
+
* Live grep - search file contents.
|
|
64
|
+
*/
|
|
65
|
+
export declare function ffiLiveGrep(handle: NativeHandle, query: string, mode: string, maxFileSize: number, maxMatchesPerFile: number, smartCase: boolean, fileOffset: number, pageLimit: number, timeBudgetMs: number, beforeContext: number, afterContext: number, classifyDefinitions: boolean): Result<GrepResult>;
|
|
66
|
+
/**
|
|
67
|
+
* Multi-pattern grep - Aho-Corasick multi-needle search.
|
|
68
|
+
*/
|
|
69
|
+
export declare function ffiMultiGrep(handle: NativeHandle, patternsJoined: string, constraints: string, maxFileSize: number, maxMatchesPerFile: number, smartCase: boolean, fileOffset: number, pageLimit: number, timeBudgetMs: number, beforeContext: number, afterContext: number, classifyDefinitions: boolean): Result<GrepResult>;
|
|
70
|
+
/**
|
|
71
|
+
* Trigger file scan.
|
|
72
|
+
*/
|
|
73
|
+
export declare function ffiScanFiles(handle: NativeHandle): Result<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Check if scanning.
|
|
76
|
+
*/
|
|
77
|
+
export declare function ffiIsScanning(handle: NativeHandle): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Get the base path of the file picker.
|
|
80
|
+
*/
|
|
81
|
+
export declare function ffiGetBasePath(handle: NativeHandle): Result<string | null>;
|
|
82
|
+
/**
|
|
83
|
+
* Get scan progress.
|
|
84
|
+
*/
|
|
85
|
+
export declare function ffiGetScanProgress(handle: NativeHandle): Result<{
|
|
86
|
+
scannedFilesCount: number;
|
|
87
|
+
isScanning: boolean;
|
|
88
|
+
}>;
|
|
89
|
+
/**
|
|
90
|
+
* Wait for a tree scan to complete.
|
|
91
|
+
*/
|
|
92
|
+
export declare function ffiWaitForScan(handle: NativeHandle, timeoutMs: number): Result<boolean>;
|
|
93
|
+
/**
|
|
94
|
+
* Restart index in new path.
|
|
95
|
+
*/
|
|
96
|
+
export declare function ffiRestartIndex(handle: NativeHandle, newPath: string): Result<void>;
|
|
97
|
+
/**
|
|
98
|
+
* Refresh git status.
|
|
99
|
+
*/
|
|
100
|
+
export declare function ffiRefreshGitStatus(handle: NativeHandle): Result<number>;
|
|
101
|
+
/**
|
|
102
|
+
* Track query completion.
|
|
103
|
+
*/
|
|
104
|
+
export declare function ffiTrackQuery(handle: NativeHandle, query: string, filePath: string): Result<boolean>;
|
|
105
|
+
/**
|
|
106
|
+
* Get historical query.
|
|
107
|
+
*/
|
|
108
|
+
export declare function ffiGetHistoricalQuery(handle: NativeHandle, offset: number): Result<string | null>;
|
|
109
|
+
/**
|
|
110
|
+
* Health check.
|
|
111
|
+
*
|
|
112
|
+
* `handle` can be null for a limited check (version + git only).
|
|
113
|
+
* When null, we pass DataType.U64 with value 0 as a null pointer workaround
|
|
114
|
+
* since ffi-rs does not accept `null` for External parameters.
|
|
115
|
+
*/
|
|
116
|
+
export declare function ffiHealthCheck(handle: NativeHandle | null, testPath: string): Result<unknown>;
|
|
117
|
+
/**
|
|
118
|
+
* Ensure the library is loaded.
|
|
119
|
+
*
|
|
120
|
+
* Loads the native library from the platform-specific npm package
|
|
121
|
+
* or a local dev build. Throws if the binary is not found.
|
|
122
|
+
*/
|
|
123
|
+
export declare function ensureLoaded(): void;
|
|
124
|
+
/**
|
|
125
|
+
* Check if the library is available.
|
|
126
|
+
*/
|
|
127
|
+
export declare function isAvailable(): boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Close the library and release ffi-rs resources.
|
|
130
|
+
* Call this when completely done with the library.
|
|
131
|
+
*/
|
|
132
|
+
export declare function closeLibrary(): void;
|
|
133
|
+
//# sourceMappingURL=ffi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ffi.d.ts","sourceRoot":"","sources":["../../src/ffi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAIL,KAAK,UAAU,EAKhB,MAAM,QAAQ,CAAC;AAEhB,OAAO,KAAK,EAEV,eAAe,EAGf,UAAU,EAGV,iBAAiB,EACjB,MAAM,EAEN,YAAY,EACb,MAAM,YAAY,CAAC;AAoQpB;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC;AAEtC;;GAEG;AACH,wBAAgB,SAAS,CACvB,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,MAAM,EACrB,eAAe,EAAE,OAAO,EACxB,eAAe,EAAE,OAAO,EACxB,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