everything-dev
Version:
A consolidated product package for building Module Federation apps with oRPC APIs.
26 lines (24 loc) • 1.03 kB
JavaScript
import { Effect } from "effect";
//#region src/services/scaffold/upgrade-audit/checks/i18n-seam.ts
const APP_PATH = "ui/src/app.ts";
const CATALOGS_PATH = "ui/src/i18n/catalogs.ts";
const RUNTIME_PATH = "ui/src/i18n/runtime.tsx";
const ROOT_PATH = "ui/src/routes/__root.tsx";
const RUNTIME_IMPORT = "@/i18n/runtime";
const parseAppLocale = (source) => {
const match = source.match(/export\s+const\s+appLocale[^=]*=\s*\{([\s\S]*?)\}/);
if (!match) return null;
const body = match[1];
const locales = body.match(/locales:\s*\[([^\]]*)\]/)?.[1];
const defaultLocale = body.match(/defaultLocale:\s*"([^"]+)"/)?.[1];
const cookieName = body.match(/cookieName:\s*"([^"]+)"/)?.[1];
if (!locales || !defaultLocale || !cookieName) return null;
return {
locales: locales.split(",").map((l) => l.trim().replace(/^["']|["']$/g, "")).filter(Boolean),
defaultLocale,
cookieName
};
};
//#endregion
export { APP_PATH, CATALOGS_PATH, ROOT_PATH, RUNTIME_IMPORT, RUNTIME_PATH, parseAppLocale };
//# sourceMappingURL=i18n-seam.mjs.map