2 Commits

Author SHA1 Message Date
d079f245ef v1.3.2
Some checks failed
Default (tags) / security (push) Successful in 27s
Default (tags) / test (push) Failing after 3m56s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2026-03-14 23:42:26 +00:00
eb2bf4ba98 fix(rustbinarylocator): support resolving platform-suffixed local Rust binaries 2026-03-14 23:42:26 +00:00
4 changed files with 23 additions and 2 deletions

View File

@@ -1,5 +1,11 @@
# Changelog # Changelog
## 2026-03-14 - 1.3.2 - fix(rustbinarylocator)
support resolving platform-suffixed local Rust binaries
- Checks local Rust build paths for binaries with platform suffixes such as _linux_amd64 in addition to unsuffixed names
- Adds platform and architecture suffix mapping for linux, darwin, windows, x64, and arm64
## 2026-02-26 - 1.3.1 - fix(readme) ## 2026-02-26 - 1.3.1 - fix(readme)
document socket transport and clarify stdio/socket differences in README document socket transport and clarify stdio/socket differences in README

View File

@@ -1,6 +1,6 @@
{ {
"name": "@push.rocks/smartrust", "name": "@push.rocks/smartrust",
"version": "1.3.1", "version": "1.3.2",
"private": false, "private": false,
"description": "a bridge between JS engines and rust", "description": "a bridge between JS engines and rust",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",

View File

@@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@push.rocks/smartrust', name: '@push.rocks/smartrust',
version: '1.3.1', version: '1.3.2',
description: 'a bridge between JS engines and rust' description: 'a bridge between JS engines and rust'
} }

View File

@@ -81,11 +81,18 @@ export class RustBinaryLocator {
plugins.path.resolve(process.cwd(), `rust/target/release/${binaryName}`), plugins.path.resolve(process.cwd(), `rust/target/release/${binaryName}`),
plugins.path.resolve(process.cwd(), `rust/target/debug/${binaryName}`), plugins.path.resolve(process.cwd(), `rust/target/debug/${binaryName}`),
]; ];
const platformSuffix = this.getPlatformSuffix();
for (const localPath of localPaths) { for (const localPath of localPaths) {
if (await this.isExecutable(localPath)) { if (await this.isExecutable(localPath)) {
this.logger.log('info', `Binary found at local path: ${localPath}`); this.logger.log('info', `Binary found at local path: ${localPath}`);
return localPath; return localPath;
} }
// Also try with platform suffix (tsrust convention: binaryName_linux_amd64)
const suffixedPath = `${localPath}_${platformSuffix}`;
if (await this.isExecutable(suffixedPath)) {
this.logger.log('info', `Binary found at local path (platform-suffixed): ${suffixedPath}`);
return suffixedPath;
}
} }
// 5. System PATH // 5. System PATH
@@ -137,6 +144,14 @@ export class RustBinaryLocator {
} }
} }
private getPlatformSuffix(): string {
const archMap: Record<string, string> = { x64: 'amd64', arm64: 'arm64' };
const platformMap: Record<string, string> = { linux: 'linux', darwin: 'darwin', win32: 'windows' };
const platform = platformMap[process.platform] || process.platform;
const arch = archMap[process.arch] || process.arch;
return `${platform}_${arch}`;
}
private async findInPath(binaryName: string): Promise<string | null> { private async findInPath(binaryName: string): Promise<string | null> {
const pathDirs = (process.env.PATH || '').split(plugins.path.delimiter); const pathDirs = (process.env.PATH || '').split(plugins.path.delimiter);
for (const dir of pathDirs) { for (const dir of pathDirs) {