repomap-bin 2.0.0 → 2.1.1
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/index.js +19 -7
- package/package.json +5 -5
- package/run.js +20 -9
package/index.js
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
2
3
|
import { join, dirname } from "node:path";
|
|
3
4
|
import { fileURLToPath } from "node:url";
|
|
4
5
|
|
|
5
6
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
const localRequire = createRequire(import.meta.url);
|
|
6
8
|
|
|
7
9
|
function findBinary() {
|
|
8
10
|
const platform = process.platform;
|
|
9
11
|
const arch = process.arch;
|
|
12
|
+
const binName = platform === "win32" ? "repomap.exe" : "repomap";
|
|
13
|
+
|
|
14
|
+
// 1. Check repo dist/ directory (local development)
|
|
15
|
+
const repoBin = join(__dirname, "..", "..", "dist", binName);
|
|
16
|
+
if (existsSync(repoBin)) return repoBin;
|
|
10
17
|
|
|
18
|
+
// 2. Resolve platform package via Node module resolution (handles hoisted, npx, yarn, pnpm)
|
|
11
19
|
const platformPackages = {
|
|
12
20
|
"linux-x64": { pkg: "repomap-bin-linux-x64", bin: "repomap" },
|
|
13
21
|
"darwin-arm64": { pkg: "repomap-bin-darwin-arm64", bin: "repomap" },
|
|
@@ -17,15 +25,19 @@ function findBinary() {
|
|
|
17
25
|
const key = `${platform}-${arch}`;
|
|
18
26
|
const info = platformPackages[key];
|
|
19
27
|
if (info) {
|
|
20
|
-
|
|
21
|
-
|
|
28
|
+
try {
|
|
29
|
+
const pkgJson = localRequire.resolve(`${info.pkg}/package.json`);
|
|
30
|
+
const candidate = join(dirname(pkgJson), info.bin);
|
|
31
|
+
if (existsSync(candidate)) return candidate;
|
|
32
|
+
} catch { /* not resolvable */ }
|
|
33
|
+
|
|
34
|
+
// Non-hoisted: inside repomap-bin's own node_modules
|
|
35
|
+
const nested = join(__dirname, "node_modules", info.pkg, info.bin);
|
|
36
|
+
if (existsSync(nested)) return nested;
|
|
22
37
|
}
|
|
23
38
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (existsSync(fallback)) return fallback;
|
|
27
|
-
|
|
28
|
-
return null;
|
|
39
|
+
// 3. PATH fallback
|
|
40
|
+
return binName;
|
|
29
41
|
}
|
|
30
42
|
|
|
31
43
|
export function getBinaryPath() {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "repomap-bin",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "Standalone repomap binary
|
|
3
|
+
"version": "2.1.1",
|
|
4
|
+
"description": "Standalone repomap binary \u2014 tree-sitter AST code intelligence CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"repomap": "./run.js"
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"index.js"
|
|
12
12
|
],
|
|
13
13
|
"optionalDependencies": {
|
|
14
|
-
"repomap-bin-linux-x64": "1.
|
|
15
|
-
"repomap-bin-darwin-arm64": "1.
|
|
16
|
-
"repomap-bin-windows-x64": "1.
|
|
14
|
+
"repomap-bin-linux-x64": "2.1.1",
|
|
15
|
+
"repomap-bin-darwin-arm64": "2.1.1",
|
|
16
|
+
"repomap-bin-windows-x64": "2.1.1"
|
|
17
17
|
},
|
|
18
18
|
"engines": {
|
|
19
19
|
"node": ">=18"
|
package/run.js
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { execFileSync } from "node:child_process";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
2
3
|
import { existsSync } from "node:fs";
|
|
3
4
|
import { join, dirname } from "node:path";
|
|
4
5
|
import { fileURLToPath } from "node:url";
|
|
5
6
|
|
|
6
7
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const localRequire = createRequire(import.meta.url);
|
|
7
9
|
|
|
8
10
|
function findBinary() {
|
|
9
11
|
const platform = process.platform;
|
|
10
12
|
const arch = process.arch;
|
|
13
|
+
const binName = platform === "win32" ? "repomap.exe" : "repomap";
|
|
14
|
+
|
|
15
|
+
// 1. Check repo dist/ directory (local development)
|
|
16
|
+
const repoBin = join(__dirname, "..", "..", "dist", binName);
|
|
17
|
+
if (existsSync(repoBin)) return repoBin;
|
|
11
18
|
|
|
19
|
+
// 2. Resolve platform package via Node module resolution (handles hoisted, npx, yarn, pnpm)
|
|
12
20
|
const platformPackages = {
|
|
13
21
|
"linux-x64": { pkg: "repomap-bin-linux-x64", bin: "repomap" },
|
|
14
22
|
"darwin-arm64": { pkg: "repomap-bin-darwin-arm64", bin: "repomap" },
|
|
@@ -18,15 +26,19 @@ function findBinary() {
|
|
|
18
26
|
const key = `${platform}-${arch}`;
|
|
19
27
|
const info = platformPackages[key];
|
|
20
28
|
if (info) {
|
|
21
|
-
|
|
22
|
-
|
|
29
|
+
try {
|
|
30
|
+
const pkgJson = localRequire.resolve(`${info.pkg}/package.json`);
|
|
31
|
+
const candidate = join(dirname(pkgJson), info.bin);
|
|
32
|
+
if (existsSync(candidate)) return candidate;
|
|
33
|
+
} catch { /* not resolvable */ }
|
|
34
|
+
|
|
35
|
+
// Non-hoisted: inside repomap-bin's own node_modules
|
|
36
|
+
const nested = join(__dirname, "node_modules", info.pkg, info.bin);
|
|
37
|
+
if (existsSync(nested)) return nested;
|
|
23
38
|
}
|
|
24
39
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (existsSync(fallback)) return fallback;
|
|
28
|
-
|
|
29
|
-
return null;
|
|
40
|
+
// 3. PATH fallback
|
|
41
|
+
return binName;
|
|
30
42
|
}
|
|
31
43
|
|
|
32
44
|
const binaryPath = findBinary();
|
|
@@ -34,8 +46,7 @@ const binaryPath = findBinary();
|
|
|
34
46
|
if (!binaryPath) {
|
|
35
47
|
console.error(
|
|
36
48
|
"repomap binary not found for this platform.\n" +
|
|
37
|
-
"Try: npm install repomap-bin
|
|
38
|
-
"Or: pip install repomap-cli"
|
|
49
|
+
"Try: npm install repomap-bin"
|
|
39
50
|
);
|
|
40
51
|
process.exit(1);
|
|
41
52
|
}
|