@vercel/microfrontends 0.9.0 → 0.10.1

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.
Files changed (90) hide show
  1. package/README.md +7 -7
  2. package/dist/bin/cli.cjs +1604 -221
  3. package/dist/config/client.d.ts +1 -1
  4. package/dist/config/edge.cjs +47 -47
  5. package/dist/config/edge.cjs.map +1 -1
  6. package/dist/config/edge.d.ts +6 -6
  7. package/dist/config/edge.js +46 -46
  8. package/dist/config/edge.js.map +1 -1
  9. package/dist/config.cjs +67 -66
  10. package/dist/config.cjs.map +1 -1
  11. package/dist/config.d.ts +4 -4
  12. package/dist/config.js +66 -65
  13. package/dist/config.js.map +1 -1
  14. package/dist/{index-eff254d8.d.ts → index-acb44057.d.ts} +12 -23
  15. package/dist/{micro-frontend-config-42886104.d.ts → microfrontend-config-983a5139.d.ts} +13 -13
  16. package/dist/next/client.cjs +1 -1
  17. package/dist/next/client.cjs.map +1 -1
  18. package/dist/next/client.js +1 -1
  19. package/dist/next/client.js.map +1 -1
  20. package/dist/next/config.cjs +86 -87
  21. package/dist/next/config.cjs.map +1 -1
  22. package/dist/next/config.d.ts +3 -3
  23. package/dist/next/config.js +85 -86
  24. package/dist/next/config.js.map +1 -1
  25. package/dist/next/middleware.cjs +60 -62
  26. package/dist/next/middleware.cjs.map +1 -1
  27. package/dist/next/middleware.d.ts +11 -11
  28. package/dist/next/middleware.js +58 -60
  29. package/dist/next/middleware.js.map +1 -1
  30. package/dist/next/testing.cjs +80 -79
  31. package/dist/next/testing.cjs.map +1 -1
  32. package/dist/next/testing.d.ts +10 -10
  33. package/dist/next/testing.js +80 -79
  34. package/dist/next/testing.js.map +1 -1
  35. package/dist/overrides.cjs +9 -9
  36. package/dist/overrides.cjs.map +1 -1
  37. package/dist/overrides.d.ts +2 -2
  38. package/dist/overrides.js +9 -9
  39. package/dist/overrides.js.map +1 -1
  40. package/dist/{schema-83a75e61.d.ts → schema-2922d49e.d.ts} +1 -7
  41. package/dist/{types-4fd1c7c6.d.ts → types-7b1cd9f7.d.ts} +1 -7
  42. package/dist/types-c3d15d04.d.ts +15 -0
  43. package/dist/v2/config.cjs +39 -39
  44. package/dist/v2/config.cjs.map +1 -1
  45. package/dist/v2/config.d.ts +3 -2
  46. package/dist/v2/config.js +38 -38
  47. package/dist/v2/config.js.map +1 -1
  48. package/dist/v2/microfrontends/server.cjs +223 -96
  49. package/dist/v2/microfrontends/server.cjs.map +1 -1
  50. package/dist/v2/microfrontends/server.d.ts +11 -3
  51. package/dist/v2/microfrontends/server.js +223 -96
  52. package/dist/v2/microfrontends/server.js.map +1 -1
  53. package/dist/v2/microfrontends.cjs +44 -44
  54. package/dist/v2/microfrontends.cjs.map +1 -1
  55. package/dist/v2/microfrontends.d.ts +6 -5
  56. package/dist/v2/microfrontends.js +44 -44
  57. package/dist/v2/microfrontends.js.map +1 -1
  58. package/dist/v2/next/client.cjs +1 -1
  59. package/dist/v2/next/client.cjs.map +1 -1
  60. package/dist/v2/next/client.js +1 -1
  61. package/dist/v2/next/client.js.map +1 -1
  62. package/dist/v2/next/config.cjs +247 -122
  63. package/dist/v2/next/config.cjs.map +1 -1
  64. package/dist/v2/next/config.d.ts +4 -4
  65. package/dist/v2/next/config.js +246 -121
  66. package/dist/v2/next/config.js.map +1 -1
  67. package/dist/v2/next/endpoints.cjs +5 -5
  68. package/dist/v2/next/endpoints.cjs.map +1 -1
  69. package/dist/v2/next/endpoints.js +5 -5
  70. package/dist/v2/next/endpoints.js.map +1 -1
  71. package/dist/v2/next/middleware.cjs +55 -55
  72. package/dist/v2/next/middleware.cjs.map +1 -1
  73. package/dist/v2/next/middleware.d.ts +8 -8
  74. package/dist/v2/next/middleware.js +53 -53
  75. package/dist/v2/next/middleware.js.map +1 -1
  76. package/dist/v2/overrides.cjs +75 -0
  77. package/dist/v2/overrides.cjs.map +1 -0
  78. package/dist/v2/overrides.d.ts +24 -0
  79. package/dist/v2/overrides.js +45 -0
  80. package/dist/v2/overrides.js.map +1 -0
  81. package/dist/v2/schema.cjs.map +1 -1
  82. package/dist/v2/schema.d.ts +1 -1
  83. package/dist/validation.cjs +20 -28
  84. package/dist/validation.cjs.map +1 -1
  85. package/dist/validation.d.ts +2 -8
  86. package/dist/validation.js +20 -28
  87. package/dist/validation.js.map +1 -1
  88. package/package.json +15 -7
  89. package/schema/schema-v2.json +0 -4
  90. package/schema/schema.json +0 -4
@@ -12,7 +12,7 @@ import { WebNextRequest } from "next/dist/server/base-http/web";
12
12
  // src/config/types.ts
13
13
  var isDefaultApplicationConfig = (app) => app.default && typeof app.routing === "undefined";
14
14
 
15
- // src/config/micro-frontend-config.ts
15
+ // src/config/microfrontend-config.ts
16
16
  import fs2 from "node:fs";
17
17
 
18
18
  // src/config-v2/microfrontends/server/utils/get-output-file-path.ts
@@ -40,14 +40,14 @@ function getOutputFilePath() {
40
40
  }
41
41
 
42
42
  // src/config/errors.ts
43
- var MicroFrontendError = class extends Error {
43
+ var MicrofrontendError = class extends Error {
44
44
  constructor(message, opts) {
45
45
  super(message);
46
- this.name = "MicroFrontendsError";
47
- this.source = (opts == null ? void 0 : opts.source) ?? "@vercel/micro-frontends";
46
+ this.name = "MicrofrontendsError";
47
+ this.source = (opts == null ? void 0 : opts.source) ?? "@vercel/microfrontends";
48
48
  this.type = (opts == null ? void 0 : opts.type) ?? "unknown";
49
49
  this.subtype = opts == null ? void 0 : opts.subtype;
50
- Error.captureStackTrace(this, MicroFrontendError);
50
+ Error.captureStackTrace(this, MicrofrontendError);
51
51
  }
52
52
  isKnown() {
53
53
  return this.type !== "unknown";
@@ -56,13 +56,13 @@ var MicroFrontendError = class extends Error {
56
56
  return !this.isKnown();
57
57
  }
58
58
  /**
59
- * Converts an error to a MicroFrontendsError.
59
+ * Converts an error to a MicrofrontendsError.
60
60
  * @param original - The original error to convert.
61
- * @returns The converted MicroFrontendsError.
61
+ * @returns The converted MicrofrontendsError.
62
62
  */
63
63
  static convert(original, opts) {
64
64
  if (opts == null ? void 0 : opts.fileName) {
65
- const err = MicroFrontendError.convertFSError(original, opts.fileName);
65
+ const err = MicrofrontendError.convertFSError(original, opts.fileName);
66
66
  if (err) {
67
67
  return err;
68
68
  }
@@ -70,25 +70,25 @@ var MicroFrontendError = class extends Error {
70
70
  if (original.message.includes(
71
71
  "Code generation from strings disallowed for this context"
72
72
  )) {
73
- return new MicroFrontendError(original.message, {
73
+ return new MicrofrontendError(original.message, {
74
74
  type: "config",
75
75
  subtype: "unsupported_validation_env",
76
76
  source: "ajv"
77
77
  });
78
78
  }
79
- return new MicroFrontendError(original.message);
79
+ return new MicrofrontendError(original.message);
80
80
  }
81
81
  static convertFSError(original, fileName) {
82
82
  if (original instanceof Error && "code" in original) {
83
83
  if (original.code === "ENOENT") {
84
- return new MicroFrontendError(`Could not find "${fileName}"`, {
84
+ return new MicrofrontendError(`Could not find "${fileName}"`, {
85
85
  type: "config",
86
86
  subtype: "unable_to_read_file",
87
87
  source: "fs"
88
88
  });
89
89
  }
90
90
  if (original.code === "EACCES") {
91
- return new MicroFrontendError(
91
+ return new MicrofrontendError(
92
92
  `Permission denied while accessing "${fileName}"`,
93
93
  {
94
94
  type: "config",
@@ -99,7 +99,7 @@ var MicroFrontendError = class extends Error {
99
99
  }
100
100
  }
101
101
  if (original instanceof SyntaxError) {
102
- return new MicroFrontendError(
102
+ return new MicrofrontendError(
103
103
  `Failed to parse "${fileName}": Invalid JSON format.`,
104
104
  {
105
105
  type: "config",
@@ -111,23 +111,23 @@ var MicroFrontendError = class extends Error {
111
111
  return null;
112
112
  }
113
113
  /**
114
- * Handles an unknown error and returns a MicroFrontendsError instance.
114
+ * Handles an unknown error and returns a MicrofrontendsError instance.
115
115
  * @param err - The error to handle.
116
- * @returns A MicroFrontendsError instance.
116
+ * @returns A MicrofrontendsError instance.
117
117
  */
118
118
  static handle(err, opts) {
119
- if (err instanceof MicroFrontendError) {
119
+ if (err instanceof MicrofrontendError) {
120
120
  return err;
121
121
  }
122
122
  if (err instanceof Error) {
123
- return MicroFrontendError.convert(err, opts);
123
+ return MicrofrontendError.convert(err, opts);
124
124
  }
125
125
  if (typeof err === "object" && err !== null) {
126
126
  if ("message" in err && typeof err.message === "string") {
127
- return MicroFrontendError.convert(new Error(err.message), opts);
127
+ return MicrofrontendError.convert(new Error(err.message), opts);
128
128
  }
129
129
  }
130
- return new MicroFrontendError("An unknown error occurred");
130
+ return new MicrofrontendError("An unknown error occurred");
131
131
  }
132
132
  };
133
133
 
@@ -210,27 +210,27 @@ var _Overrides = class {
210
210
  });
211
211
  return overridesConfig;
212
212
  }
213
- static validOverrideDomainsForZone(microFrontendConfig, zone) {
213
+ static validOverrideDomainsForZone(microfrontendConfig, zone) {
214
214
  var _a, _b, _c, _d, _e;
215
- const projectName = (_a = microFrontendConfig.getZone(zone).vercel) == null ? void 0 : _a.projectName;
215
+ const projectName = (_a = microfrontendConfig.getZone(zone).vercel) == null ? void 0 : _a.projectName;
216
216
  if (!projectName) {
217
- return [microFrontendConfig.getZone(zone).production.host];
217
+ return [microfrontendConfig.getZone(zone).production.host];
218
218
  }
219
219
  const parsedProjectName = makeUrlSafe(projectName);
220
- const previewDeploymentSuffix = (_c = (_b = microFrontendConfig.options) == null ? void 0 : _b.vercel) == null ? void 0 : _c.previewDeploymentSuffix;
221
- const teamSlug = (_e = (_d = microFrontendConfig.options) == null ? void 0 : _d.vercel) == null ? void 0 : _e.teamSlug;
220
+ const previewDeploymentSuffix = (_c = (_b = microfrontendConfig.options) == null ? void 0 : _b.vercel) == null ? void 0 : _c.previewDeploymentSuffix;
221
+ const teamSlug = (_e = (_d = microfrontendConfig.options) == null ? void 0 : _d.vercel) == null ? void 0 : _e.teamSlug;
222
222
  if (!teamSlug && !previewDeploymentSuffix) {
223
- return [microFrontendConfig.getZone(zone).production.host];
223
+ return [microfrontendConfig.getZone(zone).production.host];
224
224
  }
225
225
  const suffix = previewDeploymentSuffix ? `.${previewDeploymentSuffix}` : `-${teamSlug}.vercel.app`;
226
226
  return [
227
227
  `${parsedProjectName}-git-([a-zA-Z0-9-]+)${suffix}`,
228
- microFrontendConfig.getZone(zone).production.host
228
+ microfrontendConfig.getZone(zone).production.host
229
229
  ];
230
230
  }
231
- static validateOverrideDomain(microFrontendConfig, zone, domain) {
231
+ static validateOverrideDomain(microfrontendConfig, zone, domain) {
232
232
  return new RegExp(
233
- `^${_Overrides.validOverrideDomainsForZone(microFrontendConfig, zone).join(
233
+ `^${_Overrides.validOverrideDomainsForZone(microfrontendConfig, zone).join(
234
234
  "|"
235
235
  )}$`
236
236
  ).test(domain);
@@ -312,7 +312,7 @@ var Application = class {
312
312
  static validate(name, app) {
313
313
  var _a, _b, _c, _d, _e;
314
314
  if (((_b = (_a = app.routing) == null ? void 0 : _a.assetPrefix) == null ? void 0 : _b.startsWith("/")) || ((_d = (_c = app.routing) == null ? void 0 : _c.assetPrefix) == null ? void 0 : _d.endsWith("/"))) {
315
- throw new MicroFrontendError(
315
+ throw new MicrofrontendError(
316
316
  `Invalid assetPrefix for application "${name}". Must not start or end with a slash.`,
317
317
  { type: "zone", subtype: "invalid_asset_prefix" }
318
318
  );
@@ -323,13 +323,13 @@ var Application = class {
323
323
  continue;
324
324
  }
325
325
  if (p.endsWith("/")) {
326
- throw new MicroFrontendError(
326
+ throw new MicrofrontendError(
327
327
  `Invalid path for application "${name}". ${p} must not end with a slash.`,
328
328
  { type: "zone", subtype: "invalid_path" }
329
329
  );
330
330
  }
331
331
  if (!p.startsWith("/")) {
332
- throw new MicroFrontendError(
332
+ throw new MicrofrontendError(
333
333
  `Invalid path for application "${name}". ${p} must start with a slash.`,
334
334
  { type: "zone", subtype: "invalid_path" }
335
335
  );
@@ -363,10 +363,10 @@ var Application = class {
363
363
  }
364
364
  };
365
365
 
366
- // src/config/common/micro-frontend-config.ts
366
+ // src/config/common/microfrontend-config.ts
367
367
  var SUPPORTED_VERSIONS = ["1"];
368
368
  var DEFAULT_LOCAL_PROXY_PORT = 3024;
369
- var MicroFrontendConfigCommon = class {
369
+ var MicrofrontendConfigCommon = class {
370
370
  constructor({
371
371
  config,
372
372
  overrides
@@ -374,7 +374,7 @@ var MicroFrontendConfigCommon = class {
374
374
  this.zones = {};
375
375
  var _a, _b, _c;
376
376
  if (!SUPPORTED_VERSIONS.includes(config.version)) {
377
- throw new MicroFrontendError(
377
+ throw new MicrofrontendError(
378
378
  `Unsupported version: ${config.version}. Supported versions are: ${SUPPORTED_VERSIONS.join(
379
379
  ", "
380
380
  )}`,
@@ -402,7 +402,7 @@ var MicroFrontendConfigCommon = class {
402
402
  static getConfigFromEnv() {
403
403
  const config = process.env.MFE_CONFIG;
404
404
  if (!config) {
405
- throw new MicroFrontendError(`Missing "MFE_CONFIG" in environment.`, {
405
+ throw new MicrofrontendError(`Missing "MFE_CONFIG" in environment.`, {
406
406
  type: "config",
407
407
  subtype: "not_found_in_env"
408
408
  });
@@ -421,8 +421,8 @@ var MicroFrontendConfigCommon = class {
421
421
  getZone(name) {
422
422
  const zone = this.zones[name];
423
423
  if (!zone) {
424
- throw new MicroFrontendError(
425
- `Could not find micro-frontends configuration for application "${name}"`,
424
+ throw new MicrofrontendError(
425
+ `Could not find microfrontends configuration for application "${name}"`,
426
426
  {
427
427
  type: "zone",
428
428
  subtype: "not_found"
@@ -442,8 +442,8 @@ var MicroFrontendConfigCommon = class {
442
442
  getDefaultZone() {
443
443
  const zone = Object.values(this.zones).find((z) => z.default);
444
444
  if (!zone) {
445
- throw new MicroFrontendError(
446
- `Could not find default zone in micro-frontends configuration`,
445
+ throw new MicrofrontendError(
446
+ `Could not find default zone in microfrontends configuration`,
447
447
  {
448
448
  type: "zone",
449
449
  subtype: "not_found"
@@ -495,8 +495,8 @@ var MicroFrontendConfigCommon = class {
495
495
  };
496
496
  }
497
497
  write(_) {
498
- throw new MicroFrontendError(
499
- `Writing to file to disk requires using an instance of "MicroFrontendConfig".`,
498
+ throw new MicrofrontendError(
499
+ `Writing to file to disk requires using an instance of "MicrofrontendConfig".`,
500
500
  { type: "config", subtype: "unsupported_operation" }
501
501
  );
502
502
  }
@@ -675,10 +675,6 @@ var schema_default = {
675
675
  flag: {
676
676
  type: "string",
677
677
  description: "flag name that can be used to enable/disable all paths in the group"
678
- },
679
- routeToDefaultApplication: {
680
- type: "boolean",
681
- description: "True to route the request to the default application for this micro-frontends set-up. This must be `true` when using `flag` or when you want to use custom logic to make the routing decision for this group of paths."
682
678
  }
683
679
  }
684
680
  },
@@ -857,7 +853,7 @@ var validateSchema = (configString) => {
857
853
  const validate = ajv.compile(SCHEMA);
858
854
  const isValid = validate(parsedConfig);
859
855
  if (!isValid) {
860
- throw new MicroFrontendError(
856
+ throw new MicrofrontendError(
861
857
  `Invalid config: ${ajv.errorsText(validate.errors)}`,
862
858
  { type: "config", subtype: "does_not_match_schema" }
863
859
  );
@@ -867,7 +863,7 @@ var validateSchema = (configString) => {
867
863
  var SUPPORTED_VERSIONS2 = ["1"];
868
864
  var validateVersion = (version) => {
869
865
  if (!SUPPORTED_VERSIONS2.includes(version)) {
870
- throw new MicroFrontendError(
866
+ throw new MicrofrontendError(
871
867
  `Unsupported version: ${version}. Supported versions are: ${SUPPORTED_VERSIONS2.join(
872
868
  ", "
873
869
  )}`,
@@ -900,7 +896,7 @@ function validateMainPath(applicationConfigsById) {
900
896
  return !matcher.test(defaultRoute);
901
897
  });
902
898
  if (!isValid) {
903
- throw new MicroFrontendError(
899
+ throw new MicrofrontendError(
904
900
  `default route "${defaultRoute}" cannot be used for "${id}" because it is matched by "${otherId}"`,
905
901
  { type: "config", subtype: "invalid_main_path" }
906
902
  );
@@ -913,7 +909,7 @@ function validateMainPath(applicationConfigsById) {
913
909
  return matcher.test(defaultRoute);
914
910
  });
915
911
  if (!isValid) {
916
- throw new MicroFrontendError(
912
+ throw new MicrofrontendError(
917
913
  `default route "${defaultRoute}" is not included by the routing config for application "${id}"`,
918
914
  { type: "config", subtype: "invalid_main_path" }
919
915
  );
@@ -976,7 +972,7 @@ var validatePaths = (applicationConfigsById) => {
976
972
  );
977
973
  });
978
974
  if (errors.length) {
979
- throw new MicroFrontendError(`Invalid paths: ${errors.join(", ")}`, {
975
+ throw new MicrofrontendError(`Invalid paths: ${errors.join(", ")}`, {
980
976
  type: "config",
981
977
  subtype: "conflicting_paths"
982
978
  });
@@ -1010,13 +1006,13 @@ function validatePathExpression(path3) {
1010
1006
  var validateDefaults = (applicationConfigsById) => {
1011
1007
  const defaultApplicationIds = Object.entries(applicationConfigsById).reduce((acc, [id, app]) => app.default ? [...acc, id] : acc, []);
1012
1008
  if (defaultApplicationIds.length === 0) {
1013
- throw new MicroFrontendError(
1009
+ throw new MicrofrontendError(
1014
1010
  `No default application found. At least one application must be marked as default.`,
1015
1011
  { type: "config", subtype: "no_default_application" }
1016
1012
  );
1017
1013
  }
1018
1014
  if (defaultApplicationIds.length > 1) {
1019
- throw new MicroFrontendError(
1015
+ throw new MicrofrontendError(
1020
1016
  `Only one default application is allowed. Found ${defaultApplicationIds.join(", ")}.`,
1021
1017
  { type: "config", subtype: "multiple_default_applications" }
1022
1018
  );
@@ -1028,7 +1024,7 @@ var validateOptions = (options) => {
1028
1024
  if (!/^[a-zA-Z]{2,}\.[a-zA-Z]{2,}$/.test(
1029
1025
  options.vercel.previewDeploymentSuffix
1030
1026
  )) {
1031
- throw new MicroFrontendError(
1027
+ throw new MicrofrontendError(
1032
1028
  `Invalid preview deployment suffix: ${options.vercel.previewDeploymentSuffix}. Should have be formatted like "vercel.app".`,
1033
1029
  { type: "config", subtype: "invalid_preview_deployment_suffix" }
1034
1030
  );
@@ -1039,11 +1035,10 @@ var validateOptions = (options) => {
1039
1035
  // src/config/utils/convert.ts
1040
1036
  function convertV1RoutingToV2Routing(routing) {
1041
1037
  return routing.matches.map((group) => {
1042
- var _a, _b;
1038
+ var _a;
1043
1039
  return {
1044
1040
  group: group.group,
1045
1041
  flag: (_a = group.options) == null ? void 0 : _a.flag,
1046
- routeToDefaultApplication: (_b = group.options) == null ? void 0 : _b.routeToDefaultApplication,
1047
1042
  paths: group.paths
1048
1043
  };
1049
1044
  });
@@ -1083,9 +1078,15 @@ function convertV1ConfigToV2Config(config, fromApp) {
1083
1078
  )
1084
1079
  };
1085
1080
  }
1081
+ const defaultApplication = Object.entries(config.applications).find(
1082
+ ([, application]) => application.default
1083
+ );
1084
+ if (!defaultApplication) {
1085
+ throw new Error("No default application found in the config");
1086
+ }
1086
1087
  return {
1087
1088
  ...common,
1088
- partOf: fromApp
1089
+ partOf: defaultApplication[0]
1089
1090
  };
1090
1091
  }
1091
1092
 
@@ -1100,8 +1101,8 @@ function writeFile(outputPath, config, prettify) {
1100
1101
  );
1101
1102
  }
1102
1103
 
1103
- // src/config/micro-frontend-config.ts
1104
- var MicroFrontendConfig = class extends MicroFrontendConfigCommon {
1104
+ // src/config/microfrontend-config.ts
1105
+ var MicrofrontendConfig = class extends MicrofrontendConfigCommon {
1105
1106
  static validate(configString) {
1106
1107
  const config = validateSchema(configString);
1107
1108
  validateVersion(config.version);
@@ -1114,9 +1115,9 @@ var MicroFrontendConfig = class extends MicroFrontendConfigCommon {
1114
1115
  static fromEnv({
1115
1116
  cookies
1116
1117
  }) {
1117
- return new MicroFrontendConfigCommon({
1118
- config: MicroFrontendConfig.validate(
1119
- MicroFrontendConfigCommon.getConfigFromEnv()
1118
+ return new MicrofrontendConfigCommon({
1119
+ config: MicrofrontendConfig.validate(
1120
+ MicrofrontendConfigCommon.getConfigFromEnv()
1120
1121
  ),
1121
1122
  overrides: Overrides.parseOverrides(cookies)
1122
1123
  });
@@ -1126,11 +1127,11 @@ var MicroFrontendConfig = class extends MicroFrontendConfigCommon {
1126
1127
  }) {
1127
1128
  try {
1128
1129
  const config = fs2.readFileSync(filePath, "utf-8");
1129
- return new MicroFrontendConfig({
1130
- config: MicroFrontendConfig.validate(config)
1130
+ return new MicrofrontendConfig({
1131
+ config: MicrofrontendConfig.validate(config)
1131
1132
  });
1132
1133
  } catch (e) {
1133
- throw MicroFrontendError.handle(e, {
1134
+ throw MicrofrontendError.handle(e, {
1134
1135
  fileName: filePath
1135
1136
  });
1136
1137
  }
@@ -1175,7 +1176,7 @@ function expandWildcards(path3) {
1175
1176
  }
1176
1177
  function loadMicrofrontendConfigForEdge(path3) {
1177
1178
  const rawMfConfig = parse2(readFileSync(path3, "utf-8"));
1178
- return new MicroFrontendConfig({ config: rawMfConfig });
1179
+ return new MicrofrontendConfig({ config: rawMfConfig });
1179
1180
  }
1180
1181
  function getAllZoneNames(mfConfig) {
1181
1182
  return mfConfig.getAllApplications().filter((app) => !app.default).map((app) => app.name);
@@ -1237,12 +1238,12 @@ function urlMatches(middlewareConfig, path3, host) {
1237
1238
  }
1238
1239
  return false;
1239
1240
  }
1240
- function validateMiddlewareConfig(middlewareConfig, microFrontendConfigOrPath, extraProductionMatches) {
1241
+ function validateMiddlewareConfig(middlewareConfig, microfrontendConfigOrPath, extraProductionMatches) {
1241
1242
  var _a, _b;
1242
- const microFrontendConfig = typeof microFrontendConfigOrPath === "string" ? loadMicrofrontendConfigForEdge(microFrontendConfigOrPath) : microFrontendConfigOrPath;
1243
+ const microfrontendConfig = typeof microfrontendConfigOrPath === "string" ? loadMicrofrontendConfigForEdge(microfrontendConfigOrPath) : microfrontendConfigOrPath;
1243
1244
  const errors = [];
1244
1245
  const usedExtraProductionMatches = /* @__PURE__ */ new Set();
1245
- for (const application of microFrontendConfig.getAllApplications()) {
1246
+ for (const application of microfrontendConfig.getAllApplications()) {
1246
1247
  if ((_a = application.routing) == null ? void 0 : _a.matches) {
1247
1248
  const matches = [...application.routing.matches];
1248
1249
  if (application.routing.assetPrefix) {
@@ -1259,14 +1260,14 @@ function validateMiddlewareConfig(middlewareConfig, microFrontendConfigOrPath, e
1259
1260
  if (!urlMatches(middlewareConfig, testPath, "test.nonproduction.host")) {
1260
1261
  errors.push(
1261
1262
  `Matcher misconfigured for ${pathForDisplay}. This path should have matched the middleware config on a non-production host, but did not. Microfrontends require a middleware config matcher that matches on this host everywhere but in production. That can be configured with a configuration like this:
1262
- ${getSampleMatcher(path3, microFrontendConfig.getDefaultZone().production.host)}`
1263
+ ${getSampleMatcher(path3, microfrontendConfig.getDefaultZone().production.host)}`
1263
1264
  );
1264
1265
  break;
1265
1266
  }
1266
1267
  const productionUrlMatches = urlMatches(
1267
1268
  middlewareConfig,
1268
1269
  testPath,
1269
- microFrontendConfig.getDefaultZone().production.host
1270
+ microfrontendConfig.getDefaultZone().production.host
1270
1271
  );
1271
1272
  if (isFlagged) {
1272
1273
  if (!productionUrlMatches) {
@@ -1281,7 +1282,7 @@ ${getSampleMatcher(path3, microFrontendConfig.getDefaultZone().production.host)}
1281
1282
  } else {
1282
1283
  errors.push(
1283
1284
  `Matcher misconfigured for ${pathForDisplay}. This path matched the middleware config on a production host, but should not have. Microfrontends require a middleware config matcher that matches on this host everywhere but in production. If this is desired, you can add the path the to extraProductionMatches parameter. Otherwise, you can set up a configuration like this:
1284
- ${getSampleMatcher(path3, microFrontendConfig.getDefaultZone().production.host)}`
1285
+ ${getSampleMatcher(path3, microfrontendConfig.getDefaultZone().production.host)}`
1285
1286
  );
1286
1287
  }
1287
1288
  break;
@@ -1300,7 +1301,7 @@ ${getSampleMatcher(path3, microFrontendConfig.getDefaultZone().production.host)}
1300
1301
  );
1301
1302
  }
1302
1303
  if (errors.length > 0) {
1303
- const message = `Found the following inconsistencies between your microfrontend config ${typeof microFrontendConfigOrPath === "string" ? `(at ${microFrontendConfigOrPath}) ` : ""}and middleware config:
1304
+ const message = `Found the following inconsistencies between your microfrontend config ${typeof microfrontendConfigOrPath === "string" ? `(at ${microfrontendConfigOrPath}) ` : ""}and middleware config:
1304
1305
 
1305
1306
  - `;
1306
1307
  throw new Error(message + errors.join("\n\n- "));
@@ -1316,26 +1317,26 @@ function getSampleMatcher(path3, host) {
1316
1317
  ],
1317
1318
  }`;
1318
1319
  }
1319
- async function validateMiddlewareOnFlaggedPaths(microFrontendConfigOrPath, middleware) {
1320
+ async function validateMiddlewareOnFlaggedPaths(microfrontendConfigOrPath, middleware) {
1320
1321
  const initialEnv = process.env.VERCEL_ENV;
1321
1322
  const initialMfePreviewDomains = process.env.MFE_PREVIEW_DOMAINS;
1322
1323
  try {
1323
- const microFrontendConfig = typeof microFrontendConfigOrPath === "string" ? loadMicrofrontendConfigForEdge(microFrontendConfigOrPath) : microFrontendConfigOrPath;
1324
- const fakePreviewDomains = createFakePreviewDomains(microFrontendConfig);
1324
+ const microfrontendConfig = typeof microfrontendConfigOrPath === "string" ? loadMicrofrontendConfigForEdge(microfrontendConfigOrPath) : microfrontendConfigOrPath;
1325
+ const fakePreviewDomains = createFakePreviewDomains(microfrontendConfig);
1325
1326
  process.env.MFE_PREVIEW_DOMAINS = JSON.stringify(fakePreviewDomains);
1326
- const allZoneNames = getAllZoneNames(microFrontendConfig);
1327
+ const allZoneNames = getAllZoneNames(microfrontendConfig);
1327
1328
  const errors = [];
1328
1329
  for (const zoneName of allZoneNames) {
1329
1330
  const flaggedPaths = getFlaggedPathsForZone(
1330
- microFrontendConfig,
1331
+ microfrontendConfig,
1331
1332
  zoneName
1332
1333
  );
1333
1334
  if (flaggedPaths.length) {
1334
1335
  for (const env of ["preview", "production"]) {
1335
1336
  process.env.VERCEL_ENV = env;
1336
1337
  for (const path3 of flaggedPaths) {
1337
- const expectedHost = env === "preview" ? fakePreviewDomains[zoneName] : getExpectedDomainForZone(microFrontendConfig, zoneName, env);
1338
- const requestPath = `https://${microFrontendConfig.getDefaultZone().production.host}${path3}`;
1338
+ const expectedHost = env === "preview" ? fakePreviewDomains[zoneName] : getExpectedDomainForZone(microfrontendConfig, zoneName, env);
1339
+ const requestPath = `https://${microfrontendConfig.getDefaultZone().production.host}${path3}`;
1339
1340
  const request = new NextRequest(requestPath, {
1340
1341
  headers: { "x-vercel-skip-deployment-existence-check": "1" }
1341
1342
  });