@codebolt/gotui 1.11.0

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.
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Resolve the path to the gotui binary.
3
+ *
4
+ * Resolution order:
5
+ * 1. CODEBOLT_GOTUI_BINARY env var
6
+ * 2. Platform-specific npm package (@codebolt/gotui-{os}-{arch})
7
+ * 3. PATH lookup via `which`
8
+ */
9
+ export declare function resolveBinary(): string | null;
10
+ //# sourceMappingURL=binary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary.d.ts","sourceRoot":"","sources":["../src/binary.ts"],"names":[],"mappings":"AAOA;;;;;;;GAOG;AACH,wBAAgB,aAAa,IAAI,MAAM,GAAG,IAAI,CAuB7C"}
package/dist/binary.js ADDED
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveBinary = resolveBinary;
4
+ const child_process_1 = require("child_process");
5
+ const fs_1 = require("fs");
6
+ const path_1 = require("path");
7
+ const BINARY_NAME = process.platform === 'win32' ? 'gotui.exe' : 'gotui';
8
+ /**
9
+ * Resolve the path to the gotui binary.
10
+ *
11
+ * Resolution order:
12
+ * 1. CODEBOLT_GOTUI_BINARY env var
13
+ * 2. Platform-specific npm package (@codebolt/gotui-{os}-{arch})
14
+ * 3. PATH lookup via `which`
15
+ */
16
+ function resolveBinary() {
17
+ // 1. Environment variable
18
+ const envPath = process.env.CODEBOLT_GOTUI_BINARY;
19
+ if (envPath) {
20
+ if (!(0, fs_1.existsSync)(envPath)) {
21
+ return null;
22
+ }
23
+ return envPath;
24
+ }
25
+ // 2. Platform-specific npm package
26
+ const platformPath = resolvePlatformPackage();
27
+ if (platformPath) {
28
+ return platformPath;
29
+ }
30
+ // 3. PATH lookup
31
+ const pathResult = resolveFromPath();
32
+ if (pathResult) {
33
+ return pathResult;
34
+ }
35
+ return null;
36
+ }
37
+ function resolvePlatformPackage() {
38
+ const platform = process.platform;
39
+ const arch = process.arch;
40
+ const packageName = `@codebolt/gotui-${platform}-${arch}`;
41
+ try {
42
+ const pkgJson = require.resolve(`${packageName}/package.json`);
43
+ const pkgDir = (0, path_1.dirname)(pkgJson);
44
+ let binaryPath = (0, path_1.join)(pkgDir, 'bin', BINARY_NAME);
45
+ if (binaryPath.includes('app.asar')) {
46
+ binaryPath = binaryPath.replace('app.asar', 'app.asar.unpacked');
47
+ }
48
+ if ((0, fs_1.existsSync)(binaryPath)) {
49
+ return binaryPath;
50
+ }
51
+ }
52
+ catch {
53
+ // Package not installed
54
+ }
55
+ return null;
56
+ }
57
+ function resolveFromPath() {
58
+ try {
59
+ const cmd = process.platform === 'win32' ? 'where' : 'which';
60
+ const result = (0, child_process_1.execFileSync)(cmd, [BINARY_NAME], {
61
+ encoding: 'utf8',
62
+ stdio: ['pipe', 'pipe', 'pipe'],
63
+ });
64
+ const resolved = result.trim().split('\n')[0];
65
+ if (resolved && (0, fs_1.existsSync)(resolved)) {
66
+ return resolved;
67
+ }
68
+ }
69
+ catch {
70
+ // Not found on PATH
71
+ }
72
+ return null;
73
+ }
74
+ //# sourceMappingURL=binary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary.js","sourceRoot":"","sources":["../src/binary.ts"],"names":[],"mappings":";;AAeA,sCAuBC;AAtCD,iDAA6C;AAC7C,2BAAgC;AAChC,+BAAqC;AAErC,MAAM,WAAW,GACf,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC;AAEvD;;;;;;;GAOG;AACH,SAAgB,aAAa;IAC3B,0BAA0B;IAC1B,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;IAClD,IAAI,OAAO,EAAE,CAAC;QACZ,IAAI,CAAC,IAAA,eAAU,EAAC,OAAO,CAAC,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC;QACd,CAAC;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AG,IAAA,4BAAY,EAAC,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE;YAC9C,QAAQ,EAAE,MAAM;YAChB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;SAChC,CAAC,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9C,IAAI,QAAQ,IAAI,IAAA,eAAU,EAAC,QAAQ,CAAC,EAAE,CAAC;YACrC,OAAO,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,oBAAoB;IACtB,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { resolveBinary } from './binary';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveBinary = void 0;
4
+ var binary_1 = require("./binary");
5
+ Object.defineProperty(exports, "resolveBinary", { enumerable: true, get: function () { return binary_1.resolveBinary; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAAyC;AAAhC,uGAAA,aAAa,OAAA"}
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@codebolt/gotui",
3
+ "version": "1.11.0",
4
+ "description": "Resolver for the gotui TUI binary",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "build:native": "cd ../gotui && bash scripts/build-platform-pkg.sh",
10
+ "clean": "rm -rf dist"
11
+ },
12
+ "engines": {
13
+ "node": ">=16.0.0"
14
+ },
15
+ "files": [
16
+ "dist/**/*"
17
+ ],
18
+ "optionalDependencies": {
19
+ "@codebolt/gotui-darwin-arm64": "1.11.0",
20
+ "@codebolt/gotui-darwin-x64": "1.11.0",
21
+ "@codebolt/gotui-linux-x64": "1.11.0",
22
+ "@codebolt/gotui-linux-arm64": "1.11.0",
23
+ "@codebolt/gotui-win32-x64": "1.11.0"
24
+ },
25
+ "license": "MIT"
26
+ }