UNPKG

importly

Version:
17 lines 718 B
import axios from "axios"; import { ImportlyLookupError } from "../errors.js"; import { determinePackageEntry } from "../utilities/determine-package-entry.js"; export const prepareCloudLookup = (linker) => async ({ orders }) => { return Promise.all(orders.map(async (order) => { const path = `${linker(order.label, order.version)}/package.json`; try { const { data } = await axios.get(path); const entry = determinePackageEntry(data); return { ...order, entry }; } catch (error) { throw new ImportlyLookupError(`error looking up "${order.label}" from "${path}"`); } })); }; //# sourceMappingURL=prepare-cloud-lookup.js.map