fnva 0.0.6 → 0.0.7
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/bin/fnva.js +45 -5
- package/package.json +1 -1
- package/platforms/fnva +0 -0
- package/platforms/fnva.exe +0 -0
package/bin/fnva.js
CHANGED
|
@@ -27,8 +27,8 @@ function resolveArch() {
|
|
|
27
27
|
return 'x64';
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
function
|
|
31
|
-
const platform = resolvePlatform();
|
|
30
|
+
function platformBinaryPath(platformOverride) {
|
|
31
|
+
const platform = platformOverride || resolvePlatform();
|
|
32
32
|
const arch = resolveArch();
|
|
33
33
|
const scriptDir = __dirname;
|
|
34
34
|
const projectRoot = path.resolve(scriptDir, '..');
|
|
@@ -37,13 +37,53 @@ function buildBinaryPath() {
|
|
|
37
37
|
return path.join(projectRoot, 'platforms', platformDir, binaryName);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
function buildBinaryPath() {
|
|
41
|
+
const platform = resolvePlatform();
|
|
42
|
+
const binaryCandidates = [];
|
|
43
|
+
|
|
44
|
+
// 1. Prebuilt binary shipped with the npm package
|
|
45
|
+
binaryCandidates.push(platformBinaryPath(platform));
|
|
46
|
+
|
|
47
|
+
// Flat legacy structure: platforms/fnva(.exe)
|
|
48
|
+
const scriptDir = __dirname;
|
|
49
|
+
const projectRoot = path.resolve(scriptDir, '..');
|
|
50
|
+
const flatBinaryName = platform === 'win32' ? 'fnva.exe' : 'fnva';
|
|
51
|
+
binaryCandidates.push(path.join(projectRoot, 'platforms', flatBinaryName));
|
|
52
|
+
|
|
53
|
+
// 2. User-provided override via environment variable
|
|
54
|
+
if (process.env.FNVA_NATIVE_PATH) {
|
|
55
|
+
binaryCandidates.push(process.env.FNVA_NATIVE_PATH);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// 3. Local cargo build outputs (helpful for development installs)
|
|
59
|
+
const targetDir = path.resolve(__dirname, '..', 'target');
|
|
60
|
+
if (platform === 'win32') {
|
|
61
|
+
binaryCandidates.push(path.join(targetDir, 'release', 'fnva.exe'));
|
|
62
|
+
binaryCandidates.push(path.join(targetDir, 'debug', 'fnva.exe'));
|
|
63
|
+
} else {
|
|
64
|
+
binaryCandidates.push(path.join(targetDir, 'release', 'fnva'));
|
|
65
|
+
binaryCandidates.push(path.join(targetDir, 'debug', 'fnva'));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
for (const candidate of binaryCandidates) {
|
|
69
|
+
if (candidate && fs.existsSync(candidate)) {
|
|
70
|
+
return candidate;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
|
|
40
77
|
function run() {
|
|
41
78
|
const binaryPath = buildBinaryPath();
|
|
42
79
|
|
|
43
|
-
if (!
|
|
44
|
-
console.error(
|
|
80
|
+
if (!binaryPath) {
|
|
81
|
+
console.error('Error: fnva native binary not found.');
|
|
45
82
|
console.error('');
|
|
46
|
-
console.error("Please
|
|
83
|
+
console.error("Please either:");
|
|
84
|
+
console.error(" 1) Run 'npm run build' (or 'npm run build:all') to produce platform binaries,");
|
|
85
|
+
console.error(" 2) Install a release package that includes the platforms directory, or");
|
|
86
|
+
console.error(" 3) Set FNVA_NATIVE_PATH to the full path of an existing fnva executable.");
|
|
47
87
|
process.exit(1);
|
|
48
88
|
}
|
|
49
89
|
|
package/package.json
CHANGED
package/platforms/fnva
CHANGED
|
Binary file
|
package/platforms/fnva.exe
CHANGED
|
Binary file
|