tsx support

This commit is contained in:
Chris Wanstrath 2025-09-21 21:28:29 -07:00
parent 5f494ede79
commit b7e99755f1
3 changed files with 18 additions and 7 deletions

View File

@ -71,6 +71,14 @@
color: var(--c64-dark-blue);
}
a {
color: var(--cyan);
}
a:visited {
color: var(--purple);
}
html,
body {
font-family: var(--font-family);

View File

@ -79,8 +79,7 @@ app.get("/apps", c => {
return c.html(<>
<h1>apps</h1>
<ul>{apps().map(app => <li><a href={`http://${app}.${domain}${port}`}>{app}</a></li>)}
</ul>
<ul>{apps().map(app => <li><a href={`http://${app}.${domain}${port}`}>{app}</a></li>)}</ul>
</>)
})

View File

@ -1,9 +1,9 @@
////
// runs commands and such.
import { join } from "path"
import type { CommandResult, CommandOutput } from "./shared/types"
import type { State } from "./state"
import { join } from "path"
import { NOSE_SYS_BIN, NOSE_BIN } from "./config"
import { isFile } from "./utils"
import { ALS } from "./state"
@ -46,6 +46,8 @@ function processExecOutput(output: string | any): ["ok" | "error", CommandOutput
} else if (typeof output === "object") {
if (output.error) {
return ["error", output.error]
} else if (output.tag && output.props && output.children) {
return ["ok", { html: output.toString() }]
} else {
return ["ok", output]
}
@ -65,10 +67,12 @@ function getState(session: string, id: string): State {
}
function commandPath(cmd: string): string | undefined {
const sysPath = join(NOSE_SYS_BIN, cmd + ".ts")
const usrPath = join(NOSE_BIN, cmd + ".ts")
return (isFile(sysPath) && sysPath) || (isFile(usrPath) && usrPath) || undefined
return [
join(NOSE_SYS_BIN, cmd + ".ts"),
join(NOSE_SYS_BIN, cmd + ".tsx"),
join(NOSE_BIN, cmd + ".ts"),
join(NOSE_BIN, cmd + ".tsx")
].find((path: string) => isFile(path))
}
function commandExists(cmd: string): boolean {