fnva 0.0.51 → 0.0.53
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.ps1
CHANGED
|
@@ -6,22 +6,55 @@ $scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
|
6
6
|
$arch = if ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") { "arm64" } else { "x64" }
|
|
7
7
|
$platformDir = "win32-$arch"
|
|
8
8
|
|
|
9
|
-
#
|
|
10
|
-
$
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
# Search paths for native binary (in priority order)
|
|
10
|
+
$searchPaths = @(
|
|
11
|
+
# npm global install: fnva.ps1 is in <prefix>/, binary is in <prefix>/node_modules/fnva/platforms/
|
|
12
|
+
(Join-Path $scriptDir "node_modules\fnva\platforms\$platformDir\fnva.exe"),
|
|
13
|
+
# npm global install (flat): binary next to fnva.ps1
|
|
14
|
+
(Join-Path $scriptDir "fnva.exe"),
|
|
15
|
+
# Source tree: fnva.ps1 is in bin/, binary is in platforms/
|
|
16
|
+
(Join-Path $scriptDir "..\platforms\$platformDir\fnva.exe"),
|
|
17
|
+
# Local dev build
|
|
18
|
+
(Join-Path $scriptDir "..\target\release\fnva.exe")
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
function Invoke-FnvaNative {
|
|
22
|
+
param([string]$BinPath, [string[]]$CliArgs)
|
|
23
|
+
|
|
24
|
+
# For env commands, capture output and re-emit as single string
|
|
25
|
+
# to avoid PS splitting native exe output into Object[]
|
|
26
|
+
if ($CliArgs.Length -ge 2 -and $CliArgs[0] -eq 'env' -and $CliArgs[1] -eq 'env') {
|
|
27
|
+
$output = & $BinPath @CliArgs 2>$null
|
|
28
|
+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
29
|
+
$output -join "`n"
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
# For switch commands, also capture to avoid Object[] issues
|
|
34
|
+
if ($CliArgs.Length -ge 3 -and $CliArgs[1] -eq 'use') {
|
|
35
|
+
$output = & $BinPath @CliArgs 2>$null
|
|
36
|
+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
37
|
+
$output -join "`n"
|
|
38
|
+
return
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
# Other commands: pass through directly
|
|
42
|
+
& $BinPath @CliArgs
|
|
13
43
|
exit $LASTEXITCODE
|
|
14
44
|
}
|
|
15
45
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
46
|
+
foreach ($binaryPath in $searchPaths) {
|
|
47
|
+
if (Test-Path $binaryPath) {
|
|
48
|
+
Invoke-FnvaNative -BinPath $binaryPath -CliArgs $args
|
|
49
|
+
return
|
|
50
|
+
}
|
|
21
51
|
}
|
|
22
52
|
|
|
23
53
|
# Last resort: node wrapper
|
|
24
|
-
$nodeScript = Join-Path $scriptDir "fnva.js"
|
|
54
|
+
$nodeScript = Join-Path $scriptDir "node_modules\fnva\bin\fnva.js"
|
|
55
|
+
if (-not (Test-Path $nodeScript)) {
|
|
56
|
+
$nodeScript = Join-Path $scriptDir "fnva.js"
|
|
57
|
+
}
|
|
25
58
|
if (Test-Path $nodeScript) {
|
|
26
59
|
& node $nodeScript @args
|
|
27
60
|
exit $LASTEXITCODE
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/platforms/linux-x64/fnva
CHANGED
|
Binary file
|
|
Binary file
|