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