@ff-labs/fff-bun 0.1.0-nightly.fcdf4a9 → 0.2.4-dev.8d9ef38
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/README.md +18 -18
- package/examples/grep.ts +1 -1
- package/package.json +9 -14
- package/src/download.ts +20 -143
- package/src/ffi.ts +638 -124
- package/src/finder.ts +55 -57
- package/src/git-lifecycle.test.ts +7 -7
- package/src/index.test.ts +13 -21
- package/src/index.ts +2 -6
- package/src/platform.ts +9 -9
- package/src/types.ts +0 -131
- package/bin/libfff_c.dylib +0 -0
- package/scripts/cli.ts +0 -116
- package/scripts/postinstall.ts +0 -49
package/scripts/postinstall.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
/**
|
|
3
|
-
* Postinstall script - ensures the native binary is available
|
|
4
|
-
*
|
|
5
|
-
* Resolution order:
|
|
6
|
-
* 1. Platform-specific npm package (installed via optionalDependencies)
|
|
7
|
-
* 2. Local dev build (target/release or target/debug)
|
|
8
|
-
* 3. Fallback: download from GitHub releases
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { findBinary, downloadBinary } from "../src/download";
|
|
12
|
-
import { getNpmPackageName } from "../src/platform";
|
|
13
|
-
|
|
14
|
-
async function main() {
|
|
15
|
-
// Check if binary is already available (npm package or dev build)
|
|
16
|
-
const existing = findBinary();
|
|
17
|
-
if (existing) {
|
|
18
|
-
console.log(`fff: Native library found at ${existing}`);
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Binary not found via npm package - try downloading from GitHub as fallback
|
|
23
|
-
let packageName: string;
|
|
24
|
-
try {
|
|
25
|
-
packageName = getNpmPackageName();
|
|
26
|
-
} catch {
|
|
27
|
-
packageName = "unknown";
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
console.log(
|
|
31
|
-
`fff: Platform package ${packageName} not found, falling back to GitHub download...`,
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
try {
|
|
35
|
-
const tag = await downloadBinary();
|
|
36
|
-
console.log(`fff: Native library installed successfully! (${tag})`);
|
|
37
|
-
} catch (error) {
|
|
38
|
-
console.error("fff: Failed to download native library:", error);
|
|
39
|
-
console.error("");
|
|
40
|
-
console.error("fff: You can build from source instead:");
|
|
41
|
-
console.error(" cargo build --release -p fff-c");
|
|
42
|
-
console.error("");
|
|
43
|
-
console.error("fff: Or run `bunx fff download` after fixing network issues.");
|
|
44
|
-
// Don't exit with error - allow install to complete
|
|
45
|
-
// The error will surface when the user tries to use the library
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
main();
|