mirror of
https://github.com/outline/outline.git
synced 2026-11-20 21:23:06 +03:00
* Add missing JSDoc to exported members in app and server utils Documents all exported functions, classes, enums, and constants in app/utils and server/utils that were missing JSDoc, per the project documentation guidelines. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AsEQYA8zN813thxu7GjjzU * Use @returns tag to match codebase convention Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AsEQYA8zN813thxu7GjjzU --------- Co-authored-by: Claude <noreply@anthropic.com>
38 lines
946 B
TypeScript
38 lines
946 B
TypeScript
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import Logger from "@server/logging/Logger";
|
|
|
|
export type Chunk = {
|
|
file: string;
|
|
imports: string[];
|
|
src: string;
|
|
isEntry?: boolean;
|
|
};
|
|
|
|
export type ManifestStructure = Record<string, Chunk>;
|
|
|
|
/**
|
|
* Reads and parses the Vite build manifest from disk, returning an empty
|
|
* manifest if the file cannot be found.
|
|
*
|
|
* @param file the path to the manifest file.
|
|
* @returns the parsed manifest structure.
|
|
*/
|
|
export const readManifestFile = (file = "./build/app/.vite/manifest.json") => {
|
|
const absoluteFilePath = path.resolve(file);
|
|
|
|
let manifest = "{}";
|
|
|
|
try {
|
|
manifest = fs.readFileSync(absoluteFilePath, "utf8") as string;
|
|
} catch (_err) {
|
|
Logger.warn(
|
|
`Can not find ${absoluteFilePath}. Try executing "yarn vite:build" before running in production mode.`
|
|
);
|
|
}
|
|
|
|
return JSON.parse(manifest) as ManifestStructure;
|
|
};
|
|
|
|
export default readManifestFile;
|