@esmx/core
Version:
A high-performance microfrontend framework supporting Vue, React, Preact, Solid, and Svelte with SSR and Module Federation capabilities.
21 lines (20 loc) • 648 B
JavaScript
import fsp from "node:fs/promises";
import path from "node:path";
export async function getManifestList(env, moduleConfig) {
return Promise.all(
Object.values(moduleConfig.links).map(async (item) => {
const filename = path.resolve(item[env], "manifest.json");
try {
const data = await JSON.parse(
await fsp.readFile(filename, "utf-8")
);
data.name = item.name;
return data;
} catch (e) {
throw new Error(
`'${item.name}' service '${filename}' file read error on environment '${env}': ${e instanceof Error ? e.message : String(e)}`
);
}
})
);
}