@vercel/microfrontends 1.4.0-canary.4 → 1.4.0-canary.5

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.
@@ -17,7 +17,7 @@ function displayLocalProxyInfo(port) {
17
17
 
18
18
  // src/config/microfrontends/server/index.ts
19
19
  import fs6 from "node:fs";
20
- import { dirname as dirname2 } from "node:path";
20
+ import { dirname as dirname2, join as join2, resolve } from "node:path";
21
21
 
22
22
  // src/config/overrides/constants.ts
23
23
  var OVERRIDES_COOKIE_PREFIX = "vercel-micro-frontends-override";
@@ -1395,21 +1395,43 @@ var MicrofrontendsServer = class {
1395
1395
  }
1396
1396
  const repositoryRoot = findRepositoryRoot();
1397
1397
  const isMonorepo2 = isMonorepo({ repositoryRoot });
1398
- if (isMonorepo2) {
1399
- const defaultPackage = inferMicrofrontendsLocation({
1400
- repositoryRoot,
1401
- applicationName: appName
1398
+ if (typeof process.env.VC_MICROFRONTENDS_CONFIG === "string") {
1399
+ const maybeConfigFromEnv = resolve(
1400
+ packageRoot,
1401
+ process.env.VC_MICROFRONTENDS_CONFIG
1402
+ );
1403
+ if (maybeConfigFromEnv) {
1404
+ return MicrofrontendsServer.fromFile({
1405
+ filePath: maybeConfigFromEnv,
1406
+ cookies
1407
+ });
1408
+ }
1409
+ } else {
1410
+ const maybeConfigFromVercel = findConfig({
1411
+ dir: join2(packageRoot, ".vercel")
1402
1412
  });
1403
- const maybeConfigFromDefault = findConfig({ dir: defaultPackage });
1404
- if (maybeConfigFromDefault) {
1413
+ if (maybeConfigFromVercel) {
1405
1414
  return MicrofrontendsServer.fromFile({
1406
- filePath: maybeConfigFromDefault,
1415
+ filePath: maybeConfigFromVercel,
1407
1416
  cookies
1408
1417
  });
1409
1418
  }
1419
+ if (isMonorepo2) {
1420
+ const defaultPackage = inferMicrofrontendsLocation({
1421
+ repositoryRoot,
1422
+ applicationName: appName
1423
+ });
1424
+ const maybeConfigFromDefault = findConfig({ dir: defaultPackage });
1425
+ if (maybeConfigFromDefault) {
1426
+ return MicrofrontendsServer.fromFile({
1427
+ filePath: maybeConfigFromDefault,
1428
+ cookies
1429
+ });
1430
+ }
1431
+ }
1410
1432
  }
1411
1433
  throw new MicrofrontendError(
1412
- "Unable to automatically infer the location of the `microfrontends.json` file. Microfrontends defined in separate repositories are not supported yet. If you suspect this is thrown in error, please reach out to the Vercel team.",
1434
+ 'Unable to automatically infer the location of the `microfrontends.json` file. If your Vercel Microfrontends configuration is not in this repository, you can use the Vercel CLI to pull the Vercel Microfrontends configuration using the "vercel microfrontends pull" command, or you can specify the path manually using the VC_MICROFRONTENDS_CONFIG environment variable. If you suspect this is thrown in error, please reach out to the Vercel team.',
1413
1435
  { type: "config", subtype: "inference_failed" }
1414
1436
  );
1415
1437
  } catch (e) {