@vercel/microfrontends 0.9.0 → 0.10.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.
Files changed (78) hide show
  1. package/README.md +2 -2
  2. package/dist/bin/cli.cjs +1483 -186
  3. package/dist/config/edge.cjs +47 -47
  4. package/dist/config/edge.cjs.map +1 -1
  5. package/dist/config/edge.d.ts +6 -6
  6. package/dist/config/edge.js +46 -46
  7. package/dist/config/edge.js.map +1 -1
  8. package/dist/config.cjs +66 -60
  9. package/dist/config.cjs.map +1 -1
  10. package/dist/config.d.ts +3 -3
  11. package/dist/config.js +65 -59
  12. package/dist/config.js.map +1 -1
  13. package/dist/{index-eff254d8.d.ts → index-05742bef.d.ts} +11 -22
  14. package/dist/{micro-frontend-config-42886104.d.ts → microfrontend-config-2425db74.d.ts} +12 -12
  15. package/dist/next/config.cjs +83 -77
  16. package/dist/next/config.cjs.map +1 -1
  17. package/dist/next/config.d.ts +3 -3
  18. package/dist/next/config.js +82 -76
  19. package/dist/next/config.js.map +1 -1
  20. package/dist/next/middleware.cjs +55 -55
  21. package/dist/next/middleware.cjs.map +1 -1
  22. package/dist/next/middleware.d.ts +11 -11
  23. package/dist/next/middleware.js +53 -53
  24. package/dist/next/middleware.js.map +1 -1
  25. package/dist/next/testing.cjs +79 -73
  26. package/dist/next/testing.cjs.map +1 -1
  27. package/dist/next/testing.d.ts +9 -9
  28. package/dist/next/testing.js +79 -73
  29. package/dist/next/testing.js.map +1 -1
  30. package/dist/overrides.cjs +9 -9
  31. package/dist/overrides.cjs.map +1 -1
  32. package/dist/overrides.d.ts +1 -1
  33. package/dist/overrides.js +9 -9
  34. package/dist/overrides.js.map +1 -1
  35. package/dist/types-13f3e535.d.ts +15 -0
  36. package/dist/v2/config.cjs +39 -39
  37. package/dist/v2/config.cjs.map +1 -1
  38. package/dist/v2/config.d.ts +2 -1
  39. package/dist/v2/config.js +38 -38
  40. package/dist/v2/config.js.map +1 -1
  41. package/dist/v2/microfrontends/server.cjs +102 -65
  42. package/dist/v2/microfrontends/server.cjs.map +1 -1
  43. package/dist/v2/microfrontends/server.d.ts +6 -1
  44. package/dist/v2/microfrontends/server.js +102 -65
  45. package/dist/v2/microfrontends/server.js.map +1 -1
  46. package/dist/v2/microfrontends.cjs +44 -44
  47. package/dist/v2/microfrontends.cjs.map +1 -1
  48. package/dist/v2/microfrontends.d.ts +5 -4
  49. package/dist/v2/microfrontends.js +44 -44
  50. package/dist/v2/microfrontends.js.map +1 -1
  51. package/dist/v2/next/client.cjs +1 -1
  52. package/dist/v2/next/client.cjs.map +1 -1
  53. package/dist/v2/next/client.js +1 -1
  54. package/dist/v2/next/client.js.map +1 -1
  55. package/dist/v2/next/config.cjs +120 -83
  56. package/dist/v2/next/config.cjs.map +1 -1
  57. package/dist/v2/next/config.d.ts +4 -4
  58. package/dist/v2/next/config.js +119 -82
  59. package/dist/v2/next/config.js.map +1 -1
  60. package/dist/v2/next/endpoints.cjs +5 -5
  61. package/dist/v2/next/endpoints.cjs.map +1 -1
  62. package/dist/v2/next/endpoints.js +5 -5
  63. package/dist/v2/next/endpoints.js.map +1 -1
  64. package/dist/v2/next/middleware.cjs +54 -54
  65. package/dist/v2/next/middleware.cjs.map +1 -1
  66. package/dist/v2/next/middleware.d.ts +8 -8
  67. package/dist/v2/next/middleware.js +52 -52
  68. package/dist/v2/next/middleware.js.map +1 -1
  69. package/dist/v2/overrides.cjs +75 -0
  70. package/dist/v2/overrides.cjs.map +1 -0
  71. package/dist/v2/overrides.d.ts +24 -0
  72. package/dist/v2/overrides.js +45 -0
  73. package/dist/v2/overrides.js.map +1 -0
  74. package/dist/validation.cjs +20 -20
  75. package/dist/validation.cjs.map +1 -1
  76. package/dist/validation.js +20 -20
  77. package/dist/validation.js.map +1 -1
  78. package/package.json +10 -3
@@ -1,7 +1,7 @@
1
1
  // src/next/config/index.ts
2
2
  import fs3 from "node:fs";
3
3
 
4
- // src/config/micro-frontend-config.ts
4
+ // src/config/microfrontend-config.ts
5
5
  import fs2 from "node:fs";
6
6
 
7
7
  // src/config-v2/microfrontends/server/utils/get-output-file-path.ts
@@ -29,14 +29,14 @@ function getOutputFilePath() {
29
29
  }
30
30
 
31
31
  // src/config/errors.ts
32
- var MicroFrontendError = class extends Error {
32
+ var MicrofrontendError = class extends Error {
33
33
  constructor(message, opts) {
34
34
  super(message);
35
- this.name = "MicroFrontendsError";
36
- this.source = (opts == null ? void 0 : opts.source) ?? "@vercel/micro-frontends";
35
+ this.name = "MicrofrontendsError";
36
+ this.source = (opts == null ? void 0 : opts.source) ?? "@vercel/microfrontends";
37
37
  this.type = (opts == null ? void 0 : opts.type) ?? "unknown";
38
38
  this.subtype = opts == null ? void 0 : opts.subtype;
39
- Error.captureStackTrace(this, MicroFrontendError);
39
+ Error.captureStackTrace(this, MicrofrontendError);
40
40
  }
41
41
  isKnown() {
42
42
  return this.type !== "unknown";
@@ -45,13 +45,13 @@ var MicroFrontendError = class extends Error {
45
45
  return !this.isKnown();
46
46
  }
47
47
  /**
48
- * Converts an error to a MicroFrontendsError.
48
+ * Converts an error to a MicrofrontendsError.
49
49
  * @param original - The original error to convert.
50
- * @returns The converted MicroFrontendsError.
50
+ * @returns The converted MicrofrontendsError.
51
51
  */
52
52
  static convert(original, opts) {
53
53
  if (opts == null ? void 0 : opts.fileName) {
54
- const err = MicroFrontendError.convertFSError(original, opts.fileName);
54
+ const err = MicrofrontendError.convertFSError(original, opts.fileName);
55
55
  if (err) {
56
56
  return err;
57
57
  }
@@ -59,25 +59,25 @@ var MicroFrontendError = class extends Error {
59
59
  if (original.message.includes(
60
60
  "Code generation from strings disallowed for this context"
61
61
  )) {
62
- return new MicroFrontendError(original.message, {
62
+ return new MicrofrontendError(original.message, {
63
63
  type: "config",
64
64
  subtype: "unsupported_validation_env",
65
65
  source: "ajv"
66
66
  });
67
67
  }
68
- return new MicroFrontendError(original.message);
68
+ return new MicrofrontendError(original.message);
69
69
  }
70
70
  static convertFSError(original, fileName) {
71
71
  if (original instanceof Error && "code" in original) {
72
72
  if (original.code === "ENOENT") {
73
- return new MicroFrontendError(`Could not find "${fileName}"`, {
73
+ return new MicrofrontendError(`Could not find "${fileName}"`, {
74
74
  type: "config",
75
75
  subtype: "unable_to_read_file",
76
76
  source: "fs"
77
77
  });
78
78
  }
79
79
  if (original.code === "EACCES") {
80
- return new MicroFrontendError(
80
+ return new MicrofrontendError(
81
81
  `Permission denied while accessing "${fileName}"`,
82
82
  {
83
83
  type: "config",
@@ -88,7 +88,7 @@ var MicroFrontendError = class extends Error {
88
88
  }
89
89
  }
90
90
  if (original instanceof SyntaxError) {
91
- return new MicroFrontendError(
91
+ return new MicrofrontendError(
92
92
  `Failed to parse "${fileName}": Invalid JSON format.`,
93
93
  {
94
94
  type: "config",
@@ -100,23 +100,23 @@ var MicroFrontendError = class extends Error {
100
100
  return null;
101
101
  }
102
102
  /**
103
- * Handles an unknown error and returns a MicroFrontendsError instance.
103
+ * Handles an unknown error and returns a MicrofrontendsError instance.
104
104
  * @param err - The error to handle.
105
- * @returns A MicroFrontendsError instance.
105
+ * @returns A MicrofrontendsError instance.
106
106
  */
107
107
  static handle(err, opts) {
108
- if (err instanceof MicroFrontendError) {
108
+ if (err instanceof MicrofrontendError) {
109
109
  return err;
110
110
  }
111
111
  if (err instanceof Error) {
112
- return MicroFrontendError.convert(err, opts);
112
+ return MicrofrontendError.convert(err, opts);
113
113
  }
114
114
  if (typeof err === "object" && err !== null) {
115
115
  if ("message" in err && typeof err.message === "string") {
116
- return MicroFrontendError.convert(new Error(err.message), opts);
116
+ return MicrofrontendError.convert(new Error(err.message), opts);
117
117
  }
118
118
  }
119
- return new MicroFrontendError("An unknown error occurred");
119
+ return new MicrofrontendError("An unknown error occurred");
120
120
  }
121
121
  };
122
122
 
@@ -199,27 +199,27 @@ var _Overrides = class {
199
199
  });
200
200
  return overridesConfig;
201
201
  }
202
- static validOverrideDomainsForZone(microFrontendConfig, zone) {
202
+ static validOverrideDomainsForZone(microfrontendConfig, zone) {
203
203
  var _a, _b, _c, _d, _e;
204
- const projectName = (_a = microFrontendConfig.getZone(zone).vercel) == null ? void 0 : _a.projectName;
204
+ const projectName = (_a = microfrontendConfig.getZone(zone).vercel) == null ? void 0 : _a.projectName;
205
205
  if (!projectName) {
206
- return [microFrontendConfig.getZone(zone).production.host];
206
+ return [microfrontendConfig.getZone(zone).production.host];
207
207
  }
208
208
  const parsedProjectName = makeUrlSafe(projectName);
209
- const previewDeploymentSuffix = (_c = (_b = microFrontendConfig.options) == null ? void 0 : _b.vercel) == null ? void 0 : _c.previewDeploymentSuffix;
210
- const teamSlug = (_e = (_d = microFrontendConfig.options) == null ? void 0 : _d.vercel) == null ? void 0 : _e.teamSlug;
209
+ const previewDeploymentSuffix = (_c = (_b = microfrontendConfig.options) == null ? void 0 : _b.vercel) == null ? void 0 : _c.previewDeploymentSuffix;
210
+ const teamSlug = (_e = (_d = microfrontendConfig.options) == null ? void 0 : _d.vercel) == null ? void 0 : _e.teamSlug;
211
211
  if (!teamSlug && !previewDeploymentSuffix) {
212
- return [microFrontendConfig.getZone(zone).production.host];
212
+ return [microfrontendConfig.getZone(zone).production.host];
213
213
  }
214
214
  const suffix = previewDeploymentSuffix ? `.${previewDeploymentSuffix}` : `-${teamSlug}.vercel.app`;
215
215
  return [
216
216
  `${parsedProjectName}-git-([a-zA-Z0-9-]+)${suffix}`,
217
- microFrontendConfig.getZone(zone).production.host
217
+ microfrontendConfig.getZone(zone).production.host
218
218
  ];
219
219
  }
220
- static validateOverrideDomain(microFrontendConfig, zone, domain) {
220
+ static validateOverrideDomain(microfrontendConfig, zone, domain) {
221
221
  return new RegExp(
222
- `^${_Overrides.validOverrideDomainsForZone(microFrontendConfig, zone).join(
222
+ `^${_Overrides.validOverrideDomainsForZone(microfrontendConfig, zone).join(
223
223
  "|"
224
224
  )}$`
225
225
  ).test(domain);
@@ -301,7 +301,7 @@ var Application = class {
301
301
  static validate(name, app) {
302
302
  var _a, _b, _c, _d, _e;
303
303
  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("/"))) {
304
- throw new MicroFrontendError(
304
+ throw new MicrofrontendError(
305
305
  `Invalid assetPrefix for application "${name}". Must not start or end with a slash.`,
306
306
  { type: "zone", subtype: "invalid_asset_prefix" }
307
307
  );
@@ -312,13 +312,13 @@ var Application = class {
312
312
  continue;
313
313
  }
314
314
  if (p.endsWith("/")) {
315
- throw new MicroFrontendError(
315
+ throw new MicrofrontendError(
316
316
  `Invalid path for application "${name}". ${p} must not end with a slash.`,
317
317
  { type: "zone", subtype: "invalid_path" }
318
318
  );
319
319
  }
320
320
  if (!p.startsWith("/")) {
321
- throw new MicroFrontendError(
321
+ throw new MicrofrontendError(
322
322
  `Invalid path for application "${name}". ${p} must start with a slash.`,
323
323
  { type: "zone", subtype: "invalid_path" }
324
324
  );
@@ -352,10 +352,10 @@ var Application = class {
352
352
  }
353
353
  };
354
354
 
355
- // src/config/common/micro-frontend-config.ts
355
+ // src/config/common/microfrontend-config.ts
356
356
  var SUPPORTED_VERSIONS = ["1"];
357
357
  var DEFAULT_LOCAL_PROXY_PORT = 3024;
358
- var MicroFrontendConfigCommon = class {
358
+ var MicrofrontendConfigCommon = class {
359
359
  constructor({
360
360
  config,
361
361
  overrides
@@ -363,7 +363,7 @@ var MicroFrontendConfigCommon = class {
363
363
  this.zones = {};
364
364
  var _a, _b, _c;
365
365
  if (!SUPPORTED_VERSIONS.includes(config.version)) {
366
- throw new MicroFrontendError(
366
+ throw new MicrofrontendError(
367
367
  `Unsupported version: ${config.version}. Supported versions are: ${SUPPORTED_VERSIONS.join(
368
368
  ", "
369
369
  )}`,
@@ -391,7 +391,7 @@ var MicroFrontendConfigCommon = class {
391
391
  static getConfigFromEnv() {
392
392
  const config = process.env.MFE_CONFIG;
393
393
  if (!config) {
394
- throw new MicroFrontendError(`Missing "MFE_CONFIG" in environment.`, {
394
+ throw new MicrofrontendError(`Missing "MFE_CONFIG" in environment.`, {
395
395
  type: "config",
396
396
  subtype: "not_found_in_env"
397
397
  });
@@ -410,8 +410,8 @@ var MicroFrontendConfigCommon = class {
410
410
  getZone(name) {
411
411
  const zone = this.zones[name];
412
412
  if (!zone) {
413
- throw new MicroFrontendError(
414
- `Could not find micro-frontends configuration for application "${name}"`,
413
+ throw new MicrofrontendError(
414
+ `Could not find microfrontends configuration for application "${name}"`,
415
415
  {
416
416
  type: "zone",
417
417
  subtype: "not_found"
@@ -431,8 +431,8 @@ var MicroFrontendConfigCommon = class {
431
431
  getDefaultZone() {
432
432
  const zone = Object.values(this.zones).find((z) => z.default);
433
433
  if (!zone) {
434
- throw new MicroFrontendError(
435
- `Could not find default zone in micro-frontends configuration`,
434
+ throw new MicrofrontendError(
435
+ `Could not find default zone in microfrontends configuration`,
436
436
  {
437
437
  type: "zone",
438
438
  subtype: "not_found"
@@ -484,8 +484,8 @@ var MicroFrontendConfigCommon = class {
484
484
  };
485
485
  }
486
486
  write(_) {
487
- throw new MicroFrontendError(
488
- `Writing to file to disk requires using an instance of "MicroFrontendConfig".`,
487
+ throw new MicrofrontendError(
488
+ `Writing to file to disk requires using an instance of "MicrofrontendConfig".`,
489
489
  { type: "config", subtype: "unsupported_operation" }
490
490
  );
491
491
  }
@@ -849,7 +849,7 @@ var validateSchema = (configString) => {
849
849
  const validate = ajv.compile(SCHEMA);
850
850
  const isValid = validate(parsedConfig);
851
851
  if (!isValid) {
852
- throw new MicroFrontendError(
852
+ throw new MicrofrontendError(
853
853
  `Invalid config: ${ajv.errorsText(validate.errors)}`,
854
854
  { type: "config", subtype: "does_not_match_schema" }
855
855
  );
@@ -859,7 +859,7 @@ var validateSchema = (configString) => {
859
859
  var SUPPORTED_VERSIONS2 = ["1"];
860
860
  var validateVersion = (version) => {
861
861
  if (!SUPPORTED_VERSIONS2.includes(version)) {
862
- throw new MicroFrontendError(
862
+ throw new MicrofrontendError(
863
863
  `Unsupported version: ${version}. Supported versions are: ${SUPPORTED_VERSIONS2.join(
864
864
  ", "
865
865
  )}`,
@@ -892,7 +892,7 @@ function validateMainPath(applicationConfigsById) {
892
892
  return !matcher.test(defaultRoute);
893
893
  });
894
894
  if (!isValid) {
895
- throw new MicroFrontendError(
895
+ throw new MicrofrontendError(
896
896
  `default route "${defaultRoute}" cannot be used for "${id}" because it is matched by "${otherId}"`,
897
897
  { type: "config", subtype: "invalid_main_path" }
898
898
  );
@@ -905,7 +905,7 @@ function validateMainPath(applicationConfigsById) {
905
905
  return matcher.test(defaultRoute);
906
906
  });
907
907
  if (!isValid) {
908
- throw new MicroFrontendError(
908
+ throw new MicrofrontendError(
909
909
  `default route "${defaultRoute}" is not included by the routing config for application "${id}"`,
910
910
  { type: "config", subtype: "invalid_main_path" }
911
911
  );
@@ -968,7 +968,7 @@ var validatePaths = (applicationConfigsById) => {
968
968
  );
969
969
  });
970
970
  if (errors.length) {
971
- throw new MicroFrontendError(`Invalid paths: ${errors.join(", ")}`, {
971
+ throw new MicrofrontendError(`Invalid paths: ${errors.join(", ")}`, {
972
972
  type: "config",
973
973
  subtype: "conflicting_paths"
974
974
  });
@@ -1002,13 +1002,13 @@ function validatePathExpression(path3) {
1002
1002
  var validateDefaults = (applicationConfigsById) => {
1003
1003
  const defaultApplicationIds = Object.entries(applicationConfigsById).reduce((acc, [id, app]) => app.default ? [...acc, id] : acc, []);
1004
1004
  if (defaultApplicationIds.length === 0) {
1005
- throw new MicroFrontendError(
1005
+ throw new MicrofrontendError(
1006
1006
  `No default application found. At least one application must be marked as default.`,
1007
1007
  { type: "config", subtype: "no_default_application" }
1008
1008
  );
1009
1009
  }
1010
1010
  if (defaultApplicationIds.length > 1) {
1011
- throw new MicroFrontendError(
1011
+ throw new MicrofrontendError(
1012
1012
  `Only one default application is allowed. Found ${defaultApplicationIds.join(", ")}.`,
1013
1013
  { type: "config", subtype: "multiple_default_applications" }
1014
1014
  );
@@ -1020,7 +1020,7 @@ var validateOptions = (options) => {
1020
1020
  if (!/^[a-zA-Z]{2,}\.[a-zA-Z]{2,}$/.test(
1021
1021
  options.vercel.previewDeploymentSuffix
1022
1022
  )) {
1023
- throw new MicroFrontendError(
1023
+ throw new MicrofrontendError(
1024
1024
  `Invalid preview deployment suffix: ${options.vercel.previewDeploymentSuffix}. Should have be formatted like "vercel.app".`,
1025
1025
  { type: "config", subtype: "invalid_preview_deployment_suffix" }
1026
1026
  );
@@ -1075,9 +1075,15 @@ function convertV1ConfigToV2Config(config, fromApp) {
1075
1075
  )
1076
1076
  };
1077
1077
  }
1078
+ const defaultApplication = Object.entries(config.applications).find(
1079
+ ([, application]) => application.default
1080
+ );
1081
+ if (!defaultApplication) {
1082
+ throw new Error("No default application found in the config");
1083
+ }
1078
1084
  return {
1079
1085
  ...common,
1080
- partOf: fromApp
1086
+ partOf: defaultApplication[0]
1081
1087
  };
1082
1088
  }
1083
1089
 
@@ -1092,8 +1098,8 @@ function writeFile(outputPath, config, prettify) {
1092
1098
  );
1093
1099
  }
1094
1100
 
1095
- // src/config/micro-frontend-config.ts
1096
- var MicroFrontendConfig = class extends MicroFrontendConfigCommon {
1101
+ // src/config/microfrontend-config.ts
1102
+ var MicrofrontendConfig = class extends MicrofrontendConfigCommon {
1097
1103
  static validate(configString) {
1098
1104
  const config = validateSchema(configString);
1099
1105
  validateVersion(config.version);
@@ -1106,9 +1112,9 @@ var MicroFrontendConfig = class extends MicroFrontendConfigCommon {
1106
1112
  static fromEnv({
1107
1113
  cookies
1108
1114
  }) {
1109
- return new MicroFrontendConfigCommon({
1110
- config: MicroFrontendConfig.validate(
1111
- MicroFrontendConfigCommon.getConfigFromEnv()
1115
+ return new MicrofrontendConfigCommon({
1116
+ config: MicrofrontendConfig.validate(
1117
+ MicrofrontendConfigCommon.getConfigFromEnv()
1112
1118
  ),
1113
1119
  overrides: Overrides.parseOverrides(cookies)
1114
1120
  });
@@ -1118,11 +1124,11 @@ var MicroFrontendConfig = class extends MicroFrontendConfigCommon {
1118
1124
  }) {
1119
1125
  try {
1120
1126
  const config = fs2.readFileSync(filePath, "utf-8");
1121
- return new MicroFrontendConfig({
1122
- config: MicroFrontendConfig.validate(config)
1127
+ return new MicrofrontendConfig({
1128
+ config: MicrofrontendConfig.validate(config)
1123
1129
  });
1124
1130
  } catch (e) {
1125
- throw MicroFrontendError.handle(e, {
1131
+ throw MicrofrontendError.handle(e, {
1126
1132
  fileName: filePath
1127
1133
  });
1128
1134
  }
@@ -1407,7 +1413,7 @@ function rewritesMapToArr(rewrites) {
1407
1413
  });
1408
1414
  }
1409
1415
  function transform4(args) {
1410
- const { next, microFrontend, zone } = args;
1416
+ const { next, microfrontend, zone } = args;
1411
1417
  const buildBeforeFiles = () => {
1412
1418
  var _a, _b, _c, _d, _e;
1413
1419
  const rewrites = /* @__PURE__ */ new Map();
@@ -1424,7 +1430,7 @@ function transform4(args) {
1424
1430
  }
1425
1431
  }
1426
1432
  if (zone.isDefault()) {
1427
- for (const [_, z] of Object.entries(microFrontend.zones)) {
1433
+ for (const [_, z] of Object.entries(microfrontend.zones)) {
1428
1434
  if (zone.name === z.name) {
1429
1435
  continue;
1430
1436
  }
@@ -1498,14 +1504,14 @@ function transform4(args) {
1498
1504
  var formatDomainForServerAction = (domain) => domain.replace(/https?:\/\//, "");
1499
1505
  function transform5(args) {
1500
1506
  var _a;
1501
- const { next, zone, microFrontend } = args;
1507
+ const { next, zone, microfrontend } = args;
1502
1508
  const zonesToAllow = [
1503
1509
  // this zone - this is included by default unless allowedOrigins is overridden (which we are)
1504
1510
  // so we re-add it here.
1505
1511
  zone,
1506
- // this is the default zone for the micro-frontend. Allow child zones to call server actions
1512
+ // this is the default zone for the microfrontend. Allow child zones to call server actions
1507
1513
  // that are in the default zone.
1508
- microFrontend.getDefaultZone()
1514
+ microfrontend.getDefaultZone()
1509
1515
  ];
1510
1516
  const existingServerActionConfig = (_a = next.experimental) == null ? void 0 : _a.serverActions;
1511
1517
  next.experimental = {
@@ -1530,8 +1536,8 @@ function transform5(args) {
1530
1536
 
1531
1537
  // src/next/config/transforms/webpack.ts
1532
1538
  function transform6(args) {
1533
- const { next, microFrontend } = args;
1534
- const previewDomains = process.env.VERCEL_ENV === "preview" ? microFrontend.getAllApplications().reduce(
1539
+ const { next, microfrontend } = args;
1540
+ const previewDomains = process.env.VERCEL_ENV === "preview" ? microfrontend.getAllApplications().reduce(
1535
1541
  (obj, app) => {
1536
1542
  obj[app.name] = getPreviewDomain(app);
1537
1543
  return obj;
@@ -1547,7 +1553,7 @@ function transform6(args) {
1547
1553
  if (isServer || nextRuntime === "edge") {
1548
1554
  config.plugins.push(
1549
1555
  new wpFromNext.EnvironmentPlugin({
1550
- MFE_CONFIG: JSON.stringify(microFrontend.serialize()),
1556
+ MFE_CONFIG: JSON.stringify(microfrontend.serialize()),
1551
1557
  MFE_PREVIEW_DOMAINS: JSON.stringify(previewDomains)
1552
1558
  })
1553
1559
  );
@@ -1674,18 +1680,18 @@ function getConfigPath(opts) {
1674
1680
  const vercelJsonString = fs3.readFileSync("./vercel.json", "utf-8");
1675
1681
  const vercelJson = JSON.parse(vercelJsonString);
1676
1682
  if (!((_a = vercelJson.microFrontends) == null ? void 0 : _a.config)) {
1677
- throw new MicroFrontendError(
1683
+ throw new MicrofrontendError(
1678
1684
  `vercel.json file missing required field "microFrontends.config"`,
1679
1685
  {
1680
1686
  type: "vercelJson",
1681
1687
  subtype: "missing_field_microFrontend_config_path",
1682
- source: "@vercel/micro-frontends/next"
1688
+ source: "@vercel/microfrontends/next"
1683
1689
  }
1684
1690
  );
1685
1691
  }
1686
1692
  return { configPath: vercelJson.microFrontends.config };
1687
1693
  } catch (err) {
1688
- throw MicroFrontendError.handle(err, {
1694
+ throw MicrofrontendError.handle(err, {
1689
1695
  fileName: "vercel.json"
1690
1696
  });
1691
1697
  }
@@ -1698,30 +1704,30 @@ function getApplicationContext(opts) {
1698
1704
  const packageJsonString = fs3.readFileSync("./package.json", "utf-8");
1699
1705
  const packageJson = JSON.parse(packageJsonString);
1700
1706
  if (!packageJson.name) {
1701
- throw new MicroFrontendError(
1707
+ throw new MicrofrontendError(
1702
1708
  `package.json file missing required field "name"`,
1703
1709
  {
1704
1710
  type: "packageJson",
1705
1711
  subtype: "missing_field_name",
1706
- source: "@vercel/micro-frontends/next"
1712
+ source: "@vercel/microfrontends/next"
1707
1713
  }
1708
1714
  );
1709
1715
  }
1710
1716
  return { name: packageJson.name };
1711
1717
  } catch (err) {
1712
- throw MicroFrontendError.handle(err, {
1718
+ throw MicrofrontendError.handle(err, {
1713
1719
  fileName: "package.json"
1714
1720
  });
1715
1721
  }
1716
1722
  }
1717
- function withMicroFrontends(nextConfig, opts) {
1723
+ function withMicrofrontends(nextConfig, opts) {
1718
1724
  var _a;
1719
1725
  if (opts == null ? void 0 : opts.debug) {
1720
1726
  process.env.MFE_DEBUG = "true";
1721
1727
  }
1722
1728
  const { name } = getApplicationContext(opts);
1723
1729
  const { configPath } = getConfigPath(opts);
1724
- const mfConfig = MicroFrontendConfig.fromFile({
1730
+ const mfConfig = MicrofrontendConfig.fromFile({
1725
1731
  filePath: configPath
1726
1732
  });
1727
1733
  const zone = mfConfig.getZone(name);
@@ -1736,7 +1742,7 @@ function withMicroFrontends(nextConfig, opts) {
1736
1742
  const transformedConfig = transform7({
1737
1743
  zone,
1738
1744
  next,
1739
- microFrontend: mfConfig,
1745
+ microfrontend: mfConfig,
1740
1746
  opts: {
1741
1747
  isProduction: isProduction(opts)
1742
1748
  }
@@ -1753,6 +1759,6 @@ function withMicroFrontends(nextConfig, opts) {
1753
1759
  return next;
1754
1760
  }
1755
1761
  export {
1756
- withMicroFrontends
1762
+ withMicrofrontends
1757
1763
  };
1758
1764
  //# sourceMappingURL=config.js.map