models-macro.ts 351 B

1234567891011121314
  1. import { Global } from "../global"
  2. export async function data() {
  3. const path = Bun.env.MODELS_DEV_API_JSON
  4. if (path) {
  5. const file = Bun.file(path)
  6. if (await file.exists()) {
  7. return await file.text()
  8. }
  9. }
  10. const url = Global.Path.modelsDevUrl
  11. const json = await fetch(`${url}/api.json`).then((x) => x.text())
  12. return json
  13. }