@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
@@ -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
  }
@@ -667,10 +667,6 @@ var schema_default = {
667
667
  flag: {
668
668
  type: "string",
669
669
  description: "flag name that can be used to enable/disable all paths in the group"
670
- },
671
- routeToDefaultApplication: {
672
- type: "boolean",
673
- 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."
674
670
  }
675
671
  }
676
672
  },
@@ -849,7 +845,7 @@ var validateSchema = (configString) => {
849
845
  const validate = ajv.compile(SCHEMA);
850
846
  const isValid = validate(parsedConfig);
851
847
  if (!isValid) {
852
- throw new MicroFrontendError(
848
+ throw new MicrofrontendError(
853
849
  `Invalid config: ${ajv.errorsText(validate.errors)}`,
854
850
  { type: "config", subtype: "does_not_match_schema" }
855
851
  );
@@ -859,7 +855,7 @@ var validateSchema = (configString) => {
859
855
  var SUPPORTED_VERSIONS2 = ["1"];
860
856
  var validateVersion = (version) => {
861
857
  if (!SUPPORTED_VERSIONS2.includes(version)) {
862
- throw new MicroFrontendError(
858
+ throw new MicrofrontendError(
863
859
  `Unsupported version: ${version}. Supported versions are: ${SUPPORTED_VERSIONS2.join(
864
860
  ", "
865
861
  )}`,
@@ -892,7 +888,7 @@ function validateMainPath(applicationConfigsById) {
892
888
  return !matcher.test(defaultRoute);
893
889
  });
894
890
  if (!isValid) {
895
- throw new MicroFrontendError(
891
+ throw new MicrofrontendError(
896
892
  `default route "${defaultRoute}" cannot be used for "${id}" because it is matched by "${otherId}"`,
897
893
  { type: "config", subtype: "invalid_main_path" }
898
894
  );
@@ -905,7 +901,7 @@ function validateMainPath(applicationConfigsById) {
905
901
  return matcher.test(defaultRoute);
906
902
  });
907
903
  if (!isValid) {
908
- throw new MicroFrontendError(
904
+ throw new MicrofrontendError(
909
905
  `default route "${defaultRoute}" is not included by the routing config for application "${id}"`,
910
906
  { type: "config", subtype: "invalid_main_path" }
911
907
  );
@@ -968,7 +964,7 @@ var validatePaths = (applicationConfigsById) => {
968
964
  );
969
965
  });
970
966
  if (errors.length) {
971
- throw new MicroFrontendError(`Invalid paths: ${errors.join(", ")}`, {
967
+ throw new MicrofrontendError(`Invalid paths: ${errors.join(", ")}`, {
972
968
  type: "config",
973
969
  subtype: "conflicting_paths"
974
970
  });
@@ -1002,13 +998,13 @@ function validatePathExpression(path3) {
1002
998
  var validateDefaults = (applicationConfigsById) => {
1003
999
  const defaultApplicationIds = Object.entries(applicationConfigsById).reduce((acc, [id, app]) => app.default ? [...acc, id] : acc, []);
1004
1000
  if (defaultApplicationIds.length === 0) {
1005
- throw new MicroFrontendError(
1001
+ throw new MicrofrontendError(
1006
1002
  `No default application found. At least one application must be marked as default.`,
1007
1003
  { type: "config", subtype: "no_default_application" }
1008
1004
  );
1009
1005
  }
1010
1006
  if (defaultApplicationIds.length > 1) {
1011
- throw new MicroFrontendError(
1007
+ throw new MicrofrontendError(
1012
1008
  `Only one default application is allowed. Found ${defaultApplicationIds.join(", ")}.`,
1013
1009
  { type: "config", subtype: "multiple_default_applications" }
1014
1010
  );
@@ -1020,7 +1016,7 @@ var validateOptions = (options) => {
1020
1016
  if (!/^[a-zA-Z]{2,}\.[a-zA-Z]{2,}$/.test(
1021
1017
  options.vercel.previewDeploymentSuffix
1022
1018
  )) {
1023
- throw new MicroFrontendError(
1019
+ throw new MicrofrontendError(
1024
1020
  `Invalid preview deployment suffix: ${options.vercel.previewDeploymentSuffix}. Should have be formatted like "vercel.app".`,
1025
1021
  { type: "config", subtype: "invalid_preview_deployment_suffix" }
1026
1022
  );
@@ -1031,11 +1027,10 @@ var validateOptions = (options) => {
1031
1027
  // src/config/utils/convert.ts
1032
1028
  function convertV1RoutingToV2Routing(routing) {
1033
1029
  return routing.matches.map((group) => {
1034
- var _a, _b;
1030
+ var _a;
1035
1031
  return {
1036
1032
  group: group.group,
1037
1033
  flag: (_a = group.options) == null ? void 0 : _a.flag,
1038
- routeToDefaultApplication: (_b = group.options) == null ? void 0 : _b.routeToDefaultApplication,
1039
1034
  paths: group.paths
1040
1035
  };
1041
1036
  });
@@ -1075,9 +1070,15 @@ function convertV1ConfigToV2Config(config, fromApp) {
1075
1070
  )
1076
1071
  };
1077
1072
  }
1073
+ const defaultApplication = Object.entries(config.applications).find(
1074
+ ([, application]) => application.default
1075
+ );
1076
+ if (!defaultApplication) {
1077
+ throw new Error("No default application found in the config");
1078
+ }
1078
1079
  return {
1079
1080
  ...common,
1080
- partOf: fromApp
1081
+ partOf: defaultApplication[0]
1081
1082
  };
1082
1083
  }
1083
1084
 
@@ -1092,8 +1093,8 @@ function writeFile(outputPath, config, prettify) {
1092
1093
  );
1093
1094
  }
1094
1095
 
1095
- // src/config/micro-frontend-config.ts
1096
- var MicroFrontendConfig = class extends MicroFrontendConfigCommon {
1096
+ // src/config/microfrontend-config.ts
1097
+ var MicrofrontendConfig = class extends MicrofrontendConfigCommon {
1097
1098
  static validate(configString) {
1098
1099
  const config = validateSchema(configString);
1099
1100
  validateVersion(config.version);
@@ -1106,9 +1107,9 @@ var MicroFrontendConfig = class extends MicroFrontendConfigCommon {
1106
1107
  static fromEnv({
1107
1108
  cookies
1108
1109
  }) {
1109
- return new MicroFrontendConfigCommon({
1110
- config: MicroFrontendConfig.validate(
1111
- MicroFrontendConfigCommon.getConfigFromEnv()
1110
+ return new MicrofrontendConfigCommon({
1111
+ config: MicrofrontendConfig.validate(
1112
+ MicrofrontendConfigCommon.getConfigFromEnv()
1112
1113
  ),
1113
1114
  overrides: Overrides.parseOverrides(cookies)
1114
1115
  });
@@ -1118,11 +1119,11 @@ var MicroFrontendConfig = class extends MicroFrontendConfigCommon {
1118
1119
  }) {
1119
1120
  try {
1120
1121
  const config = fs2.readFileSync(filePath, "utf-8");
1121
- return new MicroFrontendConfig({
1122
- config: MicroFrontendConfig.validate(config)
1122
+ return new MicrofrontendConfig({
1123
+ config: MicrofrontendConfig.validate(config)
1123
1124
  });
1124
1125
  } catch (e) {
1125
- throw MicroFrontendError.handle(e, {
1126
+ throw MicrofrontendError.handle(e, {
1126
1127
  fileName: filePath
1127
1128
  });
1128
1129
  }
@@ -1407,9 +1408,9 @@ function rewritesMapToArr(rewrites) {
1407
1408
  });
1408
1409
  }
1409
1410
  function transform4(args) {
1410
- const { next, microFrontend, zone } = args;
1411
+ const { next, microfrontend, zone } = args;
1411
1412
  const buildBeforeFiles = () => {
1412
- var _a, _b, _c, _d, _e;
1413
+ var _a, _b, _c, _d;
1413
1414
  const rewrites = /* @__PURE__ */ new Map();
1414
1415
  if ((_a = zone.routing) == null ? void 0 : _a.assetPrefix) {
1415
1416
  rewrites.set(`/${zone.routing.assetPrefix}/_next/:path+`, {
@@ -1424,7 +1425,7 @@ function transform4(args) {
1424
1425
  }
1425
1426
  }
1426
1427
  if (zone.isDefault()) {
1427
- for (const [_, z] of Object.entries(microFrontend.zones)) {
1428
+ for (const [_, z] of Object.entries(microfrontend.zones)) {
1428
1429
  if (zone.name === z.name) {
1429
1430
  continue;
1430
1431
  }
@@ -1442,9 +1443,7 @@ function transform4(args) {
1442
1443
  });
1443
1444
  }
1444
1445
  for (const group of routing.matches) {
1445
- if ((_d = group.options) == null ? void 0 : _d.routeToDefaultApplication) {
1446
- continue;
1447
- } else if ((_e = group.options) == null ? void 0 : _e.flag) {
1446
+ if ((_d = group.options) == null ? void 0 : _d.flag) {
1448
1447
  continue;
1449
1448
  } else {
1450
1449
  for (const source of group.paths) {
@@ -1498,14 +1497,14 @@ function transform4(args) {
1498
1497
  var formatDomainForServerAction = (domain) => domain.replace(/https?:\/\//, "");
1499
1498
  function transform5(args) {
1500
1499
  var _a;
1501
- const { next, zone, microFrontend } = args;
1500
+ const { next, zone, microfrontend } = args;
1502
1501
  const zonesToAllow = [
1503
1502
  // this zone - this is included by default unless allowedOrigins is overridden (which we are)
1504
1503
  // so we re-add it here.
1505
1504
  zone,
1506
- // this is the default zone for the micro-frontend. Allow child zones to call server actions
1505
+ // this is the default zone for the microfrontend. Allow child zones to call server actions
1507
1506
  // that are in the default zone.
1508
- microFrontend.getDefaultZone()
1507
+ microfrontend.getDefaultZone()
1509
1508
  ];
1510
1509
  const existingServerActionConfig = (_a = next.experimental) == null ? void 0 : _a.serverActions;
1511
1510
  next.experimental = {
@@ -1530,8 +1529,8 @@ function transform5(args) {
1530
1529
 
1531
1530
  // src/next/config/transforms/webpack.ts
1532
1531
  function transform6(args) {
1533
- const { next, microFrontend } = args;
1534
- const previewDomains = process.env.VERCEL_ENV === "preview" ? microFrontend.getAllApplications().reduce(
1532
+ const { next, microfrontend } = args;
1533
+ const previewDomains = process.env.VERCEL_ENV === "preview" ? microfrontend.getAllApplications().reduce(
1535
1534
  (obj, app) => {
1536
1535
  obj[app.name] = getPreviewDomain(app);
1537
1536
  return obj;
@@ -1547,7 +1546,7 @@ function transform6(args) {
1547
1546
  if (isServer || nextRuntime === "edge") {
1548
1547
  config.plugins.push(
1549
1548
  new wpFromNext.EnvironmentPlugin({
1550
- MFE_CONFIG: JSON.stringify(microFrontend.serialize()),
1549
+ MFE_CONFIG: JSON.stringify(microfrontend.serialize()),
1551
1550
  MFE_PREVIEW_DOMAINS: JSON.stringify(previewDomains)
1552
1551
  })
1553
1552
  );
@@ -1674,18 +1673,18 @@ function getConfigPath(opts) {
1674
1673
  const vercelJsonString = fs3.readFileSync("./vercel.json", "utf-8");
1675
1674
  const vercelJson = JSON.parse(vercelJsonString);
1676
1675
  if (!((_a = vercelJson.microFrontends) == null ? void 0 : _a.config)) {
1677
- throw new MicroFrontendError(
1676
+ throw new MicrofrontendError(
1678
1677
  `vercel.json file missing required field "microFrontends.config"`,
1679
1678
  {
1680
1679
  type: "vercelJson",
1681
1680
  subtype: "missing_field_microFrontend_config_path",
1682
- source: "@vercel/micro-frontends/next"
1681
+ source: "@vercel/microfrontends/next"
1683
1682
  }
1684
1683
  );
1685
1684
  }
1686
1685
  return { configPath: vercelJson.microFrontends.config };
1687
1686
  } catch (err) {
1688
- throw MicroFrontendError.handle(err, {
1687
+ throw MicrofrontendError.handle(err, {
1689
1688
  fileName: "vercel.json"
1690
1689
  });
1691
1690
  }
@@ -1698,30 +1697,30 @@ function getApplicationContext(opts) {
1698
1697
  const packageJsonString = fs3.readFileSync("./package.json", "utf-8");
1699
1698
  const packageJson = JSON.parse(packageJsonString);
1700
1699
  if (!packageJson.name) {
1701
- throw new MicroFrontendError(
1700
+ throw new MicrofrontendError(
1702
1701
  `package.json file missing required field "name"`,
1703
1702
  {
1704
1703
  type: "packageJson",
1705
1704
  subtype: "missing_field_name",
1706
- source: "@vercel/micro-frontends/next"
1705
+ source: "@vercel/microfrontends/next"
1707
1706
  }
1708
1707
  );
1709
1708
  }
1710
1709
  return { name: packageJson.name };
1711
1710
  } catch (err) {
1712
- throw MicroFrontendError.handle(err, {
1711
+ throw MicrofrontendError.handle(err, {
1713
1712
  fileName: "package.json"
1714
1713
  });
1715
1714
  }
1716
1715
  }
1717
- function withMicroFrontends(nextConfig, opts) {
1716
+ function withMicrofrontends(nextConfig, opts) {
1718
1717
  var _a;
1719
1718
  if (opts == null ? void 0 : opts.debug) {
1720
1719
  process.env.MFE_DEBUG = "true";
1721
1720
  }
1722
1721
  const { name } = getApplicationContext(opts);
1723
1722
  const { configPath } = getConfigPath(opts);
1724
- const mfConfig = MicroFrontendConfig.fromFile({
1723
+ const mfConfig = MicrofrontendConfig.fromFile({
1725
1724
  filePath: configPath
1726
1725
  });
1727
1726
  const zone = mfConfig.getZone(name);
@@ -1736,7 +1735,7 @@ function withMicroFrontends(nextConfig, opts) {
1736
1735
  const transformedConfig = transform7({
1737
1736
  zone,
1738
1737
  next,
1739
- microFrontend: mfConfig,
1738
+ microfrontend: mfConfig,
1740
1739
  opts: {
1741
1740
  isProduction: isProduction(opts)
1742
1741
  }
@@ -1753,6 +1752,6 @@ function withMicroFrontends(nextConfig, opts) {
1753
1752
  return next;
1754
1753
  }
1755
1754
  export {
1756
- withMicroFrontends
1755
+ withMicrofrontends
1757
1756
  };
1758
1757
  //# sourceMappingURL=config.js.map