Files
worldmonitor/scripts/build-sidecar-sebuf.mjs
Hasan AlDoy 02f3fe77a9 feat: Arabic font support and HLS live streaming UI (#1020)
* feat: enhance support for HLS streams and update font styles

* chore: add .vercelignore to exclude large local build artifacts from Vercel deploys

* chore: include node types in tsconfig to fix server type errors on Vercel build

* fix(middleware): guard optional variant OG lookup to satisfy strict TS

* fix: desktop build and live channels handle null safety

- scripts/build-sidecar-sebuf.mjs: Skip building removed [domain]/v1/[rpc].ts (removed in #785)
- src/live-channels-window.ts: Add optional chaining for handle property to prevent null errors
- src-tauri/Cargo.lock: Bump version to 2.5.24

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix: address review issues on PR #1020

- Remove AGENTS.md (project guidelines belong to repo owner)
- Restore tracking script in index.html (accidentally removed)
- Revert tsconfig.json "node" types (leaks Node globals to frontend)
- Add protocol validation to isHlsUrl() (security: block non-http URIs)
- Revert Cargo.lock version bump (release management concern)

* fix: address P2/P3 review findings

- Preserve hlsUrl for HLS-only channels in refreshChannelInfo (was
  incorrectly clearing the stream URL on every refresh cycle)
- Replace deprecated .substr() with .substring()
- Extract duplicated HLS display name logic into getChannelDisplayName()

---------

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: Elie Habib <elie.habib@gmail.com>
2026-03-05 10:16:43 +04:00

49 lines
1.6 KiB
JavaScript

/**
* Compiles the sebuf RPC gateway (api/[domain]/v1/[rpc].ts) into a single
* self-contained ESM bundle (api/[domain]/v1/[rpc].js) so the Tauri sidecar's
* buildRouteTable() can discover and load it.
*
* Run: node scripts/build-sidecar-sebuf.mjs
* Or: npm run build:sidecar-sebuf
*
* Note: api/[domain]/v1/[rpc].ts was removed in #785 as it was a catch-all
* that intercepted all RPC routes. This script now skips the [domain] folder.
*/
import { build } from 'esbuild';
import { stat } from 'node:fs/promises';
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import { existsSync } from 'node:fs';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const projectRoot = path.resolve(__dirname, '..');
const entryPoint = path.join(projectRoot, 'api', '[domain]', 'v1', '[rpc].ts');
const outfile = path.join(projectRoot, 'api', '[domain]', 'v1', '[rpc].js');
// Skip if the source file doesn't exist (removed in #785)
if (!existsSync(entryPoint)) {
console.log('build:sidecar-sebuf skipped (api/[domain]/v1/[rpc].ts removed in #785)');
} else {
try {
await build({
entryPoints: [entryPoint],
outfile,
bundle: true,
format: 'esm',
platform: 'node',
target: 'node18',
// Tree-shake unused exports for smaller bundle
treeShaking: true,
});
const { size } = await stat(outfile);
const sizeKB = (size / 1024).toFixed(1);
console.log(`build:sidecar-sebuf api/[domain]/v1/[rpc].js ${sizeKB} KB`);
} catch (err) {
console.error('build:sidecar-sebuf failed:', err.message);
process.exit(1);
}
}