perf(macos): compile embedded gateway with bytecode

This commit is contained in:
Peter Steinberger 2025-12-19 22:11:41 +01:00
parent 96be450cbb
commit 836f645621
3 changed files with 114 additions and 112 deletions

View file

@ -138,6 +138,7 @@ if [[ "${SKIP_GATEWAY_PACKAGE:-0}" != "1" ]]; then
BUN_OUT="$RELAY_DIR/clawdis-gateway"
bun build "$ROOT_DIR/dist/macos/gateway-daemon.js" \
--compile \
--bytecode \
--outfile "$BUN_OUT" \
-e playwright-core \
-e electron \

View file

@ -79,10 +79,7 @@ function stripFrontMatter(content: string): string {
return trimmed;
}
async function loadTemplate(
name: string,
fallback: string,
): Promise<string> {
async function loadTemplate(name: string, fallback: string): Promise<string> {
const templatePath = path.join(TEMPLATE_DIR, name);
try {
const content = await fs.readFile(templatePath, "utf-8");

View file

@ -19,6 +19,9 @@ function hasFlag(args: string[], flag: string): boolean {
const args = process.argv.slice(2);
type GatewayWsLogStyle = "auto" | "full" | "compact";
async function main() {
if (hasFlag(args, "--version") || hasFlag(args, "-v")) {
// Match `clawdis --version` behavior for Swift env/version checks.
// Keep output a single line.
@ -26,8 +29,6 @@ if (hasFlag(args, "--version") || hasFlag(args, "-v")) {
process.exit(0);
}
type GatewayWsLogStyle = "auto" | "full" | "compact";
const [
{ loadConfig },
{ startGatewayServer },
@ -133,3 +134,6 @@ try {
// Keep process alive
await new Promise<never>(() => {});
}
void main();