// NOSE developer feature.
//
// Show some debugging information.

import { NOSE_STARTED, NOSE_ROOT_BIN, NOSE_BIN, NOSE_DATA, NOSE_DIR, GIT_SHA } from "@/config"
import { highlightToHTML } from "../lib/highlight"

export default function () {
    return highlightToHTML([
        `NODE_ENV=${valueOrNone(process.env.NODE_ENV)}`,
        `NO_DNS=${valueOrNone(process.env.NO_DNS)}`,
        `BUN_HOT=${valueOrNone(process.env.BUN_HOT)}`,
        `PORT=${valueOrNone(process.env.PORT)}`,
        `USER=${valueOrNone(process.env.USER)}`,
        `PWD=${valueOrNone(process.env.PWD)}`,
        `NOSE_STARTED=${NOSE_STARTED}`,
        `NOSE_BIN="${NOSE_BIN}"`,
        `NOSE_ROOT_BIN="${NOSE_ROOT_BIN}"`,
        `NOSE_DATA="${NOSE_DATA}"`,
        `NOSE_DIR="${NOSE_DIR}"`,
        `GIT_SHA="${GIT_SHA}"`,
    ].join("\n"))
}

function valueOrNone(val: string | undefined): string {
    return val ? `"${val}"` : ""
}