@aptove/bridge 0.1.8 → 0.1.9

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.
Files changed (2) hide show
  1. package/bin/bridge +19 -8
  2. package/package.json +6 -6
package/bin/bridge CHANGED
@@ -22,16 +22,27 @@ if (!packageName) {
22
22
  }
23
23
 
24
24
  const binaryName = process.platform === 'win32' ? 'bridge.exe' : 'bridge';
25
- let binaryPath;
26
25
 
27
- try {
28
- const packageJsonPath = require.resolve(`${packageName}/package.json`);
29
- const candidate = path.join(path.dirname(packageJsonPath), 'bin', binaryName);
30
- if (fs.existsSync(candidate)) {
31
- binaryPath = candidate;
26
+ // Both @aptove/bridge and @aptove/bridge-<platform> live under the same
27
+ // @aptove scope directory, so the platform package is always a sibling:
28
+ // __dirname = .../node_modules/@aptove/bridge/bin
29
+ // platform = .../node_modules/@aptove/bridge-darwin-arm64/bin/bridge
30
+ const shortName = packageName.split('/')[1]; // e.g. "bridge-darwin-arm64"
31
+ const siblingPath = path.join(__dirname, '..', '..', shortName, 'bin', binaryName);
32
+
33
+ let binaryPath = fs.existsSync(siblingPath) ? siblingPath : null;
34
+
35
+ // Fallback: require.resolve handles pnpm virtual stores and other layouts
36
+ if (!binaryPath) {
37
+ try {
38
+ const pkgJson = require.resolve(`${packageName}/package.json`);
39
+ const candidate = path.join(path.dirname(pkgJson), 'bin', binaryName);
40
+ if (fs.existsSync(candidate)) {
41
+ binaryPath = candidate;
42
+ }
43
+ } catch (e) {
44
+ // not found
32
45
  }
33
- } catch (e) {
34
- // package not installed
35
46
  }
36
47
 
37
48
  if (!binaryPath) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aptove/bridge",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "ACP bridge — connects ACP agents to mobile and desktop clients over WebSocket",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -33,10 +33,10 @@
33
33
  "node": ">=16"
34
34
  },
35
35
  "optionalDependencies": {
36
- "@aptove/bridge-darwin-arm64": "0.1.8",
37
- "@aptove/bridge-darwin-x64": "0.1.8",
38
- "@aptove/bridge-linux-arm64": "0.1.8",
39
- "@aptove/bridge-linux-x64": "0.1.8",
40
- "@aptove/bridge-win32-x64": "0.1.8"
36
+ "@aptove/bridge-darwin-arm64": "0.1.9",
37
+ "@aptove/bridge-darwin-x64": "0.1.9",
38
+ "@aptove/bridge-linux-arm64": "0.1.9",
39
+ "@aptove/bridge-linux-x64": "0.1.9",
40
+ "@aptove/bridge-win32-x64": "0.1.9"
41
41
  }
42
42
  }