Fix startup time issues

This commit is contained in:
Scott Richmond 2023-12-26 22:34:43 -05:00
parent 735e807488
commit 4055d42f33
4 changed files with 21 additions and 31 deletions

View File

@ -1,15 +1,6 @@
# ludus-repl # A command-line version of Ludus
A Bun-driven, JS-based, command-line version of Ludus.
To install dependencies: Download a MacOS (ARM64) from the releases page, or use NPM to install `@ludus/cli`.
```bash
bun install
```
To run:
```bash
bun run index.ts
```
This project was created using `bun init` in bun v1.0.20. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.

BIN
bun.lockb

Binary file not shown.

26
index.ts Normal file → Executable file
View File

@ -1,19 +1,29 @@
import { listen } from "./listener" #! /usr/bin/env bun
import { run_file } from "./runner"
import { send } from "./sender"
const help_text = await Bun.file("./help.txt").text()
export async function main() { export async function main() {
const cmd = Bun.argv[2] const cmd = Bun.argv[2]
switch (cmd) { switch (cmd) {
case "listen": { return listen() } case "listen": {
case "send": { return send() } const {listen} = await import("./listener")
case "run": { return run_file(Bun.argv[3]) } return listen()
}
case "send": {
const {send} = await import("./sender")
return send ()
}
case "run": {
const {run_file} = await import("./runner")
return run_file(Bun.argv[3])
}
case "help": { return console.log(help_text) } case "help": { return console.log(help_text) }
case "version": { return console.log("0.1.0") } case "version": { return console.log("0.1.0") }
default: console.log("Usage: ludus {help | version | run | listen | send}") default: console.log("Usage: ludus {help | version | run | listen | send}")
} }
} }
async function help_text() {
const help_text = await Bun.file("./help.txt").text()
console.log(help_text)
}
await main() await main()

View File

@ -1,11 +0,0 @@
let foo = 42
let bar = :thing
let baz = #{:a 1, :b 2}
doc! (add)
print! ("This is a message from inside Ludus")
[foo, bar, baz]
add (1, 2)