@vercel/microfrontends 0.12.1 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1674,23 +1674,28 @@ function getDomainFromEnvironment({
1674
1674
  app,
1675
1675
  target
1676
1676
  }) {
1677
- var _a, _b;
1677
+ var _a;
1678
1678
  const mfeProjects = JSON.parse(
1679
- process.env.VERCEL_MICROFRONTENDS_PROJECTS ?? "{}"
1679
+ process.env.VERCEL_MICROFRONTENDS_PROJECTS ?? "[]"
1680
1680
  );
1681
- if (Object.keys(mfeProjects).length === 0) {
1681
+ if (mfeProjects.length === 0) {
1682
1682
  throw new Error("Missing related microfrontends project information");
1683
1683
  }
1684
1684
  if (!((_a = app.vercel) == null ? void 0 : _a.projectId)) {
1685
1685
  throw new Error(`Missing applications[${app.name}].vercel.projectId`);
1686
1686
  }
1687
- const vercelProject = (_b = mfeProjects.applications) == null ? void 0 : _b[app.vercel.projectId];
1687
+ const vercelProject = mfeProjects.find(
1688
+ (p) => {
1689
+ var _a2;
1690
+ return p.project.id === ((_a2 = app.vercel) == null ? void 0 : _a2.projectId);
1691
+ }
1692
+ );
1688
1693
  if (!vercelProject) {
1689
1694
  throw new Error(
1690
1695
  `Missing related microfrontends project information for application "${app.name}"`
1691
1696
  );
1692
1697
  }
1693
- const domain = target === "preview" && vercelProject.deploymentAlias ? vercelProject.deploymentAlias : vercelProject.productionHost;
1698
+ const domain = target === "preview" && vercelProject.preview.branch ? vercelProject.preview.branch : vercelProject.production.alias ?? vercelProject.production.url;
1694
1699
  if (!domain) {
1695
1700
  throw new Error(
1696
1701
  `Missing domain for target "${target}" in application "${app.name}"`