core/loaders/source.loader.ts
core/loaders/source.loader.ts is a file in Bane's Lab Build Scripts. 14 lines of code and 4 definitions.
import { existsSync, readFileSync, statSync } from "node:fs";
import { absolutePath } from "@ssot/paths";
import { join } from "node:path";
const sourceFileOf = function sourceFileOf(name: string): string {
return join(absolutePath("app.sources"), name);
};
export const sourceTextOf = function sourceTextOf(name: string): string | null {
const file = sourceFileOf(name);
return existsSync(file) ? readFileSync(file, "utf8") : null;
};
export const sourceSizeOf = function sourceSizeOf(name: string): number {
const file = sourceFileOf(name);
return existsSync(file) ? statSync(file).size : 0;
};