everything-dev
Version:
A consolidated product package for building Module Federation apps with oRPC APIs.
31 lines (29 loc) • 1.16 kB
JavaScript
let effect = require("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
exports.APP_PATH = APP_PATH;
exports.CATALOGS_PATH = CATALOGS_PATH;
exports.ROOT_PATH = ROOT_PATH;
exports.RUNTIME_IMPORT = RUNTIME_IMPORT;
exports.RUNTIME_PATH = RUNTIME_PATH;
exports.parseAppLocale = parseAppLocale;
//# sourceMappingURL=i18n-seam.cjs.map