@usevaulta/vexa 0.0.0-stage → 0.1.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.
- package/LICENSE +54 -0
- package/README.md +60 -2
- package/dist/cli.cjs +358 -0
- package/dist/index.cjs +388 -0
- package/dist/index.d.ts +1 -0
- package/package.json +50 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
PROPRIETARY AND CONFIDENTIAL SOFTWARE LICENSE
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vaulta. All rights reserved.
|
|
4
|
+
|
|
5
|
+
NOTICE TO USER:
|
|
6
|
+
This software, source code, documentation, specifications, and associated digital
|
|
7
|
+
assets ("Software") are proprietary and confidential property of Vaulta ("Licensor").
|
|
8
|
+
The Software is licensed, not sold, and is protected by copyright laws, international
|
|
9
|
+
treaty provisions, trade secret laws, and other applicable intellectual property laws.
|
|
10
|
+
|
|
11
|
+
1. PROPRIETARY AND CLOSED-SOURCE NATURE
|
|
12
|
+
This Software is strictly closed-source and proprietary. No open-source license,
|
|
13
|
+
public grant, or implied rights of any kind are conveyed by access to, possession
|
|
14
|
+
of, or evaluation of this repository, source code, binaries, or documentation.
|
|
15
|
+
|
|
16
|
+
2. RESTRICTIONS
|
|
17
|
+
Except as expressly authorized under a separate, valid, written commercial license
|
|
18
|
+
agreement executed directly with Licensor, you may NOT:
|
|
19
|
+
(a) Copy, distribute, publish, sublicense, rent, lease, or transfer the Software
|
|
20
|
+
or any portion thereof;
|
|
21
|
+
(b) Decompile, reverse engineer, disassemble, decrypt, or otherwise attempt to
|
|
22
|
+
derive the source code, underlying ideas, algorithms, or protocols of the
|
|
23
|
+
Software, except to the extent mandatory law expressly prohibits such restriction;
|
|
24
|
+
(c) Modify, adapt, translate, enhance, or create derivative works based upon the
|
|
25
|
+
Software;
|
|
26
|
+
(d) Use the Software for commercial operations, automated multi-device execution,
|
|
27
|
+
or service-bureau arrangements without an active commercial license tier;
|
|
28
|
+
(e) Remove, alter, or obscure any copyright, trademark, confidentiality, or other
|
|
29
|
+
proprietary notices displayed in or on the Software.
|
|
30
|
+
|
|
31
|
+
3. CONFIDENTIALITY
|
|
32
|
+
Any non-public source code, protocols, security mechanisms, API definitions,
|
|
33
|
+
and architectural designs contained within this repository constitute trade
|
|
34
|
+
secrets of Licensor. You agree to hold all such confidential information in
|
|
35
|
+
strict confidence and prevent unauthorized disclosure or dissemination.
|
|
36
|
+
|
|
37
|
+
4. RESERVATION OF RIGHTS
|
|
38
|
+
Licensor retains all right, title, and interest in and to the Software, including
|
|
39
|
+
all worldwide copyrights, patents, trade secrets, trademarks, and other intellectual
|
|
40
|
+
property rights. All rights not expressly granted under an executed commercial
|
|
41
|
+
agreement are reserved by Licensor.
|
|
42
|
+
|
|
43
|
+
5. DISCLAIMER OF WARRANTIES & LIMITATION OF LIABILITY
|
|
44
|
+
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE SOFTWARE IS PROVIDED
|
|
45
|
+
"AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
|
46
|
+
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
|
|
47
|
+
TITLE, AND NON-INFRINGEMENT. IN NO EVENT SHALL LICENSOR BE LIABLE FOR ANY CLAIM,
|
|
48
|
+
DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE,
|
|
49
|
+
ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
50
|
+
DEALINGS IN THE SOFTWARE.
|
|
51
|
+
|
|
52
|
+
For licensing inquiries, commercial terms, or access authorization:
|
|
53
|
+
Portal: https://usevaulta.site
|
|
54
|
+
Repository: https://github.com/usevaulta/vaulta
|
package/README.md
CHANGED
|
@@ -1,3 +1,61 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @usevaulta/vexa
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Native Rust CLI toolchain for GPUI desktop applications — `build`, `bundle`,
|
|
4
|
+
`release`, `dev`, and diagnostics for Vexa projects.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install --save-dev @usevaulta/vexa
|
|
10
|
+
npx vexa --help
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The package installs the matching platform binary from one of 11
|
|
14
|
+
`@usevaulta/vexa-<platform>` packages as an optional dependency. Nothing is built at
|
|
15
|
+
install time and no Rust toolchain is required.
|
|
16
|
+
|
|
17
|
+
|Platform|Package|
|
|
18
|
+
|---|---|
|
|
19
|
+
|Windows x64|`@usevaulta/vexa-win32-x64-msvc`|
|
|
20
|
+
|Windows x86|`@usevaulta/vexa-win32-ia32-msvc`|
|
|
21
|
+
|Windows ARM64|`@usevaulta/vexa-win32-arm64-msvc`|
|
|
22
|
+
|macOS Intel|`@usevaulta/vexa-darwin-x64`|
|
|
23
|
+
|macOS Apple silicon|`@usevaulta/vexa-darwin-arm64`|
|
|
24
|
+
|Linux x64 glibc|`@usevaulta/vexa-linux-x64-gnu`|
|
|
25
|
+
|Linux x64 musl (Alpine)|`@usevaulta/vexa-linux-x64-musl`|
|
|
26
|
+
|Linux ARM64 glibc|`@usevaulta/vexa-linux-arm64-gnu`|
|
|
27
|
+
|Linux ARM64 musl|`@usevaulta/vexa-linux-arm64-musl`|
|
|
28
|
+
|Linux ARMv7 / RISC-V 64|`@usevaulta/vexa-linux-arm-gnueabihf`, `@usevaulta/vexa-linux-riscv64-gnu`|
|
|
29
|
+
|
|
30
|
+
## Use
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npx vexa build --release # compile and report artifacts
|
|
34
|
+
npx vexa bundle my-app --target inno
|
|
35
|
+
npx vexa doctor # verify host toolchain
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Programmatic use:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { run, resolveBinary, platformTarget } from "@usevaulta/vexa";
|
|
42
|
+
|
|
43
|
+
const binary = resolveBinary(); // absolute path to the native CLI
|
|
44
|
+
const target = platformTarget(); // { suffix: "linux-x64-gnu", ... }
|
|
45
|
+
const code = await run(["build", "--release"]);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Behaviour
|
|
49
|
+
|
|
50
|
+
- Spawns the native binary with inherited stdio, so progress output, colours,
|
|
51
|
+
and TTY detection match a direct invocation.
|
|
52
|
+
- Propagates the child's exit code; a signal-terminated child maps to
|
|
53
|
+
`128 + signal`.
|
|
54
|
+
- Sets `VEXA_CLI_BIN_NAME` so `--help` shows the wrapper you invoked
|
|
55
|
+
(`npx vexa`, `pnpm vexa`, …).
|
|
56
|
+
- `VEXA_BINARY_PATH` overrides binary resolution (useful for testing a locally
|
|
57
|
+
built `vexa`).
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
|
+
See `LICENSE`.
|
package/dist/cli.cjs
ADDED
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
let node_child_process = require("node:child_process");
|
|
3
|
+
let node_module = require("node:module");
|
|
4
|
+
let node_fs = require("node:fs");
|
|
5
|
+
let node_path = require("node:path");
|
|
6
|
+
// src/platform.ts
|
|
7
|
+
const WINDOWS_BINARY = "vexa.exe";
|
|
8
|
+
const UNIX_BINARY = "vexa";
|
|
9
|
+
/** All 11 published platform packages, in publish order. */
|
|
10
|
+
const PLATFORM_TARGETS = [
|
|
11
|
+
{
|
|
12
|
+
packageName: "@usevaulta/vexa-win32-x64-msvc",
|
|
13
|
+
suffix: "win32-x64-msvc",
|
|
14
|
+
rustTarget: "x86_64-pc-windows-msvc",
|
|
15
|
+
platform: "win32",
|
|
16
|
+
arch: "x64",
|
|
17
|
+
binaryName: WINDOWS_BINARY,
|
|
18
|
+
osField: "win32",
|
|
19
|
+
cpuField: "x64"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
packageName: "@usevaulta/vexa-win32-ia32-msvc",
|
|
23
|
+
suffix: "win32-ia32-msvc",
|
|
24
|
+
rustTarget: "i686-pc-windows-msvc",
|
|
25
|
+
platform: "win32",
|
|
26
|
+
arch: "ia32",
|
|
27
|
+
binaryName: WINDOWS_BINARY,
|
|
28
|
+
osField: "win32",
|
|
29
|
+
cpuField: "ia32"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
packageName: "@usevaulta/vexa-win32-arm64-msvc",
|
|
33
|
+
suffix: "win32-arm64-msvc",
|
|
34
|
+
rustTarget: "aarch64-pc-windows-msvc",
|
|
35
|
+
platform: "win32",
|
|
36
|
+
arch: "arm64",
|
|
37
|
+
binaryName: WINDOWS_BINARY,
|
|
38
|
+
osField: "win32",
|
|
39
|
+
cpuField: "arm64"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
packageName: "@usevaulta/vexa-darwin-x64",
|
|
43
|
+
suffix: "darwin-x64",
|
|
44
|
+
rustTarget: "x86_64-apple-darwin",
|
|
45
|
+
platform: "darwin",
|
|
46
|
+
arch: "x64",
|
|
47
|
+
binaryName: UNIX_BINARY,
|
|
48
|
+
osField: "darwin",
|
|
49
|
+
cpuField: "x64"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
packageName: "@usevaulta/vexa-darwin-arm64",
|
|
53
|
+
suffix: "darwin-arm64",
|
|
54
|
+
rustTarget: "aarch64-apple-darwin",
|
|
55
|
+
platform: "darwin",
|
|
56
|
+
arch: "arm64",
|
|
57
|
+
binaryName: UNIX_BINARY,
|
|
58
|
+
osField: "darwin",
|
|
59
|
+
cpuField: "arm64"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
packageName: "@usevaulta/vexa-linux-x64-gnu",
|
|
63
|
+
suffix: "linux-x64-gnu",
|
|
64
|
+
rustTarget: "x86_64-unknown-linux-gnu",
|
|
65
|
+
platform: "linux",
|
|
66
|
+
arch: "x64",
|
|
67
|
+
libc: "glibc",
|
|
68
|
+
binaryName: UNIX_BINARY,
|
|
69
|
+
osField: "linux",
|
|
70
|
+
cpuField: "x64"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
packageName: "@usevaulta/vexa-linux-x64-musl",
|
|
74
|
+
suffix: "linux-x64-musl",
|
|
75
|
+
rustTarget: "x86_64-unknown-linux-musl",
|
|
76
|
+
platform: "linux",
|
|
77
|
+
arch: "x64",
|
|
78
|
+
libc: "musl",
|
|
79
|
+
binaryName: UNIX_BINARY,
|
|
80
|
+
osField: "linux",
|
|
81
|
+
cpuField: "x64"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
packageName: "@usevaulta/vexa-linux-arm64-gnu",
|
|
85
|
+
suffix: "linux-arm64-gnu",
|
|
86
|
+
rustTarget: "aarch64-unknown-linux-gnu",
|
|
87
|
+
platform: "linux",
|
|
88
|
+
arch: "arm64",
|
|
89
|
+
libc: "glibc",
|
|
90
|
+
binaryName: UNIX_BINARY,
|
|
91
|
+
osField: "linux",
|
|
92
|
+
cpuField: "arm64"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
packageName: "@usevaulta/vexa-linux-arm64-musl",
|
|
96
|
+
suffix: "linux-arm64-musl",
|
|
97
|
+
rustTarget: "aarch64-unknown-linux-musl",
|
|
98
|
+
platform: "linux",
|
|
99
|
+
arch: "arm64",
|
|
100
|
+
libc: "musl",
|
|
101
|
+
binaryName: UNIX_BINARY,
|
|
102
|
+
osField: "linux",
|
|
103
|
+
cpuField: "arm64"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
packageName: "@usevaulta/vexa-linux-arm-gnueabihf",
|
|
107
|
+
suffix: "linux-arm-gnueabihf",
|
|
108
|
+
rustTarget: "armv7-unknown-linux-gnueabihf",
|
|
109
|
+
platform: "linux",
|
|
110
|
+
arch: "arm",
|
|
111
|
+
libc: "glibc",
|
|
112
|
+
binaryName: UNIX_BINARY,
|
|
113
|
+
osField: "linux",
|
|
114
|
+
cpuField: "arm"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
packageName: "@usevaulta/vexa-linux-riscv64-gnu",
|
|
118
|
+
suffix: "linux-riscv64-gnu",
|
|
119
|
+
rustTarget: "riscv64gc-unknown-linux-gnu",
|
|
120
|
+
platform: "linux",
|
|
121
|
+
arch: "riscv64",
|
|
122
|
+
libc: "glibc",
|
|
123
|
+
binaryName: UNIX_BINARY,
|
|
124
|
+
osField: "linux",
|
|
125
|
+
cpuField: "riscv64"
|
|
126
|
+
}
|
|
127
|
+
];
|
|
128
|
+
/** Looks up the package for an explicit tuple. */
|
|
129
|
+
function findPlatformTarget(platform, arch, libc) {
|
|
130
|
+
return PLATFORM_TARGETS.find((target) => target.platform === platform && target.arch === arch && (target.libc === void 0 ? true : target.libc === libc));
|
|
131
|
+
}
|
|
132
|
+
/** Resolves the platform target for the current (or injected) process. */
|
|
133
|
+
function resolvePlatformTarget(platform, arch, muslOverride) {
|
|
134
|
+
if (platform === "linux") {
|
|
135
|
+
const libc = muslOverride ? "musl" : "glibc";
|
|
136
|
+
const target = findPlatformTarget(platform, arch, libc);
|
|
137
|
+
if (target === void 0) throw new Error(`@usevaulta/vexa does not ship a binary for linux/${arch} (${libc}).\nSupported: ${PLATFORM_TARGETS.filter((t) => t.platform === "linux").map((t) => t.suffix).join(", ")}`);
|
|
138
|
+
return target;
|
|
139
|
+
}
|
|
140
|
+
const target = findPlatformTarget(platform, arch);
|
|
141
|
+
if (target === void 0) throw new Error(`@usevaulta/vexa does not ship a binary for ${platform}/${arch}.\nSupported: ${PLATFORM_TARGETS.map((t) => t.suffix).join(", ")}`);
|
|
142
|
+
return target;
|
|
143
|
+
}
|
|
144
|
+
// src/launcher.ts
|
|
145
|
+
/**
|
|
146
|
+
* Native-binary resolution for the `@usevaulta/vexa` launcher.
|
|
147
|
+
*
|
|
148
|
+
* Resolution order:
|
|
149
|
+
* 1. `VEXA_BINARY_PATH` — explicit override, used by tests and CI.
|
|
150
|
+
* 2. A locally staged `platforms/<suffix>/bin/<binary>` (monorepo checkouts).
|
|
151
|
+
* 3. The installed `@usevaulta/vexa-<suffix>` optional dependency.
|
|
152
|
+
*/
|
|
153
|
+
/** Raised when no native binary can be located for this platform. */
|
|
154
|
+
var BinaryResolutionError = class extends Error {
|
|
155
|
+
constructor(message, options) {
|
|
156
|
+
super(message, options);
|
|
157
|
+
this.name = "BinaryResolutionError";
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
/** Narrows an unknown value to a plain object record. */
|
|
161
|
+
function isRecord(value) {
|
|
162
|
+
return typeof value === "object" && value !== null;
|
|
163
|
+
}
|
|
164
|
+
/** Reads `stderr` off a failed `execFileSync` without trusting its shape. */
|
|
165
|
+
function stderrOf(error) {
|
|
166
|
+
if (!isRecord(error) || !("stderr" in error)) return;
|
|
167
|
+
const stderr = error["stderr"];
|
|
168
|
+
if (typeof stderr === "string") return stderr;
|
|
169
|
+
if (Buffer.isBuffer(stderr)) return stderr.toString();
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Detects whether the current Linux host uses musl instead of glibc.
|
|
173
|
+
*
|
|
174
|
+
* Three independent signals, cheapest first: musl loader files, the Node.js
|
|
175
|
+
* process report (a glibc version is absent on musl builds), then `ldd --version`.
|
|
176
|
+
*/
|
|
177
|
+
function detectMusl() {
|
|
178
|
+
if ([
|
|
179
|
+
"/lib/ld-musl-x86_64.so.1",
|
|
180
|
+
"/lib/ld-musl-aarch64.so.1",
|
|
181
|
+
"/lib/libc.musl-x86_64.so.1"
|
|
182
|
+
].some((path) => (0, node_fs.existsSync)(path))) return true;
|
|
183
|
+
try {
|
|
184
|
+
const report = process.report?.getReport();
|
|
185
|
+
if (isRecord(report) && isRecord(report["header"])) {
|
|
186
|
+
if (!("glibcVersionRuntime" in report["header"])) return true;
|
|
187
|
+
}
|
|
188
|
+
} catch {}
|
|
189
|
+
try {
|
|
190
|
+
const banner = (0, node_child_process.execFileSync)("ldd", ["--version"], {
|
|
191
|
+
encoding: "utf8",
|
|
192
|
+
stdio: [
|
|
193
|
+
"ignore",
|
|
194
|
+
"pipe",
|
|
195
|
+
"pipe"
|
|
196
|
+
]
|
|
197
|
+
});
|
|
198
|
+
return /musl/i.test(banner);
|
|
199
|
+
} catch (error) {
|
|
200
|
+
const stderr = stderrOf(error);
|
|
201
|
+
return stderr !== void 0 && /musl/i.test(stderr);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
/** Whether the resolved host needs the musl build. */
|
|
205
|
+
function hostLibc(options = {}) {
|
|
206
|
+
const platform = options.platform ?? process.platform;
|
|
207
|
+
if (options.musl !== void 0) return options.musl ? "musl" : "glibc";
|
|
208
|
+
return platform === "linux" && detectMusl() ? "musl" : "glibc";
|
|
209
|
+
}
|
|
210
|
+
/** Resolves the platform target for this host. */
|
|
211
|
+
function hostTarget(options = {}) {
|
|
212
|
+
const platform = options.platform ?? process.platform;
|
|
213
|
+
const arch = options.arch ?? process.arch;
|
|
214
|
+
if (platform === "linux") return resolvePlatformTarget(platform, arch, hostLibc(options) === "musl");
|
|
215
|
+
return resolvePlatformTarget(platform, arch);
|
|
216
|
+
}
|
|
217
|
+
function stagedBinaryPath(target, options) {
|
|
218
|
+
const launcherDir = options.launcherDir ?? __dirname;
|
|
219
|
+
const root = (0, node_path.dirname)(launcherDir);
|
|
220
|
+
return [(0, node_path.join)(root, "platforms", target.suffix, "bin", target.binaryName), (0, node_path.join)(launcherDir, "platforms", target.suffix, "bin", target.binaryName)].find((candidate) => (0, node_fs.existsSync)(candidate));
|
|
221
|
+
}
|
|
222
|
+
function installedBinaryPath(target) {
|
|
223
|
+
const require$1 = (0, node_module.createRequire)(__filename);
|
|
224
|
+
let packageJson;
|
|
225
|
+
try {
|
|
226
|
+
packageJson = require$1.resolve(`${target.packageName}/package.json`);
|
|
227
|
+
} catch (error) {
|
|
228
|
+
const installed = PLATFORM_TARGETS.filter((candidate) => isInstalled(candidate.packageName)).map((candidate) => candidate.suffix);
|
|
229
|
+
const hint = installed.length > 0 ? `Installed platform packages: ${installed.join(", ")} (expected ${target.suffix}).` : "No platform package is installed; the optional dependency may have been skipped.";
|
|
230
|
+
throw new BinaryResolutionError(`Could not find the \`${target.packageName}\` package.\n${hint}\nReinstall with optional dependencies enabled, or set VEXA_BINARY_PATH.`, { cause: error });
|
|
231
|
+
}
|
|
232
|
+
const binary = (0, node_path.join)((0, node_path.dirname)(packageJson), "bin", target.binaryName);
|
|
233
|
+
return (0, node_fs.existsSync)(binary) ? binary : void 0;
|
|
234
|
+
}
|
|
235
|
+
function isInstalled(packageName) {
|
|
236
|
+
try {
|
|
237
|
+
(0, node_module.createRequire)(__filename).resolve(`${packageName}/package.json`);
|
|
238
|
+
return true;
|
|
239
|
+
} catch {
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
/** Resolves the native `vexa` binary for this host. */
|
|
244
|
+
function resolveBinaryPath(options = {}) {
|
|
245
|
+
const env = options.env ?? process.env;
|
|
246
|
+
const target = hostTarget(options);
|
|
247
|
+
const override = env["VEXA_BINARY_PATH"];
|
|
248
|
+
if (override !== void 0 && override.trim() !== "") return {
|
|
249
|
+
path: override,
|
|
250
|
+
target
|
|
251
|
+
};
|
|
252
|
+
const staged = stagedBinaryPath(target, options);
|
|
253
|
+
if (staged !== void 0) return {
|
|
254
|
+
path: staged,
|
|
255
|
+
target
|
|
256
|
+
};
|
|
257
|
+
const installed = installedBinaryPath(target);
|
|
258
|
+
if (installed === void 0) throw new BinaryResolutionError(`\`${target.packageName}\` is installed but does not contain bin/${target.binaryName}.`);
|
|
259
|
+
return {
|
|
260
|
+
path: installed,
|
|
261
|
+
target
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
// src/cli.ts
|
|
265
|
+
/**
|
|
266
|
+
* CLI entry point used by the `vexa` bin shim.
|
|
267
|
+
*
|
|
268
|
+
* Spawns the native binary with inherited stdio so colours, TTY detection, and
|
|
269
|
+
* progress output behave exactly as when running `vexa` directly, then mirrors
|
|
270
|
+
* its exit code (and terminating signal) to the caller.
|
|
271
|
+
*/
|
|
272
|
+
/**
|
|
273
|
+
* Derives the program name the user invoked, so `--help` prints the wrapper
|
|
274
|
+
* (`npx @usevaulta/vexa`) rather than the internal binary path.
|
|
275
|
+
*/
|
|
276
|
+
function detectBinName(argv, env) {
|
|
277
|
+
const fromEnv = env["VEXA_CLI_BIN_NAME"];
|
|
278
|
+
if (fromEnv !== void 0 && fromEnv.trim() !== "") return fromEnv;
|
|
279
|
+
const invoked = argv[1];
|
|
280
|
+
if (invoked === void 0) return;
|
|
281
|
+
if (invoked.endsWith("vexa.js") || invoked.endsWith("cli.cjs")) {
|
|
282
|
+
const npmExecPath = env["npm_execpath"];
|
|
283
|
+
if (npmExecPath !== void 0 && npmExecPath.includes("pnpm")) return "pnpm vexa";
|
|
284
|
+
if (npmExecPath !== void 0 && npmExecPath.includes("yarn")) return "yarn vexa";
|
|
285
|
+
if (env["npm_config_user_agent"]?.startsWith("npm/") === true) return "npx vexa";
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
/** Spawns the native binary, returning its status without exiting. */
|
|
290
|
+
function launch(args, options = {}) {
|
|
291
|
+
const env = {
|
|
292
|
+
...process.env,
|
|
293
|
+
...options.env
|
|
294
|
+
};
|
|
295
|
+
const resolved = resolveBinaryPath({
|
|
296
|
+
...options,
|
|
297
|
+
env
|
|
298
|
+
});
|
|
299
|
+
const binName = detectBinName([process.argv[0] ?? "", process.argv[1] ?? ""], env);
|
|
300
|
+
const childEnv = { ...env };
|
|
301
|
+
if (binName !== void 0) childEnv["VEXA_CLI_BIN_NAME"] = binName;
|
|
302
|
+
const result = (0, node_child_process.spawnSync)(resolved.path, [...args], {
|
|
303
|
+
stdio: "inherit",
|
|
304
|
+
shell: false,
|
|
305
|
+
env: childEnv,
|
|
306
|
+
windowsHide: false
|
|
307
|
+
});
|
|
308
|
+
if (result.error !== void 0) throw new BinaryResolutionError(`Failed to execute ${resolved.path}: ${result.error.message}`, { cause: result.error });
|
|
309
|
+
return {
|
|
310
|
+
status: result.status,
|
|
311
|
+
signal: result.signal,
|
|
312
|
+
binary: resolved.path
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
/** Runs the CLI and returns the exit code to hand to `process.exit`. */
|
|
316
|
+
function runCli(args, options = {}) {
|
|
317
|
+
const { status, signal } = launch(args, options);
|
|
318
|
+
if (status !== null) return status;
|
|
319
|
+
if (signal !== null) return 128 + (SIGNAL_NUMBERS[signal] ?? 1);
|
|
320
|
+
return 0;
|
|
321
|
+
}
|
|
322
|
+
const SIGNAL_NUMBERS = {
|
|
323
|
+
SIGHUP: 1,
|
|
324
|
+
SIGINT: 2,
|
|
325
|
+
SIGQUIT: 3,
|
|
326
|
+
SIGILL: 4,
|
|
327
|
+
SIGTRAP: 5,
|
|
328
|
+
SIGABRT: 6,
|
|
329
|
+
SIGBUS: 7,
|
|
330
|
+
SIGFPE: 8,
|
|
331
|
+
SIGKILL: 9,
|
|
332
|
+
SIGUSR1: 10,
|
|
333
|
+
SIGSEGV: 11,
|
|
334
|
+
SIGUSR2: 12,
|
|
335
|
+
SIGPIPE: 13,
|
|
336
|
+
SIGALRM: 14,
|
|
337
|
+
SIGTERM: 15
|
|
338
|
+
};
|
|
339
|
+
// src/entry.ts
|
|
340
|
+
/**
|
|
341
|
+
* `vexa` bin shim: forwards argv to the native binary and mirrors its exit code.
|
|
342
|
+
*
|
|
343
|
+
* Compiled from `src/entry.ts` to `dist/cli.cjs`; kept in TypeScript so the
|
|
344
|
+
* launcher logic stays type-checked under `tsc --noEmit`.
|
|
345
|
+
*/
|
|
346
|
+
function main() {
|
|
347
|
+
try {
|
|
348
|
+
process.exitCode = runCli(process.argv.slice(2));
|
|
349
|
+
} catch (error) {
|
|
350
|
+
if (error instanceof BinaryResolutionError) {
|
|
351
|
+
process.stderr.write(`error: ${error.message}\n`);
|
|
352
|
+
process.exitCode = 1;
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
throw error;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
main();
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let node_child_process = require("node:child_process");
|
|
3
|
+
let node_module = require("node:module");
|
|
4
|
+
let node_fs = require("node:fs");
|
|
5
|
+
let node_path = require("node:path");
|
|
6
|
+
// src/platform.ts
|
|
7
|
+
const WINDOWS_BINARY = "vexa.exe";
|
|
8
|
+
const UNIX_BINARY = "vexa";
|
|
9
|
+
/** All 11 published platform packages, in publish order. */
|
|
10
|
+
const PLATFORM_TARGETS = [
|
|
11
|
+
{
|
|
12
|
+
packageName: "@usevaulta/vexa-win32-x64-msvc",
|
|
13
|
+
suffix: "win32-x64-msvc",
|
|
14
|
+
rustTarget: "x86_64-pc-windows-msvc",
|
|
15
|
+
platform: "win32",
|
|
16
|
+
arch: "x64",
|
|
17
|
+
binaryName: WINDOWS_BINARY,
|
|
18
|
+
osField: "win32",
|
|
19
|
+
cpuField: "x64"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
packageName: "@usevaulta/vexa-win32-ia32-msvc",
|
|
23
|
+
suffix: "win32-ia32-msvc",
|
|
24
|
+
rustTarget: "i686-pc-windows-msvc",
|
|
25
|
+
platform: "win32",
|
|
26
|
+
arch: "ia32",
|
|
27
|
+
binaryName: WINDOWS_BINARY,
|
|
28
|
+
osField: "win32",
|
|
29
|
+
cpuField: "ia32"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
packageName: "@usevaulta/vexa-win32-arm64-msvc",
|
|
33
|
+
suffix: "win32-arm64-msvc",
|
|
34
|
+
rustTarget: "aarch64-pc-windows-msvc",
|
|
35
|
+
platform: "win32",
|
|
36
|
+
arch: "arm64",
|
|
37
|
+
binaryName: WINDOWS_BINARY,
|
|
38
|
+
osField: "win32",
|
|
39
|
+
cpuField: "arm64"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
packageName: "@usevaulta/vexa-darwin-x64",
|
|
43
|
+
suffix: "darwin-x64",
|
|
44
|
+
rustTarget: "x86_64-apple-darwin",
|
|
45
|
+
platform: "darwin",
|
|
46
|
+
arch: "x64",
|
|
47
|
+
binaryName: UNIX_BINARY,
|
|
48
|
+
osField: "darwin",
|
|
49
|
+
cpuField: "x64"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
packageName: "@usevaulta/vexa-darwin-arm64",
|
|
53
|
+
suffix: "darwin-arm64",
|
|
54
|
+
rustTarget: "aarch64-apple-darwin",
|
|
55
|
+
platform: "darwin",
|
|
56
|
+
arch: "arm64",
|
|
57
|
+
binaryName: UNIX_BINARY,
|
|
58
|
+
osField: "darwin",
|
|
59
|
+
cpuField: "arm64"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
packageName: "@usevaulta/vexa-linux-x64-gnu",
|
|
63
|
+
suffix: "linux-x64-gnu",
|
|
64
|
+
rustTarget: "x86_64-unknown-linux-gnu",
|
|
65
|
+
platform: "linux",
|
|
66
|
+
arch: "x64",
|
|
67
|
+
libc: "glibc",
|
|
68
|
+
binaryName: UNIX_BINARY,
|
|
69
|
+
osField: "linux",
|
|
70
|
+
cpuField: "x64"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
packageName: "@usevaulta/vexa-linux-x64-musl",
|
|
74
|
+
suffix: "linux-x64-musl",
|
|
75
|
+
rustTarget: "x86_64-unknown-linux-musl",
|
|
76
|
+
platform: "linux",
|
|
77
|
+
arch: "x64",
|
|
78
|
+
libc: "musl",
|
|
79
|
+
binaryName: UNIX_BINARY,
|
|
80
|
+
osField: "linux",
|
|
81
|
+
cpuField: "x64"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
packageName: "@usevaulta/vexa-linux-arm64-gnu",
|
|
85
|
+
suffix: "linux-arm64-gnu",
|
|
86
|
+
rustTarget: "aarch64-unknown-linux-gnu",
|
|
87
|
+
platform: "linux",
|
|
88
|
+
arch: "arm64",
|
|
89
|
+
libc: "glibc",
|
|
90
|
+
binaryName: UNIX_BINARY,
|
|
91
|
+
osField: "linux",
|
|
92
|
+
cpuField: "arm64"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
packageName: "@usevaulta/vexa-linux-arm64-musl",
|
|
96
|
+
suffix: "linux-arm64-musl",
|
|
97
|
+
rustTarget: "aarch64-unknown-linux-musl",
|
|
98
|
+
platform: "linux",
|
|
99
|
+
arch: "arm64",
|
|
100
|
+
libc: "musl",
|
|
101
|
+
binaryName: UNIX_BINARY,
|
|
102
|
+
osField: "linux",
|
|
103
|
+
cpuField: "arm64"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
packageName: "@usevaulta/vexa-linux-arm-gnueabihf",
|
|
107
|
+
suffix: "linux-arm-gnueabihf",
|
|
108
|
+
rustTarget: "armv7-unknown-linux-gnueabihf",
|
|
109
|
+
platform: "linux",
|
|
110
|
+
arch: "arm",
|
|
111
|
+
libc: "glibc",
|
|
112
|
+
binaryName: UNIX_BINARY,
|
|
113
|
+
osField: "linux",
|
|
114
|
+
cpuField: "arm"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
packageName: "@usevaulta/vexa-linux-riscv64-gnu",
|
|
118
|
+
suffix: "linux-riscv64-gnu",
|
|
119
|
+
rustTarget: "riscv64gc-unknown-linux-gnu",
|
|
120
|
+
platform: "linux",
|
|
121
|
+
arch: "riscv64",
|
|
122
|
+
libc: "glibc",
|
|
123
|
+
binaryName: UNIX_BINARY,
|
|
124
|
+
osField: "linux",
|
|
125
|
+
cpuField: "riscv64"
|
|
126
|
+
}
|
|
127
|
+
];
|
|
128
|
+
/** Looks up the package for an explicit tuple. */
|
|
129
|
+
function findPlatformTarget(platform, arch, libc) {
|
|
130
|
+
return PLATFORM_TARGETS.find((target) => target.platform === platform && target.arch === arch && (target.libc === void 0 ? true : target.libc === libc));
|
|
131
|
+
}
|
|
132
|
+
/** True when `ldd` reports musl, detected from its version banner. */
|
|
133
|
+
function lddReportsMusl(banner) {
|
|
134
|
+
return /musl/i.test(banner);
|
|
135
|
+
}
|
|
136
|
+
/** True when a musl loader is present in the usual Alpine/musl locations. */
|
|
137
|
+
function hasMuslLoader(paths) {
|
|
138
|
+
return paths.some((path) => /ld-musl-|libc\.musl/.test(path));
|
|
139
|
+
}
|
|
140
|
+
/** Resolves the platform target for the current (or injected) process. */
|
|
141
|
+
function resolvePlatformTarget(platform, arch, muslOverride) {
|
|
142
|
+
if (platform === "linux") {
|
|
143
|
+
const libc = muslOverride ? "musl" : "glibc";
|
|
144
|
+
const target = findPlatformTarget(platform, arch, libc);
|
|
145
|
+
if (target === void 0) throw new Error(`@usevaulta/vexa does not ship a binary for linux/${arch} (${libc}).\nSupported: ${PLATFORM_TARGETS.filter((t) => t.platform === "linux").map((t) => t.suffix).join(", ")}`);
|
|
146
|
+
return target;
|
|
147
|
+
}
|
|
148
|
+
const target = findPlatformTarget(platform, arch);
|
|
149
|
+
if (target === void 0) throw new Error(`@usevaulta/vexa does not ship a binary for ${platform}/${arch}.\nSupported: ${PLATFORM_TARGETS.map((t) => t.suffix).join(", ")}`);
|
|
150
|
+
return target;
|
|
151
|
+
}
|
|
152
|
+
// src/launcher.ts
|
|
153
|
+
/**
|
|
154
|
+
* Native-binary resolution for the `@usevaulta/vexa` launcher.
|
|
155
|
+
*
|
|
156
|
+
* Resolution order:
|
|
157
|
+
* 1. `VEXA_BINARY_PATH` — explicit override, used by tests and CI.
|
|
158
|
+
* 2. A locally staged `platforms/<suffix>/bin/<binary>` (monorepo checkouts).
|
|
159
|
+
* 3. The installed `@usevaulta/vexa-<suffix>` optional dependency.
|
|
160
|
+
*/
|
|
161
|
+
/** Raised when no native binary can be located for this platform. */
|
|
162
|
+
var BinaryResolutionError = class extends Error {
|
|
163
|
+
constructor(message, options) {
|
|
164
|
+
super(message, options);
|
|
165
|
+
this.name = "BinaryResolutionError";
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
/** Narrows an unknown value to a plain object record. */
|
|
169
|
+
function isRecord(value) {
|
|
170
|
+
return typeof value === "object" && value !== null;
|
|
171
|
+
}
|
|
172
|
+
/** Reads `stderr` off a failed `execFileSync` without trusting its shape. */
|
|
173
|
+
function stderrOf(error) {
|
|
174
|
+
if (!isRecord(error) || !("stderr" in error)) return;
|
|
175
|
+
const stderr = error["stderr"];
|
|
176
|
+
if (typeof stderr === "string") return stderr;
|
|
177
|
+
if (Buffer.isBuffer(stderr)) return stderr.toString();
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Detects whether the current Linux host uses musl instead of glibc.
|
|
181
|
+
*
|
|
182
|
+
* Three independent signals, cheapest first: musl loader files, the Node.js
|
|
183
|
+
* process report (a glibc version is absent on musl builds), then `ldd --version`.
|
|
184
|
+
*/
|
|
185
|
+
function detectMusl() {
|
|
186
|
+
if ([
|
|
187
|
+
"/lib/ld-musl-x86_64.so.1",
|
|
188
|
+
"/lib/ld-musl-aarch64.so.1",
|
|
189
|
+
"/lib/libc.musl-x86_64.so.1"
|
|
190
|
+
].some((path) => (0, node_fs.existsSync)(path))) return true;
|
|
191
|
+
try {
|
|
192
|
+
const report = process.report?.getReport();
|
|
193
|
+
if (isRecord(report) && isRecord(report["header"])) {
|
|
194
|
+
if (!("glibcVersionRuntime" in report["header"])) return true;
|
|
195
|
+
}
|
|
196
|
+
} catch {}
|
|
197
|
+
try {
|
|
198
|
+
const banner = (0, node_child_process.execFileSync)("ldd", ["--version"], {
|
|
199
|
+
encoding: "utf8",
|
|
200
|
+
stdio: [
|
|
201
|
+
"ignore",
|
|
202
|
+
"pipe",
|
|
203
|
+
"pipe"
|
|
204
|
+
]
|
|
205
|
+
});
|
|
206
|
+
return /musl/i.test(banner);
|
|
207
|
+
} catch (error) {
|
|
208
|
+
const stderr = stderrOf(error);
|
|
209
|
+
return stderr !== void 0 && /musl/i.test(stderr);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/** Whether the resolved host needs the musl build. */
|
|
213
|
+
function hostLibc(options = {}) {
|
|
214
|
+
const platform = options.platform ?? process.platform;
|
|
215
|
+
if (options.musl !== void 0) return options.musl ? "musl" : "glibc";
|
|
216
|
+
return platform === "linux" && detectMusl() ? "musl" : "glibc";
|
|
217
|
+
}
|
|
218
|
+
/** Resolves the platform target for this host. */
|
|
219
|
+
function hostTarget(options = {}) {
|
|
220
|
+
const platform = options.platform ?? process.platform;
|
|
221
|
+
const arch = options.arch ?? process.arch;
|
|
222
|
+
if (platform === "linux") return resolvePlatformTarget(platform, arch, hostLibc(options) === "musl");
|
|
223
|
+
return resolvePlatformTarget(platform, arch);
|
|
224
|
+
}
|
|
225
|
+
function stagedBinaryPath(target, options) {
|
|
226
|
+
const launcherDir = options.launcherDir ?? __dirname;
|
|
227
|
+
const root = (0, node_path.dirname)(launcherDir);
|
|
228
|
+
return [(0, node_path.join)(root, "platforms", target.suffix, "bin", target.binaryName), (0, node_path.join)(launcherDir, "platforms", target.suffix, "bin", target.binaryName)].find((candidate) => (0, node_fs.existsSync)(candidate));
|
|
229
|
+
}
|
|
230
|
+
function installedBinaryPath(target) {
|
|
231
|
+
const require$1 = (0, node_module.createRequire)(__filename);
|
|
232
|
+
let packageJson;
|
|
233
|
+
try {
|
|
234
|
+
packageJson = require$1.resolve(`${target.packageName}/package.json`);
|
|
235
|
+
} catch (error) {
|
|
236
|
+
const installed = PLATFORM_TARGETS.filter((candidate) => isInstalled(candidate.packageName)).map((candidate) => candidate.suffix);
|
|
237
|
+
const hint = installed.length > 0 ? `Installed platform packages: ${installed.join(", ")} (expected ${target.suffix}).` : "No platform package is installed; the optional dependency may have been skipped.";
|
|
238
|
+
throw new BinaryResolutionError(`Could not find the \`${target.packageName}\` package.\n${hint}\nReinstall with optional dependencies enabled, or set VEXA_BINARY_PATH.`, { cause: error });
|
|
239
|
+
}
|
|
240
|
+
const binary = (0, node_path.join)((0, node_path.dirname)(packageJson), "bin", target.binaryName);
|
|
241
|
+
return (0, node_fs.existsSync)(binary) ? binary : void 0;
|
|
242
|
+
}
|
|
243
|
+
function isInstalled(packageName) {
|
|
244
|
+
try {
|
|
245
|
+
(0, node_module.createRequire)(__filename).resolve(`${packageName}/package.json`);
|
|
246
|
+
return true;
|
|
247
|
+
} catch {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
/** Resolves the native `vexa` binary for this host. */
|
|
252
|
+
function resolveBinaryPath(options = {}) {
|
|
253
|
+
const env = options.env ?? process.env;
|
|
254
|
+
const target = hostTarget(options);
|
|
255
|
+
const override = env["VEXA_BINARY_PATH"];
|
|
256
|
+
if (override !== void 0 && override.trim() !== "") return {
|
|
257
|
+
path: override,
|
|
258
|
+
target
|
|
259
|
+
};
|
|
260
|
+
const staged = stagedBinaryPath(target, options);
|
|
261
|
+
if (staged !== void 0) return {
|
|
262
|
+
path: staged,
|
|
263
|
+
target
|
|
264
|
+
};
|
|
265
|
+
const installed = installedBinaryPath(target);
|
|
266
|
+
if (installed === void 0) throw new BinaryResolutionError(`\`${target.packageName}\` is installed but does not contain bin/${target.binaryName}.`);
|
|
267
|
+
return {
|
|
268
|
+
path: installed,
|
|
269
|
+
target
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
/** Lists the platform directories present in a staging tree (diagnostics only). */
|
|
273
|
+
function stagedSuffixes(root) {
|
|
274
|
+
try {
|
|
275
|
+
return (0, node_fs.readdirSync)(root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
276
|
+
} catch {
|
|
277
|
+
return [];
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
// src/cli.ts
|
|
281
|
+
/**
|
|
282
|
+
* CLI entry point used by the `vexa` bin shim.
|
|
283
|
+
*
|
|
284
|
+
* Spawns the native binary with inherited stdio so colours, TTY detection, and
|
|
285
|
+
* progress output behave exactly as when running `vexa` directly, then mirrors
|
|
286
|
+
* its exit code (and terminating signal) to the caller.
|
|
287
|
+
*/
|
|
288
|
+
/**
|
|
289
|
+
* Derives the program name the user invoked, so `--help` prints the wrapper
|
|
290
|
+
* (`npx @usevaulta/vexa`) rather than the internal binary path.
|
|
291
|
+
*/
|
|
292
|
+
function detectBinName(argv, env) {
|
|
293
|
+
const fromEnv = env["VEXA_CLI_BIN_NAME"];
|
|
294
|
+
if (fromEnv !== void 0 && fromEnv.trim() !== "") return fromEnv;
|
|
295
|
+
const invoked = argv[1];
|
|
296
|
+
if (invoked === void 0) return;
|
|
297
|
+
if (invoked.endsWith("vexa.js") || invoked.endsWith("cli.cjs")) {
|
|
298
|
+
const npmExecPath = env["npm_execpath"];
|
|
299
|
+
if (npmExecPath !== void 0 && npmExecPath.includes("pnpm")) return "pnpm vexa";
|
|
300
|
+
if (npmExecPath !== void 0 && npmExecPath.includes("yarn")) return "yarn vexa";
|
|
301
|
+
if (env["npm_config_user_agent"]?.startsWith("npm/") === true) return "npx vexa";
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
/** Spawns the native binary, returning its status without exiting. */
|
|
306
|
+
function launch(args, options = {}) {
|
|
307
|
+
const env = {
|
|
308
|
+
...process.env,
|
|
309
|
+
...options.env
|
|
310
|
+
};
|
|
311
|
+
const resolved = resolveBinaryPath({
|
|
312
|
+
...options,
|
|
313
|
+
env
|
|
314
|
+
});
|
|
315
|
+
const binName = detectBinName([process.argv[0] ?? "", process.argv[1] ?? ""], env);
|
|
316
|
+
const childEnv = { ...env };
|
|
317
|
+
if (binName !== void 0) childEnv["VEXA_CLI_BIN_NAME"] = binName;
|
|
318
|
+
const result = (0, node_child_process.spawnSync)(resolved.path, [...args], {
|
|
319
|
+
stdio: "inherit",
|
|
320
|
+
shell: false,
|
|
321
|
+
env: childEnv,
|
|
322
|
+
windowsHide: false
|
|
323
|
+
});
|
|
324
|
+
if (result.error !== void 0) throw new BinaryResolutionError(`Failed to execute ${resolved.path}: ${result.error.message}`, { cause: result.error });
|
|
325
|
+
return {
|
|
326
|
+
status: result.status,
|
|
327
|
+
signal: result.signal,
|
|
328
|
+
binary: resolved.path
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
/** Runs the CLI and returns the exit code to hand to `process.exit`. */
|
|
332
|
+
function runCli(args, options = {}) {
|
|
333
|
+
const { status, signal } = launch(args, options);
|
|
334
|
+
if (status !== null) return status;
|
|
335
|
+
if (signal !== null) return 128 + (SIGNAL_NUMBERS[signal] ?? 1);
|
|
336
|
+
return 0;
|
|
337
|
+
}
|
|
338
|
+
const SIGNAL_NUMBERS = {
|
|
339
|
+
SIGHUP: 1,
|
|
340
|
+
SIGINT: 2,
|
|
341
|
+
SIGQUIT: 3,
|
|
342
|
+
SIGILL: 4,
|
|
343
|
+
SIGTRAP: 5,
|
|
344
|
+
SIGABRT: 6,
|
|
345
|
+
SIGBUS: 7,
|
|
346
|
+
SIGFPE: 8,
|
|
347
|
+
SIGKILL: 9,
|
|
348
|
+
SIGUSR1: 10,
|
|
349
|
+
SIGSEGV: 11,
|
|
350
|
+
SIGUSR2: 12,
|
|
351
|
+
SIGPIPE: 13,
|
|
352
|
+
SIGALRM: 14,
|
|
353
|
+
SIGTERM: 15
|
|
354
|
+
};
|
|
355
|
+
// src/index.ts
|
|
356
|
+
/** Absolute path of the native `vexa` binary for this host. */
|
|
357
|
+
function resolveBinary(options) {
|
|
358
|
+
return resolveBinaryPath(options).path;
|
|
359
|
+
}
|
|
360
|
+
/** Platform package selected for this host. */
|
|
361
|
+
function platformTarget(options) {
|
|
362
|
+
return resolveBinaryPath(options).target;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Runs the native CLI, streaming output to this process's stdio.
|
|
366
|
+
*
|
|
367
|
+
* Resolves with the child's exit code; never rejects on a non-zero exit.
|
|
368
|
+
*/
|
|
369
|
+
async function run(args, options) {
|
|
370
|
+
return runCli(args, options);
|
|
371
|
+
}
|
|
372
|
+
exports.BinaryResolutionError = BinaryResolutionError;
|
|
373
|
+
exports.PLATFORM_TARGETS = PLATFORM_TARGETS;
|
|
374
|
+
exports.detectBinName = detectBinName;
|
|
375
|
+
exports.detectMusl = detectMusl;
|
|
376
|
+
exports.findPlatformTarget = findPlatformTarget;
|
|
377
|
+
exports.hasMuslLoader = hasMuslLoader;
|
|
378
|
+
exports.hostLibc = hostLibc;
|
|
379
|
+
exports.hostTarget = hostTarget;
|
|
380
|
+
exports.launch = launch;
|
|
381
|
+
exports.lddReportsMusl = lddReportsMusl;
|
|
382
|
+
exports.platformTarget = platformTarget;
|
|
383
|
+
exports.resolveBinary = resolveBinary;
|
|
384
|
+
exports.resolveBinaryPath = resolveBinaryPath;
|
|
385
|
+
exports.resolvePlatformTarget = resolvePlatformTarget;
|
|
386
|
+
exports.run = run;
|
|
387
|
+
exports.runCli = runCli;
|
|
388
|
+
exports.stagedSuffixes = stagedSuffixes;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./types/index.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usevaulta/vexa",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Native Rust CLI toolchain for GPUI desktop applications",
|
|
6
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
7
|
+
"type": "commonjs",
|
|
8
|
+
"bin": {
|
|
9
|
+
"vexa": "./dist/cli.cjs"
|
|
10
|
+
},
|
|
11
|
+
"main": "./dist/index.cjs",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist/cli.cjs",
|
|
15
|
+
"dist/index.cjs",
|
|
16
|
+
"dist/index.d.ts",
|
|
17
|
+
"README.md",
|
|
18
|
+
"LICENSE"
|
|
19
|
+
],
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">= 18"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
28
|
+
"build": "tsdown && node ./postbuild.mjs",
|
|
29
|
+
"sync-version": "node ./dist/scripts/sync-version.cjs",
|
|
30
|
+
"stage-artifacts": "node ./dist/scripts/stage-artifacts.cjs",
|
|
31
|
+
"verify": "node ./dist/scripts/verify-dist.cjs",
|
|
32
|
+
"prepublishOnly": "npm run typecheck && npm run build && node ./dist/scripts/sync-version.cjs --check"
|
|
33
|
+
},
|
|
34
|
+
"optionalDependencies": {
|
|
35
|
+
"@usevaulta/vexa-darwin-arm64": "0.1.0",
|
|
36
|
+
"@usevaulta/vexa-darwin-x64": "0.1.0",
|
|
37
|
+
"@usevaulta/vexa-linux-arm-gnueabihf": "0.1.0",
|
|
38
|
+
"@usevaulta/vexa-linux-arm64-gnu": "0.1.0",
|
|
39
|
+
"@usevaulta/vexa-linux-arm64-musl": "0.1.0",
|
|
40
|
+
"@usevaulta/vexa-linux-riscv64-gnu": "0.1.0",
|
|
41
|
+
"@usevaulta/vexa-linux-x64-gnu": "0.1.0",
|
|
42
|
+
"@usevaulta/vexa-linux-x64-musl": "0.1.0",
|
|
43
|
+
"@usevaulta/vexa-win32-arm64-msvc": "0.1.0",
|
|
44
|
+
"@usevaulta/vexa-win32-ia32-msvc": "0.1.0",
|
|
45
|
+
"@usevaulta/vexa-win32-x64-msvc": "0.1.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "22.20.4",
|
|
49
|
+
"tsdown": "0.23.7",
|
|
50
|
+
"typescript": "5.9.3"
|
|
51
|
+
}
|
|
52
|
+
}
|