Complete residential site build with Docker Compose & Gitea Actions deployment

This commit is contained in:
CalebLewallen
2026-05-13 17:31:20 -04:00
parent f9c4e13a50
commit 3c22823f72
19354 changed files with 2097331 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
import fs from "node:fs/promises";
const frontmatterRE = /^---(.*?)^---/ms;
const RETURN_REPLACE_RE = /(\/\/[^\n]*|\/\*[\s\S]*?\*\/|`(?:[^`\\]|\\.)*`|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')|(?<!\.)\breturn(\s*;|\b)/g;
function replaceTopLevelReturns(code) {
return code.replace(RETURN_REPLACE_RE, (_match, skip, tail) => {
if (skip !== void 0) return skip;
return tail.trim() === ";" ? "throw 0;" : "throw ";
});
}
async function loadId(pluginContainer, id) {
const result = await pluginContainer.load(id, { ssr: true });
if (result) {
if (typeof result === "string") {
return result;
} else {
return result.code;
}
}
try {
return await fs.readFile(id, "utf-8");
} catch {
}
}
export {
frontmatterRE,
loadId,
replaceTopLevelReturns
};