trellis
Version:
Agentic State Engine — event-sourced causal graph with branching, decision traces, and realtime sync for AI-native applications
51 lines (48 loc) • 1.43 kB
JavaScript
import {
__esm
} from "./chunk-2ESYSVXG.js";
// src/ui/theme/resolve-runtime-theme-css.ts
import { existsSync } from "fs";
import { dirname, join } from "path";
import { fileURLToPath } from "url";
function resolveRuntimeThemeCss(rootPath) {
if (rootPath) {
const rooted = join(rootPath, "src", "ui", "theme", "runtime-theme.css");
if (existsSync(rooted)) return rooted;
const distCopy = join(rootPath, "dist", "ui", "theme", "runtime-theme.css");
if (existsSync(distCopy)) return distCopy;
}
return findRuntimeThemeAsset();
}
function findRuntimeThemeAsset() {
const name = "theme/runtime-theme.css";
const candidates = [];
try {
const moduleDir = dirname(fileURLToPath(import.meta.url));
candidates.push(join(moduleDir, "runtime-theme.css"));
candidates.push(join(moduleDir, "..", name));
candidates.push(join(moduleDir, "..", "ui", name));
} catch {
}
let cwd = process.cwd();
for (let i = 0; i < 8; i++) {
candidates.push(join(cwd, "src", "ui", name));
candidates.push(join(cwd, "dist", "ui", name));
const parent = dirname(cwd);
if (parent === cwd) break;
cwd = parent;
}
for (const p of candidates) {
if (existsSync(p)) return p;
}
return null;
}
var init_resolve_runtime_theme_css = __esm({
"src/ui/theme/resolve-runtime-theme-css.ts"() {
"use strict";
}
});
export {
resolveRuntimeThemeCss,
init_resolve_runtime_theme_css
};