@vercel/microfrontends 0.14.0 → 0.15.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 (121) hide show
  1. package/dist/bin/cli.cjs +377 -1626
  2. package/dist/config.cjs +460 -1004
  3. package/dist/config.cjs.map +1 -1
  4. package/dist/config.d.ts +4 -25
  5. package/dist/config.js +456 -983
  6. package/dist/config.js.map +1 -1
  7. package/dist/{v2/microfrontends → microfrontends}/server.cjs +63 -143
  8. package/dist/microfrontends/server.cjs.map +1 -0
  9. package/dist/{v2/microfrontends → microfrontends}/server.d.ts +4 -4
  10. package/dist/{v2/microfrontends → microfrontends}/server.js +63 -143
  11. package/dist/microfrontends/server.js.map +1 -0
  12. package/dist/{v2/microfrontends.cjs → microfrontends.cjs} +21 -21
  13. package/dist/microfrontends.cjs.map +1 -0
  14. package/dist/{v2/microfrontends.d.ts → microfrontends.d.ts} +4 -4
  15. package/dist/{v2/microfrontends.js → microfrontends.js} +20 -20
  16. package/dist/microfrontends.js.map +1 -0
  17. package/dist/next/client.cjs +1 -1
  18. package/dist/next/client.cjs.map +1 -1
  19. package/dist/next/client.js +1 -1
  20. package/dist/next/client.js.map +1 -1
  21. package/dist/next/config.cjs +1323 -1024
  22. package/dist/next/config.cjs.map +1 -1
  23. package/dist/next/config.d.ts +1 -1
  24. package/dist/next/config.js +1327 -1028
  25. package/dist/next/config.js.map +1 -1
  26. package/dist/next/endpoints.cjs +77 -18
  27. package/dist/next/endpoints.cjs.map +1 -1
  28. package/dist/next/endpoints.d.ts +13 -2
  29. package/dist/next/endpoints.js +77 -18
  30. package/dist/next/endpoints.js.map +1 -1
  31. package/dist/next/middleware.cjs +745 -396
  32. package/dist/next/middleware.cjs.map +1 -1
  33. package/dist/next/middleware.d.ts +10 -5
  34. package/dist/next/middleware.js +745 -396
  35. package/dist/next/middleware.js.map +1 -1
  36. package/dist/next/testing.cjs +595 -1032
  37. package/dist/next/testing.cjs.map +1 -1
  38. package/dist/next/testing.d.ts +14 -12
  39. package/dist/next/testing.js +589 -1016
  40. package/dist/next/testing.js.map +1 -1
  41. package/dist/overrides.cjs +40 -108
  42. package/dist/overrides.cjs.map +1 -1
  43. package/dist/overrides.d.ts +24 -2
  44. package/dist/overrides.js +36 -106
  45. package/dist/overrides.js.map +1 -1
  46. package/dist/{v2/routing.cjs → routing.cjs} +3 -3
  47. package/dist/routing.cjs.map +1 -0
  48. package/dist/{v2/schema.cjs → schema.cjs} +1 -1
  49. package/dist/schema.cjs.map +1 -0
  50. package/dist/schema.d.ts +1 -0
  51. package/dist/utils/mfe-port.cjs +211 -1333
  52. package/dist/utils/mfe-port.cjs.map +1 -1
  53. package/dist/utils/mfe-port.js +204 -1326
  54. package/dist/utils/mfe-port.js.map +1 -1
  55. package/dist/validation.cjs +31 -361
  56. package/dist/validation.cjs.map +1 -1
  57. package/dist/validation.d.ts +3 -146
  58. package/dist/validation.js +30 -359
  59. package/dist/validation.js.map +1 -1
  60. package/package.json +29 -92
  61. package/schema/schema.json +174 -244
  62. package/dist/config/client.cjs +0 -54
  63. package/dist/config/client.cjs.map +0 -1
  64. package/dist/config/client.d.ts +0 -23
  65. package/dist/config/client.js +0 -28
  66. package/dist/config/client.js.map +0 -1
  67. package/dist/config/edge.cjs +0 -508
  68. package/dist/config/edge.cjs.map +0 -1
  69. package/dist/config/edge.d.ts +0 -20
  70. package/dist/config/edge.js +0 -481
  71. package/dist/config/edge.js.map +0 -1
  72. package/dist/microfrontend-config-983a5139.d.ts +0 -154
  73. package/dist/schema-2922d49e.d.ts +0 -182
  74. package/dist/v2/config.cjs +0 -709
  75. package/dist/v2/config.cjs.map +0 -1
  76. package/dist/v2/config.d.ts +0 -4
  77. package/dist/v2/config.js +0 -684
  78. package/dist/v2/config.js.map +0 -1
  79. package/dist/v2/microfrontends/server.cjs.map +0 -1
  80. package/dist/v2/microfrontends/server.js.map +0 -1
  81. package/dist/v2/microfrontends.cjs.map +0 -1
  82. package/dist/v2/microfrontends.js.map +0 -1
  83. package/dist/v2/next/client.cjs +0 -3
  84. package/dist/v2/next/client.cjs.map +0 -1
  85. package/dist/v2/next/client.d.ts +0 -45
  86. package/dist/v2/next/client.js +0 -3
  87. package/dist/v2/next/client.js.map +0 -1
  88. package/dist/v2/next/config.cjs +0 -2178
  89. package/dist/v2/next/config.cjs.map +0 -1
  90. package/dist/v2/next/config.d.ts +0 -22
  91. package/dist/v2/next/config.js +0 -2143
  92. package/dist/v2/next/config.js.map +0 -1
  93. package/dist/v2/next/endpoints.cjs +0 -141
  94. package/dist/v2/next/endpoints.cjs.map +0 -1
  95. package/dist/v2/next/endpoints.d.ts +0 -26
  96. package/dist/v2/next/endpoints.js +0 -116
  97. package/dist/v2/next/endpoints.js.map +0 -1
  98. package/dist/v2/next/middleware.cjs +0 -1099
  99. package/dist/v2/next/middleware.cjs.map +0 -1
  100. package/dist/v2/next/middleware.d.ts +0 -34
  101. package/dist/v2/next/middleware.js +0 -1071
  102. package/dist/v2/next/middleware.js.map +0 -1
  103. package/dist/v2/next/testing.cjs +0 -992
  104. package/dist/v2/next/testing.cjs.map +0 -1
  105. package/dist/v2/next/testing.d.ts +0 -55
  106. package/dist/v2/next/testing.js +0 -961
  107. package/dist/v2/next/testing.js.map +0 -1
  108. package/dist/v2/overrides.cjs +0 -75
  109. package/dist/v2/overrides.cjs.map +0 -1
  110. package/dist/v2/overrides.d.ts +0 -24
  111. package/dist/v2/overrides.js +0 -45
  112. package/dist/v2/overrides.js.map +0 -1
  113. package/dist/v2/routing.cjs.map +0 -1
  114. package/dist/v2/schema.cjs.map +0 -1
  115. package/dist/v2/schema.d.ts +0 -1
  116. package/schema/schema-v2.json +0 -266
  117. /package/dist/{v2/routing.d.ts → routing.d.ts} +0 -0
  118. /package/dist/{v2/routing.js → routing.js} +0 -0
  119. /package/dist/{v2/routing.js.map → routing.js.map} +0 -0
  120. /package/dist/{v2/schema.js → schema.js} +0 -0
  121. /package/dist/{v2/schema.js.map → schema.js.map} +0 -0
@@ -33,1167 +33,24 @@ __export(mfe_port_exports, {
33
33
  mfePort: () => mfePort
34
34
  });
35
35
  module.exports = __toCommonJS(mfe_port_exports);
36
- var import_node_path11 = __toESM(require("path"), 1);
37
- var import_node_fs10 = __toESM(require("fs"), 1);
38
-
39
- // src/config/types.ts
40
- var isDefaultApplicationConfig = (app) => app.default && typeof app.routing === "undefined";
41
-
42
- // src/config/microfrontend-config.ts
43
- var import_node_fs2 = __toESM(require("fs"), 1);
44
-
45
- // src/config-v2/microfrontends/server/utils/get-output-file-path.ts
46
- var import_node_path = __toESM(require("path"), 1);
47
-
48
- // src/config-v2/microfrontends/server/constants.ts
49
- var MFE_CONFIG_DEFAULT_FILE_PATH = "microfrontends";
50
- var MFE_CONFIG_DEFAULT_FILE_NAME = "microfrontends.json";
51
-
52
- // src/utils/is-vercel.ts
53
- function isVercel() {
54
- return process.env.VERCEL === "1";
55
- }
56
-
57
- // src/config-v2/microfrontends/server/utils/get-output-file-path.ts
58
- function getOutputFilePath() {
59
- if (isVercel()) {
60
- return import_node_path.default.join(
61
- ".vercel",
62
- MFE_CONFIG_DEFAULT_FILE_PATH,
63
- MFE_CONFIG_DEFAULT_FILE_NAME
64
- );
65
- }
66
- return import_node_path.default.join(MFE_CONFIG_DEFAULT_FILE_PATH, MFE_CONFIG_DEFAULT_FILE_NAME);
67
- }
68
-
69
- // src/config/errors.ts
70
- var MicrofrontendError = class extends Error {
71
- constructor(message, opts) {
72
- super(message);
73
- this.name = "MicrofrontendsError";
74
- this.source = (opts == null ? void 0 : opts.source) ?? "@vercel/microfrontends";
75
- this.type = (opts == null ? void 0 : opts.type) ?? "unknown";
76
- this.subtype = opts == null ? void 0 : opts.subtype;
77
- Error.captureStackTrace(this, MicrofrontendError);
78
- }
79
- isKnown() {
80
- return this.type !== "unknown";
81
- }
82
- isUnknown() {
83
- return !this.isKnown();
84
- }
85
- /**
86
- * Converts an error to a MicrofrontendsError.
87
- * @param original - The original error to convert.
88
- * @returns The converted MicrofrontendsError.
89
- */
90
- static convert(original, opts) {
91
- if (opts == null ? void 0 : opts.fileName) {
92
- const err = MicrofrontendError.convertFSError(original, opts.fileName);
93
- if (err) {
94
- return err;
95
- }
96
- }
97
- if (original.message.includes(
98
- "Code generation from strings disallowed for this context"
99
- )) {
100
- return new MicrofrontendError(original.message, {
101
- type: "config",
102
- subtype: "unsupported_validation_env",
103
- source: "ajv"
104
- });
105
- }
106
- return new MicrofrontendError(original.message);
107
- }
108
- static convertFSError(original, fileName) {
109
- if (original instanceof Error && "code" in original) {
110
- if (original.code === "ENOENT") {
111
- return new MicrofrontendError(`Could not find "${fileName}"`, {
112
- type: "config",
113
- subtype: "unable_to_read_file",
114
- source: "fs"
115
- });
116
- }
117
- if (original.code === "EACCES") {
118
- return new MicrofrontendError(
119
- `Permission denied while accessing "${fileName}"`,
120
- {
121
- type: "config",
122
- subtype: "invalid_permissions",
123
- source: "fs"
124
- }
125
- );
126
- }
127
- }
128
- if (original instanceof SyntaxError) {
129
- return new MicrofrontendError(
130
- `Failed to parse "${fileName}": Invalid JSON format.`,
131
- {
132
- type: "config",
133
- subtype: "invalid_syntax",
134
- source: "fs"
135
- }
136
- );
137
- }
138
- return null;
139
- }
140
- /**
141
- * Handles an unknown error and returns a MicrofrontendsError instance.
142
- * @param err - The error to handle.
143
- * @returns A MicrofrontendsError instance.
144
- */
145
- static handle(err, opts) {
146
- if (err instanceof MicrofrontendError) {
147
- return err;
148
- }
149
- if (err instanceof Error) {
150
- return MicrofrontendError.convert(err, opts);
151
- }
152
- if (typeof err === "object" && err !== null) {
153
- if ("message" in err && typeof err.message === "string") {
154
- return MicrofrontendError.convert(new Error(err.message), opts);
155
- }
156
- }
157
- return new MicrofrontendError("An unknown error occurred");
158
- }
159
- };
160
-
161
- // src/routing/url.ts
162
- function buildUrlSafeString(givenOpts = {}) {
163
- const options = {
164
- joinString: "-",
165
- lowercaseOnly: true,
166
- maxLen: 100,
167
- regexRemovePattern: /(?:(?!(?:[a-z0-9])).)/gi,
168
- trimWhitespace: true,
169
- ...givenOpts
170
- };
171
- return {
172
- generate: (...args) => {
173
- const reJoinString = new RegExp(`${options.joinString}+`, "g");
174
- let tag;
175
- if (args.length === 0) {
176
- throw new Error("generate method must be passed at least one argument");
177
- }
178
- for (let i = 0; i < args.length; i++) {
179
- const arg = args[i];
180
- if (typeof arg !== "string")
181
- throw new Error("all supplied arguments must be Strings");
182
- if (options.trimWhitespace) {
183
- args[i] = arg.trim();
184
- }
185
- }
186
- tag = args.join(options.joinString);
187
- tag = tag.replace(/\s/g, options.joinString);
188
- if (options.lowercaseOnly)
189
- tag = tag.toLowerCase();
190
- tag = tag.replace(options.regexRemovePattern, (match) => {
191
- if (match === options.joinString)
192
- return match;
193
- return "";
194
- });
195
- if (tag.length > options.maxLen)
196
- tag = tag.substring(0, options.maxLen);
197
- tag = tag.replace(reJoinString, options.joinString);
198
- return tag;
199
- }
200
- };
201
- }
202
- var urlSafeString = buildUrlSafeString().generate;
203
- function makeUrlSafe(name) {
204
- return urlSafeString(name.replace(/\//g, "-")).replace(/^-*/g, "").replace(/-*$/g, "");
205
- }
206
-
207
- // src/config/overrides/config.ts
208
- var OVERRIDES_COOKIE_PREFIX = "vercel-micro-frontends-override";
209
- var _Overrides = class {
210
- constructor(config) {
211
- this.config = config;
212
- }
213
- static getAppEnvOverrideCookieName(zone) {
214
- return `${_Overrides.overrideEnvCookiePrefix}${zone}`;
215
- }
216
- static isOverrideCookie(cookie) {
217
- var _a;
218
- return Boolean((_a = cookie.name) == null ? void 0 : _a.startsWith(OVERRIDES_COOKIE_PREFIX));
219
- }
220
- static getOverrideFromCookie(cookie) {
221
- if (!_Overrides.isOverrideCookie(cookie) || !cookie.value)
222
- return;
223
- return {
224
- zone: cookie.name.replace(_Overrides.overrideEnvCookiePrefix, ""),
225
- host: cookie.value
226
- };
227
- }
228
- static parseOverrides(cookies) {
229
- const overridesConfig = { applications: {} };
230
- cookies.forEach((cookie) => {
231
- const override = _Overrides.getOverrideFromCookie(cookie);
232
- if (!override)
233
- return;
234
- overridesConfig.applications[override.zone] = {
235
- environment: { host: override.host }
236
- };
237
- });
238
- return overridesConfig;
239
- }
240
- static validOverrideDomainsForZone(microfrontendConfig, zone) {
241
- var _a, _b, _c, _d, _e;
242
- const projectName = (_a = microfrontendConfig.getZone(zone).vercel) == null ? void 0 : _a.projectName;
243
- if (!projectName) {
244
- return [microfrontendConfig.getZone(zone).production.host];
245
- }
246
- const parsedProjectName = makeUrlSafe(projectName);
247
- const previewDeploymentSuffix = (_c = (_b = microfrontendConfig.options) == null ? void 0 : _b.vercel) == null ? void 0 : _c.previewDeploymentSuffix;
248
- const teamSlug = (_e = (_d = microfrontendConfig.options) == null ? void 0 : _d.vercel) == null ? void 0 : _e.teamSlug;
249
- if (!teamSlug && !previewDeploymentSuffix) {
250
- return [microfrontendConfig.getZone(zone).production.host];
251
- }
252
- const suffix = previewDeploymentSuffix ? `.${previewDeploymentSuffix}` : `-${teamSlug}.vercel.app`;
253
- return [
254
- `${parsedProjectName}-git-([a-zA-Z0-9-]+)${suffix}`,
255
- microfrontendConfig.getZone(zone).production.host
256
- ];
257
- }
258
- static validateOverrideDomain(microfrontendConfig, zone, domain) {
259
- return new RegExp(
260
- `^${_Overrides.validOverrideDomainsForZone(microfrontendConfig, zone).join(
261
- "|"
262
- )}$`
263
- ).test(domain);
264
- }
265
- serialize() {
266
- return this.config;
267
- }
268
- };
269
- var Overrides = _Overrides;
270
- Overrides.overrideEnvCookiePrefix = `${OVERRIDES_COOKIE_PREFIX}:env:`;
271
-
272
- // src/config/common/host.ts
273
- var Host = class {
274
- constructor({ protocol, host, port }) {
275
- this.protocol = protocol || "https";
276
- this.host = host;
277
- this.port = Host.getPort({ port, protocol: this.protocol });
278
- this.serialized = {
279
- protocol,
280
- host,
281
- ...port ? { port } : void 0
282
- };
283
- }
284
- isLocal() {
285
- return this.host === "localhost" || this.host === "127.0.0.1";
286
- }
287
- static getPort({
288
- protocol,
289
- port
290
- }) {
291
- if (!port) {
292
- if (protocol === "http") {
293
- return 80;
294
- }
295
- return 443;
296
- }
297
- return port;
298
- }
299
- isDefaultPort() {
300
- return this.port === Host.getPort({ protocol: this.protocol });
301
- }
302
- toString(opts = {}) {
303
- const url = this.toUrl(opts);
304
- return url.toString().replace(/\/$/, "");
305
- }
306
- toUrl(opts = {}) {
307
- const { includeDefaultPort } = opts;
308
- const url = `${this.protocol}://${this.host}${this.isDefaultPort() && !includeDefaultPort ? "" : `:${this.port}`}`;
309
- return new URL(url);
310
- }
311
- serialize() {
312
- return this.serialized;
313
- }
314
- };
315
-
316
- // src/config/common/application.ts
317
- var Application = class {
318
- constructor(name, {
319
- app,
320
- overrides
321
- }) {
322
- Application.validate(name, app);
323
- this.name = name;
324
- this.default = app.default;
325
- this.routing = app.routing;
326
- this.development = {
327
- local: new Host(app.development.local),
328
- fallback: app.development.fallback ? new Host(app.development.fallback) : void 0
329
- };
330
- this.production = new Host(app.production);
331
- this.vercel = app.vercel;
332
- this.overrides = (overrides == null ? void 0 : overrides.environment) ? {
333
- environment: new Host(overrides.environment)
334
- } : void 0;
335
- }
336
- isDefault() {
337
- return this.default;
338
- }
339
- static validate(name, app) {
340
- var _a, _b, _c, _d, _e;
341
- 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("/"))) {
342
- throw new MicrofrontendError(
343
- `Invalid assetPrefix for application "${name}". Must not start or end with a slash.`,
344
- { type: "zone", subtype: "invalid_asset_prefix" }
345
- );
346
- }
347
- for (const group of ((_e = app.routing) == null ? void 0 : _e.matches) ?? []) {
348
- for (const p of group.paths) {
349
- if (p === "/") {
350
- continue;
351
- }
352
- if (p.endsWith("/")) {
353
- throw new MicrofrontendError(
354
- `Invalid path for application "${name}". ${p} must not end with a slash.`,
355
- { type: "zone", subtype: "invalid_path" }
356
- );
357
- }
358
- if (!p.startsWith("/")) {
359
- throw new MicrofrontendError(
360
- `Invalid path for application "${name}". ${p} must start with a slash.`,
361
- { type: "zone", subtype: "invalid_path" }
362
- );
363
- }
364
- }
365
- }
366
- }
367
- serialize() {
368
- var _a, _b;
369
- if (this.routing === void 0 || this.default) {
370
- return {
371
- default: true,
372
- development: {
373
- local: this.development.local.serialize(),
374
- fallback: (_a = this.development.fallback) == null ? void 0 : _a.serialize()
375
- },
376
- production: this.production.serialize(),
377
- vercel: this.vercel
378
- };
379
- }
380
- return {
381
- default: false,
382
- routing: this.routing,
383
- development: {
384
- local: this.development.local.serialize(),
385
- fallback: (_b = this.development.fallback) == null ? void 0 : _b.serialize()
386
- },
387
- production: this.production.serialize(),
388
- vercel: this.vercel
389
- };
390
- }
391
- };
392
-
393
- // src/config/common/microfrontend-config.ts
394
- var SUPPORTED_VERSIONS = ["1"];
395
- var DEFAULT_LOCAL_PROXY_PORT = 3024;
396
- var MicrofrontendConfigCommon = class {
397
- constructor({
398
- config,
399
- overrides
400
- }) {
401
- this.zones = {};
402
- var _a, _b, _c;
403
- if (!SUPPORTED_VERSIONS.includes(config.version)) {
404
- throw new MicrofrontendError(
405
- `Unsupported version: ${config.version}. Supported versions are: ${SUPPORTED_VERSIONS.join(
406
- ", "
407
- )}`,
408
- { type: "config", subtype: "unsupported_version" }
409
- );
410
- }
411
- const disableOverrides = ((_b = (_a = config.options) == null ? void 0 : _a.vercel) == null ? void 0 : _b.disableOverrides) ?? false;
412
- this.overrides = overrides && !disableOverrides ? new Overrides(overrides) : void 0;
413
- for (const [zoneName, zoneConfig] of Object.entries(config.applications)) {
414
- this.zones[zoneName] = new Application(zoneName, {
415
- app: zoneConfig,
416
- overrides: !disableOverrides ? (_c = this.overrides) == null ? void 0 : _c.config.applications[zoneName] : void 0
417
- });
418
- }
419
- this.config = config;
420
- this.name = config.name;
421
- this.version = config.version;
422
- this.options = config.options;
423
- this.$schema = config.$schema;
424
- }
425
- isOverridesDisabled() {
426
- var _a, _b;
427
- return ((_b = (_a = this.options) == null ? void 0 : _a.vercel) == null ? void 0 : _b.disableOverrides) ?? false;
428
- }
429
- static getConfigFromEnv() {
430
- const config = process.env.MFE_CONFIG;
431
- if (!config) {
432
- throw new MicrofrontendError(`Missing "MFE_CONFIG" in environment.`, {
433
- type: "config",
434
- subtype: "not_found_in_env"
435
- });
436
- }
437
- return config;
438
- }
439
- static fromEnv(_) {
440
- throw new Error("Not implemented");
441
- }
442
- getConfig() {
443
- return this.config;
444
- }
445
- getAllApplications() {
446
- return Object.values(this.zones);
447
- }
448
- getZone(name) {
449
- const zone = this.zones[name];
450
- if (!zone) {
451
- throw new MicrofrontendError(
452
- `Could not find microfrontends configuration for application "${name}"`,
453
- {
454
- type: "zone",
455
- subtype: "not_found"
456
- }
457
- );
458
- }
459
- return zone;
460
- }
461
- getApplicationByProjectId(projectId) {
462
- return Object.values(this.zones).find(
463
- (zone) => {
464
- var _a;
465
- return ((_a = zone.vercel) == null ? void 0 : _a.projectId) === projectId;
466
- }
467
- );
468
- }
469
- getDefaultZone() {
470
- const zone = Object.values(this.zones).find((z) => z.default);
471
- if (!zone) {
472
- throw new MicrofrontendError(
473
- `Could not find default zone in microfrontends configuration`,
474
- {
475
- type: "zone",
476
- subtype: "not_found"
477
- }
478
- );
479
- }
480
- return zone;
481
- }
482
- /**
483
- * Returns the configured port for the local proxy
484
- */
485
- getLocalProxyPort() {
486
- var _a, _b;
487
- return ((_b = (_a = this.config.options) == null ? void 0 : _a.localProxy) == null ? void 0 : _b.port) ?? DEFAULT_LOCAL_PROXY_PORT;
488
- }
489
- /**
490
- * Serializes the class back to the Schema type.
491
- *
492
- * NOTE: This is used when writing the config to disk and must always match the input Schema
493
- */
494
- toSchemaJson() {
495
- const applications = {};
496
- for (const [name, zone] of Object.entries(this.zones)) {
497
- applications[name] = zone.serialize();
498
- }
499
- return {
500
- $schema: this.$schema,
501
- name: this.name,
502
- version: this.version,
503
- options: this.options,
504
- applications
505
- };
506
- }
507
- serialize() {
508
- var _a;
509
- const applications = {};
510
- for (const [name, zone] of Object.entries(this.zones)) {
511
- applications[name] = zone.serialize();
512
- }
513
- return {
514
- config: {
515
- name: this.name,
516
- version: this.version,
517
- applications,
518
- options: this.options,
519
- $schema: this.$schema
520
- },
521
- overrides: (_a = this.overrides) == null ? void 0 : _a.serialize()
522
- };
523
- }
524
- write(_) {
525
- throw new MicrofrontendError(
526
- `Writing to file to disk requires using an instance of "MicrofrontendConfig".`,
527
- { type: "config", subtype: "unsupported_operation" }
528
- );
529
- }
530
- };
531
-
532
- // src/config/utils/get-output-file-path.ts
533
- var import_node_path2 = __toESM(require("path"), 1);
534
-
535
- // src/config/constants.ts
536
- var MFE_CONFIG_DEFAULT_FILE_PATH2 = "micro-frontends";
537
- var MFE_CONFIG_DEFAULT_FILE_NAME2 = "micro-frontends.config.json";
538
-
539
- // src/config/utils/get-output-file-path.ts
540
- function getOutputFilePath2() {
541
- if (isVercel()) {
542
- return import_node_path2.default.join(
543
- ".vercel",
544
- MFE_CONFIG_DEFAULT_FILE_PATH2,
545
- MFE_CONFIG_DEFAULT_FILE_NAME2
546
- );
547
- }
548
- return import_node_path2.default.join(MFE_CONFIG_DEFAULT_FILE_PATH2, MFE_CONFIG_DEFAULT_FILE_NAME2);
549
- }
550
-
551
- // src/config/validation.ts
552
- var import_jsonc_parser = require("jsonc-parser");
553
- var import_path_to_regexp = require("path-to-regexp");
554
- var import_ajv = require("ajv");
555
-
556
- // schema/schema.json
557
- var schema_default = {
558
- $schema: "http://json-schema.org/draft-07/schema#",
559
- $ref: "#/definitions/Config",
560
- definitions: {
561
- Config: {
562
- type: "object",
563
- properties: {
564
- version: {
565
- type: "string"
566
- },
567
- $schema: {
568
- type: "string"
569
- },
570
- name: {
571
- type: "string",
572
- description: 'Name for the micro-frontend site (eg. "vercel.com", "vercel-site" etc.).'
573
- },
574
- applications: {
575
- $ref: "#/definitions/ApplicationConfigsById"
576
- },
577
- options: {
578
- $ref: "#/definitions/Options",
579
- description: "Optional configuration for the entire micro-frontends setup."
580
- }
581
- },
582
- required: ["version", "applications"],
583
- description: "Configuration for micro-frontend applications\n\nTODO: Add proxy configuration"
584
- },
585
- ApplicationConfigsById: {
586
- type: "object",
587
- additionalProperties: {
588
- $ref: "#/definitions/ApplicationConfig"
589
- }
590
- },
591
- ApplicationConfig: {
592
- anyOf: [
593
- {
594
- $ref: "#/definitions/DefaultApplicationConfig"
595
- },
596
- {
597
- $ref: "#/definitions/CommonApplicationConfig"
598
- }
599
- ],
600
- description: "A Micro-Frontend Deployment Target"
601
- },
602
- DefaultApplicationConfig: {
603
- type: "object",
604
- properties: {
605
- default: {
606
- type: "boolean",
607
- const: true,
608
- description: "The default application is used no other application is matched via the routing config"
609
- },
610
- routing: {
611
- $ref: "#/definitions/Routing"
612
- },
613
- development: {
614
- type: "object",
615
- properties: {
616
- local: {
617
- $ref: "#/definitions/HostConfig"
618
- },
619
- fallback: {
620
- $ref: "#/definitions/HostConfig",
621
- description: "Fallback for local development, could be a host config that points to any environment. If this is not provided, or the application is not running - requests to the application in local development will error."
622
- },
623
- task: {
624
- type: "string",
625
- description: "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
626
- }
627
- },
628
- required: ["local"]
629
- },
630
- production: {
631
- $ref: "#/definitions/HostConfig"
632
- },
633
- metadata: {
634
- type: "object",
635
- additionalProperties: {
636
- type: "string"
637
- }
638
- },
639
- federation: {
640
- type: "object",
641
- properties: {
642
- exposes: {
643
- type: "array",
644
- items: {
645
- type: "object",
646
- properties: {
647
- name: {
648
- type: "string",
649
- description: "The name of the module - should be used when importing the module from another application"
650
- },
651
- path: {
652
- type: "string",
653
- description: "Relative path to the module within its `application`"
654
- }
655
- },
656
- required: ["name", "path"]
657
- },
658
- description: "Modules that are exposed by this application"
659
- },
660
- uses: {
661
- type: "array",
662
- items: {
663
- type: "string"
664
- },
665
- description: "Modules that are used by this application. Only the name of the module is required."
666
- }
667
- }
668
- },
669
- vercel: {
670
- $ref: "#/definitions/Vercel"
671
- }
672
- },
673
- required: ["default", "development", "production"]
674
- },
675
- Routing: {
676
- type: "object",
677
- properties: {
678
- assetPrefix: {
679
- type: "string",
680
- description: "[assetPrefix] for the application"
681
- },
682
- matches: {
683
- type: "array",
684
- items: {
685
- $ref: "#/definitions/PathGroup"
686
- },
687
- description: "Path expressions that are routed to this application."
688
- }
689
- },
690
- required: ["matches"]
691
- },
692
- PathGroup: {
693
- type: "object",
694
- properties: {
695
- group: {
696
- type: "string",
697
- description: "Optional group name for the paths"
698
- },
699
- options: {
700
- type: "object",
701
- properties: {
702
- flag: {
703
- type: "string",
704
- description: "flag name that can be used to enable/disable all paths in the group"
705
- }
706
- }
707
- },
708
- paths: {
709
- type: "array",
710
- items: {
711
- type: "string"
712
- }
713
- }
714
- },
715
- required: ["paths"]
716
- },
717
- HostConfig: {
718
- type: "object",
719
- properties: {
720
- protocol: {
721
- type: "string",
722
- enum: ["http", "https"],
723
- description: 'The protocol to be used for the connection.\n- `http`: Hypertext Transfer Protocol (HTTP).\n- `https`: Secure Hypertext Transfer Protocol (HTTPS).\n\n* @defaultValue "https"'
724
- },
725
- host: {
726
- type: "string",
727
- description: "The hostname or IP address of the server. This can be a domain name (e.g., `example.com`) or an IP address (e.g., `192.168.1.1`)."
728
- },
729
- port: {
730
- type: "number",
731
- description: "The port number to be used for the connection. Common values include `80` for HTTP and `443` for HTTPS.\n\nThis field is optional and can be omitted if the default ports for the specified protocol are used"
732
- }
733
- },
734
- required: ["host"]
735
- },
736
- Vercel: {
737
- type: "object",
738
- properties: {
739
- projectId: {
740
- type: "string",
741
- description: "Vercel project ID"
742
- },
743
- projectName: {
744
- type: "string",
745
- description: "Vercel project name (temporary until we can use project ID)"
746
- },
747
- defaultRoute: {
748
- type: "string",
749
- description: "The default route for the application. Used to render screenshots, favicons, and provide direct zone links"
750
- },
751
- routeSpeedInsightsToDefaultZone: {
752
- type: "boolean",
753
- description: "Whether to route Speed Insights to the default zone or each individual microfrontend."
754
- }
755
- },
756
- required: ["projectId"]
757
- },
758
- CommonApplicationConfig: {
759
- type: "object",
760
- properties: {
761
- default: {
762
- type: "boolean",
763
- const: false,
764
- description: "The default application is used no other application is matched via the routing config"
765
- },
766
- routing: {
767
- $ref: "#/definitions/Routing"
768
- },
769
- development: {
770
- type: "object",
771
- properties: {
772
- local: {
773
- $ref: "#/definitions/HostConfig"
774
- },
775
- fallback: {
776
- $ref: "#/definitions/HostConfig",
777
- description: "Fallback for local development, could be a host config that points to any environment. If this is not provided, or the application is not running - requests to the application in local development will error."
778
- },
779
- task: {
780
- type: "string",
781
- description: "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
782
- }
783
- },
784
- required: ["local"]
785
- },
786
- production: {
787
- $ref: "#/definitions/HostConfig"
788
- },
789
- metadata: {
790
- type: "object",
791
- additionalProperties: {
792
- type: "string"
793
- }
794
- },
795
- federation: {
796
- type: "object",
797
- properties: {
798
- exposes: {
799
- type: "array",
800
- items: {
801
- type: "object",
802
- properties: {
803
- name: {
804
- type: "string",
805
- description: "The name of the module - should be used when importing the module from another application"
806
- },
807
- path: {
808
- type: "string",
809
- description: "Relative path to the module within its `application`"
810
- }
811
- },
812
- required: ["name", "path"]
813
- },
814
- description: "Modules that are exposed by this application"
815
- },
816
- uses: {
817
- type: "array",
818
- items: {
819
- type: "string"
820
- },
821
- description: "Modules that are used by this application. Only the name of the module is required."
822
- }
823
- }
824
- },
825
- vercel: {
826
- $ref: "#/definitions/Vercel"
827
- }
828
- },
829
- required: ["default", "development", "production", "routing"]
830
- },
831
- Options: {
832
- type: "object",
833
- properties: {
834
- vercel: {
835
- $ref: "#/definitions/VercelOptions",
836
- description: "Micro-Frontends wide options for Vercel."
837
- },
838
- localProxy: {
839
- $ref: "#/definitions/LocalProxyOptions",
840
- description: "Options for local proxy."
841
- }
842
- }
843
- },
844
- VercelOptions: {
845
- type: "object",
846
- properties: {
847
- previewDeploymentSuffix: {
848
- type: "string",
849
- description: "If your team uses a custom Preview Deployment Suffix, please specify it here. See https://vercel.com/docs/deployments/preview-deployment-suffix. The default is `vercel.app`."
850
- },
851
- teamSlug: {
852
- type: "string",
853
- description: "Team slug for the Vercel team"
854
- },
855
- disableOverrides: {
856
- type: "boolean",
857
- description: "If you want to disable the overrides for the site. For example, if you are managing rewrites between applications externally, you may wish to disable the overrides on the toolbar as they will have no effect."
858
- }
859
- }
860
- },
861
- LocalProxyOptions: {
862
- type: "object",
863
- properties: {
864
- port: {
865
- type: "number",
866
- description: "The port number used by the local proxy server.\n\nThe default is `3024`."
867
- }
868
- }
869
- }
870
- }
871
- };
872
-
873
- // src/config/utils/load-schema.ts
874
- var SCHEMA = schema_default;
875
-
876
- // src/config/validation.ts
877
- var validateSchema = (configString) => {
878
- const parsedConfig = (0, import_jsonc_parser.parse)(configString);
879
- const ajv = new import_ajv.Ajv();
880
- const validate = ajv.compile(SCHEMA);
881
- const isValid = validate(parsedConfig);
882
- if (!isValid) {
883
- throw new MicrofrontendError(
884
- `Invalid config: ${ajv.errorsText(validate.errors)}`,
885
- { type: "config", subtype: "does_not_match_schema" }
886
- );
887
- }
888
- return parsedConfig;
889
- };
890
- var SUPPORTED_VERSIONS2 = ["1"];
891
- var validateVersion = (version) => {
892
- if (!SUPPORTED_VERSIONS2.includes(version)) {
893
- throw new MicrofrontendError(
894
- `Unsupported version: ${version}. Supported versions are: ${SUPPORTED_VERSIONS2.join(
895
- ", "
896
- )}`,
897
- { type: "config", subtype: "unsupported_version" }
898
- );
899
- }
900
- };
901
- function validateMainPath(applicationConfigsById) {
902
- for (const [id, app] of Object.entries(applicationConfigsById)) {
903
- const { defaultRoute } = app.vercel ?? {};
904
- if (!defaultRoute) {
905
- continue;
906
- }
907
- if (isDefaultApplicationConfig(app)) {
908
- const pathsWithApp = [];
909
- for (const [otherId, otherApp] of Object.entries(
910
- applicationConfigsById
911
- )) {
912
- if (isDefaultApplicationConfig(otherApp)) {
913
- continue;
914
- }
915
- pathsWithApp.push({
916
- id: otherId,
917
- paths: otherApp.routing.matches.flatMap((match) => match.paths)
918
- });
919
- }
920
- for (const { id: otherId, paths } of pathsWithApp) {
921
- const isValid = paths.every((path7) => {
922
- const matcher = (0, import_path_to_regexp.pathToRegexp)(path7);
923
- return !matcher.test(defaultRoute);
924
- });
925
- if (!isValid) {
926
- throw new MicrofrontendError(
927
- `default route "${defaultRoute}" cannot be used for "${id}" because it is matched by "${otherId}"`,
928
- { type: "config", subtype: "invalid_main_path" }
929
- );
930
- }
931
- }
932
- } else {
933
- const allPaths = app.routing.matches.flatMap((match) => match.paths);
934
- const isValid = allPaths.some((path7) => {
935
- const matcher = (0, import_path_to_regexp.pathToRegexp)(path7);
936
- return matcher.test(defaultRoute);
937
- });
938
- if (!isValid) {
939
- throw new MicrofrontendError(
940
- `default route "${defaultRoute}" is not included by the routing config for application "${id}"`,
941
- { type: "config", subtype: "invalid_main_path" }
942
- );
943
- }
944
- }
945
- }
946
- }
947
- var validatePaths = (applicationConfigsById) => {
948
- const pathsByApplicationId = /* @__PURE__ */ new Map();
949
- const errors = [];
950
- for (const [id, app] of Object.entries(applicationConfigsById)) {
951
- if (isDefaultApplicationConfig(app)) {
952
- continue;
953
- }
954
- for (const pathMatch of app.routing.matches) {
955
- for (const path7 of pathMatch.paths) {
956
- const maybeError = validatePathExpression(path7);
957
- if (maybeError) {
958
- errors.push(maybeError);
959
- }
960
- const existing = pathsByApplicationId.get(path7);
961
- if (existing) {
962
- existing.applications.push(id);
963
- } else {
964
- pathsByApplicationId.set(path7, {
965
- applications: [id],
966
- matcher: (0, import_path_to_regexp.pathToRegexp)(path7),
967
- applicationId: id
968
- });
969
- }
970
- }
971
- }
972
- }
973
- const entries = Array.from(pathsByApplicationId.entries());
974
- entries.forEach(([path7, { applications: ids, matcher, applicationId }]) => {
975
- if (ids.length > 1) {
976
- errors.push(
977
- `Duplicate path "${path7}" for applications "${ids.join(", ")}"`
978
- );
979
- }
980
- entries.forEach(
981
- ([
982
- matchPath,
983
- { applications: matchIds, applicationId: matchApplicationId }
984
- ]) => {
985
- if (path7 === matchPath) {
986
- return;
987
- }
988
- if (applicationId === matchApplicationId) {
989
- return;
990
- }
991
- if (matcher.test(matchPath)) {
992
- const source = `"${path7}" of application${ids.length > 0 ? "s" : ""} ${ids.join(", ")}`;
993
- const destination = `"${matchPath}" of application${matchIds.length > 0 ? "s" : ""} ${matchIds.join(", ")}`;
994
- errors.push(
995
- `Overlapping path detected between ${source} and ${destination}`
996
- );
997
- }
998
- }
999
- );
1000
- });
1001
- if (errors.length) {
1002
- throw new MicrofrontendError(`Invalid paths: ${errors.join(", ")}`, {
1003
- type: "config",
1004
- subtype: "conflicting_paths"
1005
- });
1006
- }
1007
- };
1008
- var PATH_DEFAULT_PATTERN = "[^\\/#\\?]+?";
1009
- function validatePathExpression(path7) {
1010
- const tokens = (0, import_path_to_regexp.parse)(path7);
1011
- for (let i = 0; i < tokens.length; i++) {
1012
- const token = tokens[i];
1013
- if (token === void 0) {
1014
- return `token ${i} in ${path7} is undefined, this shouldn't happen`;
1015
- }
1016
- if (typeof token !== "string") {
1017
- if (token.pattern !== PATH_DEFAULT_PATTERN) {
1018
- return `Path ${path7} cannot use a regular expression wildcard`;
1019
- }
1020
- if (token.prefix !== "/") {
1021
- return `Wildcard :${token.name} must be immediately after a / in ${path7}`;
1022
- }
1023
- if (token.suffix) {
1024
- return `Wildcard suffix on :${token.name} is not allowed. Suffixes are not supported`;
1025
- }
1026
- if (token.modifier && i !== tokens.length - 1) {
1027
- return `Modifier ${token.modifier} is not allowed on wildcard :${token.name} in ${path7}. Modifiers are only allowed in the last path component`;
1028
- }
1029
- }
1030
- }
1031
- return void 0;
1032
- }
1033
- var validateDefaults = (applicationConfigsById) => {
1034
- const defaultApplicationIds = Object.entries(applicationConfigsById).reduce((acc, [id, app]) => app.default ? [...acc, id] : acc, []);
1035
- if (defaultApplicationIds.length === 0) {
1036
- throw new MicrofrontendError(
1037
- `No default application found. At least one application must be marked as default.`,
1038
- { type: "config", subtype: "no_default_application" }
1039
- );
1040
- }
1041
- if (defaultApplicationIds.length > 1) {
1042
- throw new MicrofrontendError(
1043
- `Only one default application is allowed. Found ${defaultApplicationIds.join(", ")}.`,
1044
- { type: "config", subtype: "multiple_default_applications" }
1045
- );
1046
- }
1047
- };
1048
- var validateOptions = (options) => {
1049
- var _a;
1050
- if ((_a = options == null ? void 0 : options.vercel) == null ? void 0 : _a.previewDeploymentSuffix) {
1051
- if (!/^[a-zA-Z]{2,}\.[a-zA-Z]{2,}$/.test(
1052
- options.vercel.previewDeploymentSuffix
1053
- )) {
1054
- throw new MicrofrontendError(
1055
- `Invalid preview deployment suffix: ${options.vercel.previewDeploymentSuffix}. Should have be formatted like "vercel.app".`,
1056
- { type: "config", subtype: "invalid_preview_deployment_suffix" }
1057
- );
1058
- }
1059
- }
1060
- };
1061
-
1062
- // src/config/utils/convert.ts
1063
- function convertV1RoutingToV2Routing(routing) {
1064
- return routing.matches.map((group) => {
1065
- var _a;
1066
- return {
1067
- group: group.group,
1068
- flag: (_a = group.options) == null ? void 0 : _a.flag,
1069
- paths: group.paths
1070
- };
1071
- });
1072
- }
1073
- function convertV1ApplicationToV2Application(application) {
1074
- const common = {
1075
- production: application.production,
1076
- development: application.development,
1077
- vercel: application.vercel
1078
- };
1079
- if (application.default) {
1080
- return common;
1081
- }
1082
- return {
1083
- ...common,
1084
- routing: convertV1RoutingToV2Routing(application.routing)
1085
- };
1086
- }
1087
- function convertV1ConfigToV2Config(config, fromApp) {
1088
- if (!config.applications[fromApp]) {
1089
- throw new Error(`Application "${fromApp}" not found in the config`);
1090
- }
1091
- const common = {
1092
- version: "2",
1093
- options: config.options
1094
- };
1095
- if (config.applications[fromApp].default) {
1096
- return {
1097
- ...common,
1098
- applications: Object.fromEntries(
1099
- Object.entries(config.applications).map(([id, application]) => [
1100
- id,
1101
- convertV1ApplicationToV2Application(application)
1102
- ])
1103
- )
1104
- };
1105
- }
1106
- const defaultApplication = Object.entries(config.applications).find(
1107
- ([, application]) => application.default
1108
- );
1109
- if (!defaultApplication) {
1110
- throw new Error("No default application found in the config");
1111
- }
1112
- return {
1113
- ...common,
1114
- partOf: defaultApplication[0]
1115
- };
1116
- }
1117
-
1118
- // src/config/utils/write-file.ts
1119
- var import_node_fs = __toESM(require("fs"), 1);
1120
- var import_node_path3 = require("path");
1121
- function writeFile(outputPath, config, prettify) {
1122
- import_node_fs.default.mkdirSync((0, import_node_path3.dirname)(outputPath), { recursive: true });
1123
- import_node_fs.default.writeFileSync(
1124
- outputPath,
1125
- JSON.stringify(config, null, prettify ? 2 : void 0)
1126
- );
1127
- }
1128
-
1129
- // src/config/microfrontend-config.ts
1130
- var MicrofrontendConfig = class extends MicrofrontendConfigCommon {
1131
- static validate(configString) {
1132
- const config = validateSchema(configString);
1133
- validateVersion(config.version);
1134
- validatePaths(config.applications);
1135
- validateMainPath(config.applications);
1136
- validateDefaults(config.applications);
1137
- validateOptions(config.options);
1138
- return config;
1139
- }
1140
- static fromEnv({
1141
- cookies
1142
- }) {
1143
- return new MicrofrontendConfigCommon({
1144
- config: MicrofrontendConfig.validate(
1145
- MicrofrontendConfigCommon.getConfigFromEnv()
1146
- ),
1147
- overrides: Overrides.parseOverrides(cookies)
1148
- });
1149
- }
1150
- static fromFile({
1151
- filePath
1152
- }) {
1153
- try {
1154
- const config = import_node_fs2.default.readFileSync(filePath, "utf-8");
1155
- return new MicrofrontendConfig({
1156
- config: MicrofrontendConfig.validate(config)
1157
- });
1158
- } catch (e) {
1159
- throw MicrofrontendError.handle(e, {
1160
- fileName: filePath
1161
- });
1162
- }
1163
- }
1164
- /**
1165
- * Writes the configuration to a file.
1166
- */
1167
- write(fromApp, opts = {}) {
1168
- const { pretty = true, versions = ["v1", "v2"] } = opts;
1169
- const config = this.toSchemaJson();
1170
- if (versions.includes("v1")) {
1171
- const outputPath = getOutputFilePath2();
1172
- writeFile(outputPath, config, pretty);
1173
- }
1174
- if (versions.includes("v2")) {
1175
- const outputPath = getOutputFilePath();
1176
- const v2Config = convertV1ConfigToV2Config(config, fromApp);
1177
- writeFile(outputPath, v2Config, pretty);
1178
- }
1179
- }
1180
- };
36
+ var import_node_path9 = __toESM(require("path"), 1);
37
+ var import_node_fs8 = __toESM(require("fs"), 1);
1181
38
 
1182
- // src/config-v2/microfrontends/server/index.ts
1183
- var import_node_fs9 = __toESM(require("fs"), 1);
1184
- var import_node_path10 = require("path");
39
+ // src/config/microfrontends/server/index.ts
40
+ var import_node_fs7 = __toESM(require("fs"), 1);
41
+ var import_node_path8 = require("path");
1185
42
 
1186
- // src/config-v2/overrides/constants.ts
1187
- var OVERRIDES_COOKIE_PREFIX2 = "vercel-micro-frontends-override";
1188
- var OVERRIDES_ENV_COOKIE_PREFIX = `${OVERRIDES_COOKIE_PREFIX2}:env:`;
43
+ // src/config/overrides/constants.ts
44
+ var OVERRIDES_COOKIE_PREFIX = "vercel-micro-frontends-override";
45
+ var OVERRIDES_ENV_COOKIE_PREFIX = `${OVERRIDES_COOKIE_PREFIX}:env:`;
1189
46
 
1190
- // src/config-v2/overrides/is-override-cookie.ts
47
+ // src/config/overrides/is-override-cookie.ts
1191
48
  function isOverrideCookie(cookie) {
1192
49
  var _a;
1193
- return Boolean((_a = cookie.name) == null ? void 0 : _a.startsWith(OVERRIDES_COOKIE_PREFIX2));
50
+ return Boolean((_a = cookie.name) == null ? void 0 : _a.startsWith(OVERRIDES_COOKIE_PREFIX));
1194
51
  }
1195
52
 
1196
- // src/config-v2/overrides/get-override-from-cookie.ts
53
+ // src/config/overrides/get-override-from-cookie.ts
1197
54
  function getOverrideFromCookie(cookie) {
1198
55
  if (!isOverrideCookie(cookie) || !cookie.value)
1199
56
  return;
@@ -1203,7 +60,7 @@ function getOverrideFromCookie(cookie) {
1203
60
  };
1204
61
  }
1205
62
 
1206
- // src/config-v2/overrides/parse-overrides.ts
63
+ // src/config/overrides/parse-overrides.ts
1207
64
  function parseOverrides(cookies) {
1208
65
  const overridesConfig = { applications: {} };
1209
66
  cookies.forEach((cookie) => {
@@ -1217,15 +74,15 @@ function parseOverrides(cookies) {
1217
74
  return overridesConfig;
1218
75
  }
1219
76
 
1220
- // src/config-v2/errors.ts
1221
- var MicrofrontendError2 = class extends Error {
77
+ // src/config/errors.ts
78
+ var MicrofrontendError = class extends Error {
1222
79
  constructor(message, opts) {
1223
80
  super(message);
1224
81
  this.name = "MicrofrontendsError";
1225
82
  this.source = (opts == null ? void 0 : opts.source) ?? "@vercel/microfrontends";
1226
83
  this.type = (opts == null ? void 0 : opts.type) ?? "unknown";
1227
84
  this.subtype = opts == null ? void 0 : opts.subtype;
1228
- Error.captureStackTrace(this, MicrofrontendError2);
85
+ Error.captureStackTrace(this, MicrofrontendError);
1229
86
  }
1230
87
  isKnown() {
1231
88
  return this.type !== "unknown";
@@ -1240,7 +97,7 @@ var MicrofrontendError2 = class extends Error {
1240
97
  */
1241
98
  static convert(original, opts) {
1242
99
  if (opts == null ? void 0 : opts.fileName) {
1243
- const err = MicrofrontendError2.convertFSError(original, opts.fileName);
100
+ const err = MicrofrontendError.convertFSError(original, opts.fileName);
1244
101
  if (err) {
1245
102
  return err;
1246
103
  }
@@ -1248,25 +105,25 @@ var MicrofrontendError2 = class extends Error {
1248
105
  if (original.message.includes(
1249
106
  "Code generation from strings disallowed for this context"
1250
107
  )) {
1251
- return new MicrofrontendError2(original.message, {
108
+ return new MicrofrontendError(original.message, {
1252
109
  type: "config",
1253
110
  subtype: "unsupported_validation_env",
1254
111
  source: "ajv"
1255
112
  });
1256
113
  }
1257
- return new MicrofrontendError2(original.message);
114
+ return new MicrofrontendError(original.message);
1258
115
  }
1259
116
  static convertFSError(original, fileName) {
1260
117
  if (original instanceof Error && "code" in original) {
1261
118
  if (original.code === "ENOENT") {
1262
- return new MicrofrontendError2(`Could not find "${fileName}"`, {
119
+ return new MicrofrontendError(`Could not find "${fileName}"`, {
1263
120
  type: "config",
1264
121
  subtype: "unable_to_read_file",
1265
122
  source: "fs"
1266
123
  });
1267
124
  }
1268
125
  if (original.code === "EACCES") {
1269
- return new MicrofrontendError2(
126
+ return new MicrofrontendError(
1270
127
  `Permission denied while accessing "${fileName}"`,
1271
128
  {
1272
129
  type: "config",
@@ -1277,7 +134,7 @@ var MicrofrontendError2 = class extends Error {
1277
134
  }
1278
135
  }
1279
136
  if (original instanceof SyntaxError) {
1280
- return new MicrofrontendError2(
137
+ return new MicrofrontendError(
1281
138
  `Failed to parse "${fileName}": Invalid JSON format.`,
1282
139
  {
1283
140
  type: "config",
@@ -1294,26 +151,26 @@ var MicrofrontendError2 = class extends Error {
1294
151
  * @returns A MicrofrontendsError instance.
1295
152
  */
1296
153
  static handle(err, opts) {
1297
- if (err instanceof MicrofrontendError2) {
154
+ if (err instanceof MicrofrontendError) {
1298
155
  return err;
1299
156
  }
1300
157
  if (err instanceof Error) {
1301
- return MicrofrontendError2.convert(err, opts);
158
+ return MicrofrontendError.convert(err, opts);
1302
159
  }
1303
160
  if (typeof err === "object" && err !== null) {
1304
161
  if ("message" in err && typeof err.message === "string") {
1305
- return MicrofrontendError2.convert(new Error(err.message), opts);
162
+ return MicrofrontendError.convert(new Error(err.message), opts);
1306
163
  }
1307
164
  }
1308
- return new MicrofrontendError2("An unknown error occurred");
165
+ return new MicrofrontendError("An unknown error occurred");
1309
166
  }
1310
167
  };
1311
168
 
1312
- // src/config-v2/microfrontends-config/utils/get-config-from-env.ts
169
+ // src/config/microfrontends-config/utils/get-config-from-env.ts
1313
170
  function getConfigStringFromEnv() {
1314
171
  const config = process.env.MFE_CONFIG;
1315
172
  if (!config) {
1316
- throw new MicrofrontendError2(`Missing "MFE_CONFIG" in environment.`, {
173
+ throw new MicrofrontendError(`Missing "MFE_CONFIG" in environment.`, {
1317
174
  type: "config",
1318
175
  subtype: "not_found_in_env"
1319
176
  });
@@ -1321,21 +178,21 @@ function getConfigStringFromEnv() {
1321
178
  return config;
1322
179
  }
1323
180
 
1324
- // src/config-v2/microfrontends-config/isomorphic/index.ts
1325
- var import_jsonc_parser2 = require("jsonc-parser");
181
+ // src/config/microfrontends-config/isomorphic/index.ts
182
+ var import_jsonc_parser = require("jsonc-parser");
1326
183
 
1327
- // src/config-v2/schema/utils/is-main-config.ts
184
+ // src/config/schema/utils/is-main-config.ts
1328
185
  function isMainConfig(c) {
1329
186
  return !("partOf" in c);
1330
187
  }
1331
188
 
1332
- // src/config-v2/schema/utils/is-default-app.ts
189
+ // src/config/schema/utils/is-default-app.ts
1333
190
  function isDefaultApp(a) {
1334
191
  return !("routing" in a);
1335
192
  }
1336
193
 
1337
- // src/config-v2/microfrontends-config/client/index.ts
1338
- var import_path_to_regexp2 = require("path-to-regexp");
194
+ // src/config/microfrontends-config/client/index.ts
195
+ var import_path_to_regexp = require("path-to-regexp");
1339
196
  var MicrofrontendConfigClient = class {
1340
197
  constructor(config, opts) {
1341
198
  this.pathCache = {};
@@ -1365,21 +222,21 @@ var MicrofrontendConfigClient = class {
1365
222
  isEqual(other) {
1366
223
  return JSON.stringify(this.applications) === JSON.stringify(other.applications);
1367
224
  }
1368
- getApplicationNameForPath(path7) {
1369
- if (!path7.startsWith("/")) {
225
+ getApplicationNameForPath(path6) {
226
+ if (!path6.startsWith("/")) {
1370
227
  throw new Error(`Path must start with a /`);
1371
228
  }
1372
- if (this.pathCache[path7]) {
1373
- return this.pathCache[path7];
229
+ if (this.pathCache[path6]) {
230
+ return this.pathCache[path6];
1374
231
  }
1375
- const pathname = new URL(path7, "https://example.com").pathname;
232
+ const pathname = new URL(path6, "https://example.com").pathname;
1376
233
  for (const [name, application] of Object.entries(this.applications)) {
1377
234
  if (application.routing) {
1378
235
  for (const group of application.routing) {
1379
236
  for (const childPath of group.paths) {
1380
- const regexp = (0, import_path_to_regexp2.pathToRegexp)(childPath);
237
+ const regexp = (0, import_path_to_regexp.pathToRegexp)(childPath);
1381
238
  if (regexp.test(pathname)) {
1382
- this.pathCache[path7] = name;
239
+ this.pathCache[path6] = name;
1383
240
  return name;
1384
241
  }
1385
242
  }
@@ -1392,7 +249,7 @@ var MicrofrontendConfigClient = class {
1392
249
  if (!defaultApplication) {
1393
250
  return null;
1394
251
  }
1395
- this.pathCache[path7] = defaultApplication[0];
252
+ this.pathCache[path6] = defaultApplication[0];
1396
253
  return defaultApplication[0];
1397
254
  }
1398
255
  serialize() {
@@ -1400,13 +257,13 @@ var MicrofrontendConfigClient = class {
1400
257
  }
1401
258
  };
1402
259
 
1403
- // src/config-v2/microfrontends-config/isomorphic/validation.ts
1404
- var import_path_to_regexp3 = require("path-to-regexp");
1405
- var SUPPORTED_VERSIONS3 = ["2"];
260
+ // src/config/microfrontends-config/isomorphic/validation.ts
261
+ var import_path_to_regexp2 = require("path-to-regexp");
262
+ var SUPPORTED_VERSIONS = ["2"];
1406
263
  var validateConfigVersion = (version) => {
1407
- if (!SUPPORTED_VERSIONS3.includes(version)) {
1408
- throw new MicrofrontendError2(
1409
- `Unsupported version: ${version}. Supported versions are: ${SUPPORTED_VERSIONS3.join(
264
+ if (!SUPPORTED_VERSIONS.includes(version)) {
265
+ throw new MicrofrontendError(
266
+ `Unsupported version: ${version}. Supported versions are: ${SUPPORTED_VERSIONS.join(
1410
267
  ", "
1411
268
  )}`,
1412
269
  { type: "config", subtype: "unsupported_version" }
@@ -1424,22 +281,22 @@ var validateConfigPaths = (applicationConfigsById) => {
1424
281
  continue;
1425
282
  }
1426
283
  for (const pathMatch of app.routing) {
1427
- for (const path7 of pathMatch.paths) {
1428
- const tokens = (0, import_path_to_regexp3.parse)(path7);
284
+ for (const path6 of pathMatch.paths) {
285
+ const tokens = (0, import_path_to_regexp2.parse)(path6);
1429
286
  for (const token of tokens.slice(0, -1)) {
1430
287
  if (typeof token !== "string") {
1431
288
  errors.push(
1432
- `Path ${path7} may only have a :wildcard in the last path component`
289
+ `Path ${path6} may only have a :wildcard in the last path component`
1433
290
  );
1434
291
  }
1435
292
  }
1436
- const existing = pathsByApplicationId.get(path7);
293
+ const existing = pathsByApplicationId.get(path6);
1437
294
  if (existing) {
1438
295
  existing.applications.push(id);
1439
296
  } else {
1440
- pathsByApplicationId.set(path7, {
297
+ pathsByApplicationId.set(path6, {
1441
298
  applications: [id],
1442
- matcher: (0, import_path_to_regexp3.pathToRegexp)(path7),
299
+ matcher: (0, import_path_to_regexp2.pathToRegexp)(path6),
1443
300
  applicationId: id
1444
301
  });
1445
302
  }
@@ -1447,10 +304,10 @@ var validateConfigPaths = (applicationConfigsById) => {
1447
304
  }
1448
305
  }
1449
306
  const entries = Array.from(pathsByApplicationId.entries());
1450
- entries.forEach(([path7, { applications: ids, matcher, applicationId }]) => {
307
+ entries.forEach(([path6, { applications: ids, matcher, applicationId }]) => {
1451
308
  if (ids.length > 1) {
1452
309
  errors.push(
1453
- `Duplicate path "${path7}" for applications "${ids.join(", ")}"`
310
+ `Duplicate path "${path6}" for applications "${ids.join(", ")}"`
1454
311
  );
1455
312
  }
1456
313
  entries.forEach(
@@ -1458,14 +315,14 @@ var validateConfigPaths = (applicationConfigsById) => {
1458
315
  matchPath,
1459
316
  { applications: matchIds, applicationId: matchApplicationId }
1460
317
  ]) => {
1461
- if (path7 === matchPath) {
318
+ if (path6 === matchPath) {
1462
319
  return;
1463
320
  }
1464
321
  if (applicationId === matchApplicationId) {
1465
322
  return;
1466
323
  }
1467
324
  if (matcher.test(matchPath)) {
1468
- const source = `"${path7}" of application${ids.length > 0 ? "s" : ""} ${ids.join(", ")}`;
325
+ const source = `"${path6}" of application${ids.length > 0 ? "s" : ""} ${ids.join(", ")}`;
1469
326
  const destination = `"${matchPath}" of application${matchIds.length > 0 ? "s" : ""} ${matchIds.join(", ")}`;
1470
327
  errors.push(
1471
328
  `Overlapping path detected between ${source} and ${destination}`
@@ -1475,7 +332,7 @@ var validateConfigPaths = (applicationConfigsById) => {
1475
332
  );
1476
333
  });
1477
334
  if (errors.length) {
1478
- throw new MicrofrontendError2(`Invalid paths: ${errors.join(", ")}`, {
335
+ throw new MicrofrontendError(`Invalid paths: ${errors.join(", ")}`, {
1479
336
  type: "config",
1480
337
  subtype: "conflicting_paths"
1481
338
  });
@@ -1488,13 +345,13 @@ var validateAppPaths = (name, app) => {
1488
345
  continue;
1489
346
  }
1490
347
  if (p.endsWith("/")) {
1491
- throw new MicrofrontendError2(
348
+ throw new MicrofrontendError(
1492
349
  `Invalid path for application "${name}". ${p} must not end with a slash.`,
1493
350
  { type: "application", subtype: "invalid_path" }
1494
351
  );
1495
352
  }
1496
353
  if (!p.startsWith("/")) {
1497
- throw new MicrofrontendError2(
354
+ throw new MicrofrontendError(
1498
355
  `Invalid path for application "${name}". ${p} must start with a slash.`,
1499
356
  { type: "application", subtype: "invalid_path" }
1500
357
  );
@@ -1516,20 +373,20 @@ var validateConfigDefaultApplication = (applicationConfigsById) => {
1516
373
  const numApplicationsWithRouting = applicationsWithRoutingNames.length;
1517
374
  const numApplicationsWithoutRouting = numApplications - numApplicationsWithRouting;
1518
375
  if (numApplicationsWithoutRouting === 0) {
1519
- throw new MicrofrontendError2(
376
+ throw new MicrofrontendError(
1520
377
  `No default application found. At least one application needs to be the default by omitting routing.`,
1521
378
  { type: "config", subtype: "no_default_application" }
1522
379
  );
1523
380
  }
1524
381
  if (numApplicationsWithoutRouting > 1) {
1525
- throw new MicrofrontendError2(
382
+ throw new MicrofrontendError(
1526
383
  `Only one application can omit "routing". Found ${applicationsWithRoutingNames.length - Object.keys(applicationConfigsById).length > 1}.`,
1527
384
  { type: "config", subtype: "multiple_default_applications" }
1528
385
  );
1529
386
  }
1530
387
  };
1531
388
 
1532
- // src/config-v2/microfrontends-config/isomorphic/utils/generate-asset-prefix.ts
389
+ // src/config/microfrontends-config/isomorphic/utils/generate-asset-prefix.ts
1533
390
  var PREFIX = "vc-ap";
1534
391
  function generateAssetPrefixFromName({
1535
392
  name
@@ -1540,7 +397,7 @@ function generateAssetPrefixFromName({
1540
397
  return `${PREFIX}-${name}`;
1541
398
  }
1542
399
 
1543
- // src/config-v2/microfrontends-config/isomorphic/utils/generate-port.ts
400
+ // src/config/microfrontends-config/isomorphic/utils/generate-port.ts
1544
401
  function generatePortFromName({
1545
402
  name,
1546
403
  minPort = 3e3,
@@ -1560,13 +417,13 @@ function generatePortFromName({
1560
417
  return port;
1561
418
  }
1562
419
 
1563
- // src/config-v2/microfrontends-config/isomorphic/host.ts
1564
- var Host2 = class {
420
+ // src/config/microfrontends-config/isomorphic/host.ts
421
+ var Host = class {
1565
422
  constructor(hostConfig, options) {
1566
423
  const { protocol = "https", host, port } = hostConfig;
1567
424
  this.protocol = protocol;
1568
425
  this.host = host;
1569
- this.port = Host2.getPort({ port, protocol: this.protocol });
426
+ this.port = Host.getPort({ port, protocol: this.protocol });
1570
427
  this.local = options == null ? void 0 : options.isLocal;
1571
428
  }
1572
429
  isLocal() {
@@ -1585,7 +442,7 @@ var Host2 = class {
1585
442
  return port;
1586
443
  }
1587
444
  isDefaultPort() {
1588
- return this.port === Host2.getPort({ protocol: this.protocol });
445
+ return this.port === Host.getPort({ protocol: this.protocol });
1589
446
  }
1590
447
  toString(opts = {}) {
1591
448
  const url = this.toUrl(opts);
@@ -1597,7 +454,7 @@ var Host2 = class {
1597
454
  return new URL(url);
1598
455
  }
1599
456
  };
1600
- var LocalHost = class extends Host2 {
457
+ var LocalHost = class extends Host {
1601
458
  constructor({
1602
459
  appName,
1603
460
  ...hostConfig
@@ -1609,8 +466,8 @@ var LocalHost = class extends Host2 {
1609
466
  }
1610
467
  };
1611
468
 
1612
- // src/config-v2/microfrontends-config/isomorphic/application.ts
1613
- var Application2 = class {
469
+ // src/config/microfrontends-config/isomorphic/application.ts
470
+ var Application = class {
1614
471
  constructor(name, {
1615
472
  app,
1616
473
  overrides,
@@ -1623,12 +480,12 @@ var Application2 = class {
1623
480
  appName: name,
1624
481
  ...(_a = app.development) == null ? void 0 : _a.local
1625
482
  }),
1626
- fallback: ((_b = app.development) == null ? void 0 : _b.fallback) ? new Host2(app.development.fallback) : void 0
483
+ fallback: ((_b = app.development) == null ? void 0 : _b.fallback) ? new Host(app.development.fallback) : void 0
1627
484
  };
1628
- this.production = app.production ? new Host2(app.production) : void 0;
485
+ this.production = app.production ? new Host(app.production) : void 0;
1629
486
  this.vercel = app.vercel;
1630
487
  this.overrides = (overrides == null ? void 0 : overrides.environment) ? {
1631
- environment: new Host2(overrides.environment)
488
+ environment: new Host(overrides.environment)
1632
489
  } : void 0;
1633
490
  this.default = isDefault ?? false;
1634
491
  this.serialized = app;
@@ -1643,7 +500,7 @@ var Application2 = class {
1643
500
  return this.serialized;
1644
501
  }
1645
502
  };
1646
- var DefaultApplication = class extends Application2 {
503
+ var DefaultApplication = class extends Application {
1647
504
  constructor(name, {
1648
505
  app,
1649
506
  overrides
@@ -1654,13 +511,13 @@ var DefaultApplication = class extends Application2 {
1654
511
  isDefault: true
1655
512
  });
1656
513
  this.default = true;
1657
- this.production = new Host2(app.production);
514
+ this.production = new Host(app.production);
1658
515
  }
1659
516
  getAssetPrefix() {
1660
517
  return "";
1661
518
  }
1662
519
  };
1663
- var ChildApplication = class extends Application2 {
520
+ var ChildApplication = class extends Application {
1664
521
  constructor(name, {
1665
522
  app,
1666
523
  overrides
@@ -1679,10 +536,10 @@ var ChildApplication = class extends Application2 {
1679
536
  }
1680
537
  };
1681
538
 
1682
- // src/config-v2/microfrontends-config/isomorphic/constants.ts
1683
- var DEFAULT_LOCAL_PROXY_PORT2 = 3024;
539
+ // src/config/microfrontends-config/isomorphic/constants.ts
540
+ var DEFAULT_LOCAL_PROXY_PORT = 3024;
1684
541
 
1685
- // src/config-v2/microfrontends-config/isomorphic/index.ts
542
+ // src/config/microfrontends-config/isomorphic/index.ts
1686
543
  var MicrofrontendConfigIsomorphic = class {
1687
544
  constructor({
1688
545
  config,
@@ -1723,7 +580,7 @@ var MicrofrontendConfigIsomorphic = class {
1723
580
  );
1724
581
  }
1725
582
  if (isMainConfig(config) && !this.defaultApplication) {
1726
- throw new MicrofrontendError2(
583
+ throw new MicrofrontendError(
1727
584
  `Could not find default application in microfrontends configuration`,
1728
585
  {
1729
586
  type: "application",
@@ -1740,7 +597,7 @@ var MicrofrontendConfigIsomorphic = class {
1740
597
  };
1741
598
  }
1742
599
  static validate(config) {
1743
- const c = typeof config === "string" ? (0, import_jsonc_parser2.parse)(config) : config;
600
+ const c = typeof config === "string" ? (0, import_jsonc_parser.parse)(config) : config;
1744
601
  if (isMainConfig(c)) {
1745
602
  validateConfigVersion(c.version);
1746
603
  validateConfigPaths(c.applications);
@@ -1753,7 +610,7 @@ var MicrofrontendConfigIsomorphic = class {
1753
610
  cookies
1754
611
  }) {
1755
612
  return new MicrofrontendConfigIsomorphic({
1756
- config: (0, import_jsonc_parser2.parse)(getConfigStringFromEnv()),
613
+ config: (0, import_jsonc_parser.parse)(getConfigStringFromEnv()),
1757
614
  overrides: parseOverrides(cookies ?? []),
1758
615
  meta
1759
616
  });
@@ -1787,7 +644,7 @@ var MicrofrontendConfigIsomorphic = class {
1787
644
  }
1788
645
  const app = this.childApplications[name];
1789
646
  if (!app) {
1790
- throw new MicrofrontendError2(
647
+ throw new MicrofrontendError(
1791
648
  `Could not find microfrontends configuration for application "${name}"`,
1792
649
  {
1793
650
  type: "application",
@@ -1815,7 +672,7 @@ var MicrofrontendConfigIsomorphic = class {
1815
672
  */
1816
673
  getDefaultApplication() {
1817
674
  if (!this.defaultApplication) {
1818
- throw new MicrofrontendError2(
675
+ throw new MicrofrontendError(
1819
676
  `Could not find default application in microfrontends configuration`,
1820
677
  {
1821
678
  type: "application",
@@ -1830,7 +687,7 @@ var MicrofrontendConfigIsomorphic = class {
1830
687
  */
1831
688
  getLocalProxyPort() {
1832
689
  var _a, _b;
1833
- return ((_b = (_a = this.config.options) == null ? void 0 : _a.localProxy) == null ? void 0 : _b.port) ?? DEFAULT_LOCAL_PROXY_PORT2;
690
+ return ((_b = (_a = this.config.options) == null ? void 0 : _a.localProxy) == null ? void 0 : _b.port) ?? DEFAULT_LOCAL_PROXY_PORT;
1834
691
  }
1835
692
  /**
1836
693
  * Serializes the class back to the Schema type.
@@ -1864,7 +721,7 @@ var MicrofrontendConfigIsomorphic = class {
1864
721
  }
1865
722
  };
1866
723
 
1867
- // src/config-v2/microfrontends-config/isomorphic/child.ts
724
+ // src/config/microfrontends-config/isomorphic/child.ts
1868
725
  var MicrofrontendChildConfig = class extends MicrofrontendConfigIsomorphic {
1869
726
  constructor({
1870
727
  config,
@@ -1877,7 +734,7 @@ var MicrofrontendChildConfig = class extends MicrofrontendConfigIsomorphic {
1877
734
  }
1878
735
  };
1879
736
 
1880
- // src/config-v2/microfrontends-config/isomorphic/main.ts
737
+ // src/config/microfrontends-config/isomorphic/main.ts
1881
738
  var MicrofrontendMainConfig = class extends MicrofrontendConfigIsomorphic {
1882
739
  constructor({
1883
740
  config,
@@ -1904,7 +761,7 @@ var MicrofrontendMainConfig = class extends MicrofrontendConfigIsomorphic {
1904
761
  }
1905
762
  }
1906
763
  if (!defaultApplication) {
1907
- throw new MicrofrontendError2(
764
+ throw new MicrofrontendError(
1908
765
  `Could not find default application in microfrontends configuration`,
1909
766
  {
1910
767
  type: "application",
@@ -1916,7 +773,7 @@ var MicrofrontendMainConfig = class extends MicrofrontendConfigIsomorphic {
1916
773
  }
1917
774
  };
1918
775
 
1919
- // src/config-v2/microfrontends/isomorphic/index.ts
776
+ // src/config/microfrontends/isomorphic/index.ts
1920
777
  var Microfrontends = class {
1921
778
  constructor({
1922
779
  config,
@@ -1944,27 +801,27 @@ var Microfrontends = class {
1944
801
  }
1945
802
  };
1946
803
 
1947
- // src/config-v2/microfrontends/utils/find-repository-root.ts
1948
- var import_node_fs3 = __toESM(require("fs"), 1);
1949
- var import_node_path4 = __toESM(require("path"), 1);
804
+ // src/config/microfrontends/utils/find-repository-root.ts
805
+ var import_node_fs = __toESM(require("fs"), 1);
806
+ var import_node_path = __toESM(require("path"), 1);
1950
807
  var GIT_DIRECTORY = ".git";
1951
808
  function findRepositoryRoot(startDir) {
1952
809
  let currentDir = startDir || process.cwd();
1953
- while (currentDir !== import_node_path4.default.parse(currentDir).root) {
1954
- const gitPath = import_node_path4.default.join(currentDir, GIT_DIRECTORY);
1955
- if (import_node_fs3.default.existsSync(gitPath) && import_node_fs3.default.statSync(gitPath).isDirectory()) {
810
+ while (currentDir !== import_node_path.default.parse(currentDir).root) {
811
+ const gitPath = import_node_path.default.join(currentDir, GIT_DIRECTORY);
812
+ if (import_node_fs.default.existsSync(gitPath) && import_node_fs.default.statSync(gitPath).isDirectory()) {
1956
813
  return currentDir;
1957
814
  }
1958
- currentDir = import_node_path4.default.dirname(currentDir);
815
+ currentDir = import_node_path.default.dirname(currentDir);
1959
816
  }
1960
817
  throw new Error(
1961
818
  "Repository root not found. Specify the root of the repository with the `repository.root` option."
1962
819
  );
1963
820
  }
1964
821
 
1965
- // src/config-v2/microfrontends/utils/find-package-path.ts
1966
- var import_node_path5 = require("path");
1967
- var import_node_fs4 = require("fs");
822
+ // src/config/microfrontends/utils/find-package-path.ts
823
+ var import_node_path2 = require("path");
824
+ var import_node_fs2 = require("fs");
1968
825
  var import_fast_glob = __toESM(require("fast-glob"), 1);
1969
826
  var configCache = {};
1970
827
  function findPackagePathWithGlob({
@@ -1981,7 +838,7 @@ function findPackagePathWithGlob({
1981
838
  });
1982
839
  const matchingPaths = [];
1983
840
  for (const packageJsonPath2 of packageJsonPaths) {
1984
- const packageJsonContent = (0, import_node_fs4.readFileSync)(packageJsonPath2, "utf-8");
841
+ const packageJsonContent = (0, import_node_fs2.readFileSync)(packageJsonPath2, "utf-8");
1985
842
  const packageJson = JSON.parse(packageJsonContent);
1986
843
  if (packageJson.name === name) {
1987
844
  matchingPaths.push(packageJsonPath2);
@@ -1998,7 +855,7 @@ function findPackagePathWithGlob({
1998
855
  );
1999
856
  }
2000
857
  const [packageJsonPath] = matchingPaths;
2001
- return (0, import_node_path5.dirname)(packageJsonPath);
858
+ return (0, import_node_path2.dirname)(packageJsonPath);
2002
859
  } catch (error) {
2003
860
  return null;
2004
861
  }
@@ -2018,19 +875,19 @@ function findPackagePath(opts) {
2018
875
  return result;
2019
876
  }
2020
877
 
2021
- // src/config-v2/microfrontends/utils/find-default-package.ts
2022
- var import_node_path6 = require("path");
2023
- var import_node_fs5 = require("fs");
2024
- var import_jsonc_parser3 = require("jsonc-parser");
878
+ // src/config/microfrontends/utils/find-default-package.ts
879
+ var import_node_path3 = require("path");
880
+ var import_node_fs3 = require("fs");
881
+ var import_jsonc_parser2 = require("jsonc-parser");
2025
882
  var import_fast_glob2 = __toESM(require("fast-glob"), 1);
2026
883
 
2027
- // src/config-v2/constants.ts
884
+ // src/config/constants.ts
2028
885
  var CONFIGURATION_FILENAMES = [
2029
886
  "microfrontends.jsonc",
2030
887
  "microfrontends.json"
2031
888
  ];
2032
889
 
2033
- // src/config-v2/microfrontends/utils/find-default-package.ts
890
+ // src/config/microfrontends/utils/find-default-package.ts
2034
891
  var configCache2 = {};
2035
892
  function findDefaultMicrofrontendsPackages({
2036
893
  repositoryRoot,
@@ -2049,11 +906,11 @@ function findDefaultMicrofrontendsPackages({
2049
906
  );
2050
907
  const matchingPaths = [];
2051
908
  for (const microfrontendsJsonPath of microfrontendsJsonPaths) {
2052
- const microfrontendsJsonContent = (0, import_node_fs5.readFileSync)(
909
+ const microfrontendsJsonContent = (0, import_node_fs3.readFileSync)(
2053
910
  microfrontendsJsonPath,
2054
911
  "utf-8"
2055
912
  );
2056
- const microfrontendsJson = (0, import_jsonc_parser3.parse)(microfrontendsJsonContent);
913
+ const microfrontendsJson = (0, import_jsonc_parser2.parse)(microfrontendsJsonContent);
2057
914
  if (isMainConfig(microfrontendsJson) && microfrontendsJson.applications[applicationName]) {
2058
915
  matchingPaths.push(microfrontendsJsonPath);
2059
916
  }
@@ -2070,7 +927,7 @@ ${matchingPaths.join("\n \u2022 ")}`
2070
927
  );
2071
928
  }
2072
929
  const [packageJsonPath] = matchingPaths;
2073
- return (0, import_node_path6.dirname)(packageJsonPath);
930
+ return (0, import_node_path3.dirname)(packageJsonPath);
2074
931
  } catch (error) {
2075
932
  return null;
2076
933
  }
@@ -2090,25 +947,25 @@ function findDefaultMicrofrontendsPackage(opts) {
2090
947
  return result;
2091
948
  }
2092
949
 
2093
- // src/config-v2/microfrontends/utils/is-monorepo.ts
2094
- var import_node_fs6 = __toESM(require("fs"), 1);
2095
- var import_node_path7 = __toESM(require("path"), 1);
950
+ // src/config/microfrontends/utils/is-monorepo.ts
951
+ var import_node_fs4 = __toESM(require("fs"), 1);
952
+ var import_node_path4 = __toESM(require("path"), 1);
2096
953
  function isMonorepo({
2097
954
  repositoryRoot
2098
955
  }) {
2099
956
  try {
2100
- if (import_node_fs6.default.existsSync(import_node_path7.default.join(repositoryRoot, "pnpm-workspace.yaml"))) {
957
+ if (import_node_fs4.default.existsSync(import_node_path4.default.join(repositoryRoot, "pnpm-workspace.yaml"))) {
2101
958
  return true;
2102
959
  }
2103
- if (import_node_fs6.default.existsSync(import_node_path7.default.join(repositoryRoot, "vlt-workspaces.json"))) {
960
+ if (import_node_fs4.default.existsSync(import_node_path4.default.join(repositoryRoot, "vlt-workspaces.json"))) {
2104
961
  return true;
2105
962
  }
2106
- const packageJsonPath = import_node_path7.default.join(repositoryRoot, "package.json");
2107
- if (!import_node_fs6.default.existsSync(packageJsonPath)) {
963
+ const packageJsonPath = import_node_path4.default.join(repositoryRoot, "package.json");
964
+ if (!import_node_fs4.default.existsSync(packageJsonPath)) {
2108
965
  return false;
2109
966
  }
2110
967
  const packageJson = JSON.parse(
2111
- import_node_fs6.default.readFileSync(packageJsonPath, "utf-8")
968
+ import_node_fs4.default.readFileSync(packageJsonPath, "utf-8")
2112
969
  );
2113
970
  return packageJson.workspaces !== void 0;
2114
971
  } catch (error) {
@@ -2117,43 +974,67 @@ function isMonorepo({
2117
974
  }
2118
975
  }
2119
976
 
2120
- // src/config-v2/microfrontends/utils/find-package-root.ts
2121
- var import_node_fs7 = __toESM(require("fs"), 1);
2122
- var import_node_path8 = __toESM(require("path"), 1);
977
+ // src/config/microfrontends/utils/find-package-root.ts
978
+ var import_node_fs5 = __toESM(require("fs"), 1);
979
+ var import_node_path5 = __toESM(require("path"), 1);
2123
980
  var PACKAGE_JSON = "package.json";
2124
981
  function findPackageRoot(startDir) {
2125
982
  let currentDir = startDir || process.cwd();
2126
- while (currentDir !== import_node_path8.default.parse(currentDir).root) {
2127
- const pkgJsonPath = import_node_path8.default.join(currentDir, PACKAGE_JSON);
2128
- if (import_node_fs7.default.existsSync(pkgJsonPath)) {
983
+ while (currentDir !== import_node_path5.default.parse(currentDir).root) {
984
+ const pkgJsonPath = import_node_path5.default.join(currentDir, PACKAGE_JSON);
985
+ if (import_node_fs5.default.existsSync(pkgJsonPath)) {
2129
986
  return currentDir;
2130
987
  }
2131
- currentDir = import_node_path8.default.dirname(currentDir);
988
+ currentDir = import_node_path5.default.dirname(currentDir);
2132
989
  }
2133
990
  throw new Error(
2134
991
  "Package root not found. Specify the root of the package with the `package.root` option."
2135
992
  );
2136
993
  }
2137
994
 
2138
- // src/config-v2/microfrontends/utils/find-config.ts
2139
- var import_node_fs8 = __toESM(require("fs"), 1);
2140
- var import_node_path9 = require("path");
995
+ // src/config/microfrontends/utils/find-config.ts
996
+ var import_node_fs6 = __toESM(require("fs"), 1);
997
+ var import_node_path6 = require("path");
2141
998
  function findConfig({ dir }) {
2142
999
  for (const filename of CONFIGURATION_FILENAMES) {
2143
- const maybeConfig = (0, import_node_path9.join)(dir, filename);
2144
- if (import_node_fs8.default.existsSync(maybeConfig)) {
1000
+ const maybeConfig = (0, import_node_path6.join)(dir, filename);
1001
+ if (import_node_fs6.default.existsSync(maybeConfig)) {
2145
1002
  return maybeConfig;
2146
1003
  }
2147
1004
  }
2148
1005
  return null;
2149
1006
  }
2150
1007
 
2151
- // src/config-v2/microfrontends/server/validation.ts
2152
- var import_jsonc_parser4 = require("jsonc-parser");
2153
- var import_ajv2 = require("ajv");
1008
+ // src/config/microfrontends/server/utils/get-output-file-path.ts
1009
+ var import_node_path7 = __toESM(require("path"), 1);
1010
+
1011
+ // src/config/microfrontends/server/constants.ts
1012
+ var MFE_CONFIG_DEFAULT_FILE_PATH = "microfrontends";
1013
+ var MFE_CONFIG_DEFAULT_FILE_NAME = "microfrontends.json";
1014
+
1015
+ // src/utils/is-vercel.ts
1016
+ function isVercel() {
1017
+ return process.env.VERCEL === "1";
1018
+ }
1019
+
1020
+ // src/config/microfrontends/server/utils/get-output-file-path.ts
1021
+ function getOutputFilePath() {
1022
+ if (isVercel()) {
1023
+ return import_node_path7.default.join(
1024
+ ".vercel",
1025
+ MFE_CONFIG_DEFAULT_FILE_PATH,
1026
+ MFE_CONFIG_DEFAULT_FILE_NAME
1027
+ );
1028
+ }
1029
+ return import_node_path7.default.join(MFE_CONFIG_DEFAULT_FILE_PATH, MFE_CONFIG_DEFAULT_FILE_NAME);
1030
+ }
1031
+
1032
+ // src/config/microfrontends/server/validation.ts
1033
+ var import_jsonc_parser3 = require("jsonc-parser");
1034
+ var import_ajv = require("ajv");
2154
1035
 
2155
- // schema/schema-v2.json
2156
- var schema_v2_default = {
1036
+ // schema/schema.json
1037
+ var schema_default = {
2157
1038
  $schema: "http://json-schema.org/draft-07/schema#",
2158
1039
  $ref: "#/definitions/Config",
2159
1040
  definitions: {
@@ -2192,7 +1073,8 @@ var schema_v2_default = {
2192
1073
  description: "Mapping of application names to the routes that they host. Only needs to be defined in the application that owns the primary microfrontend domain"
2193
1074
  }
2194
1075
  },
2195
- required: ["applications", "version"]
1076
+ required: ["applications", "version"],
1077
+ additionalProperties: false
2196
1078
  },
2197
1079
  Options: {
2198
1080
  type: "object",
@@ -2205,7 +1087,8 @@ var schema_v2_default = {
2205
1087
  $ref: "#/definitions/LocalProxyOptions",
2206
1088
  description: "Options for local proxy."
2207
1089
  }
2208
- }
1090
+ },
1091
+ additionalProperties: false
2209
1092
  },
2210
1093
  VercelOptions: {
2211
1094
  type: "object",
@@ -2218,7 +1101,8 @@ var schema_v2_default = {
2218
1101
  type: "boolean",
2219
1102
  description: "If you want to disable the overrides for the site. For example, if you are managing rewrites between applications externally, you may wish to disable the overrides on the toolbar as they will have no effect."
2220
1103
  }
2221
- }
1104
+ },
1105
+ additionalProperties: false
2222
1106
  },
2223
1107
  LocalProxyOptions: {
2224
1108
  type: "object",
@@ -2227,7 +1111,8 @@ var schema_v2_default = {
2227
1111
  type: "number",
2228
1112
  description: "The port number used by the local proxy server.\n\nThe default is `3024`."
2229
1113
  }
2230
- }
1114
+ },
1115
+ additionalProperties: false
2231
1116
  },
2232
1117
  Application: {
2233
1118
  anyOf: [
@@ -2252,7 +1137,8 @@ var schema_v2_default = {
2252
1137
  $ref: "#/definitions/HostConfig"
2253
1138
  }
2254
1139
  },
2255
- required: ["production"]
1140
+ required: ["production"],
1141
+ additionalProperties: false
2256
1142
  },
2257
1143
  Vercel: {
2258
1144
  type: "object",
@@ -2262,7 +1148,8 @@ var schema_v2_default = {
2262
1148
  description: "Vercel project ID"
2263
1149
  }
2264
1150
  },
2265
- required: ["projectId"]
1151
+ required: ["projectId"],
1152
+ additionalProperties: false
2266
1153
  },
2267
1154
  Development: {
2268
1155
  type: "object",
@@ -2278,10 +1165,12 @@ var schema_v2_default = {
2278
1165
  type: "string",
2279
1166
  description: "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
2280
1167
  }
2281
- }
1168
+ },
1169
+ additionalProperties: false
2282
1170
  },
2283
1171
  LocalHostConfig: {
2284
1172
  type: "object",
1173
+ additionalProperties: false,
2285
1174
  properties: {
2286
1175
  host: {
2287
1176
  type: "string",
@@ -2315,7 +1204,8 @@ var schema_v2_default = {
2315
1204
  description: "The port number to be used for the connection. Common values include `80` for HTTP and `443` for HTTPS."
2316
1205
  }
2317
1206
  },
2318
- required: ["host"]
1207
+ required: ["host"],
1208
+ additionalProperties: false
2319
1209
  },
2320
1210
  ChildApplication: {
2321
1211
  type: "object",
@@ -2334,7 +1224,8 @@ var schema_v2_default = {
2334
1224
  $ref: "#/definitions/HostConfig"
2335
1225
  }
2336
1226
  },
2337
- required: ["routing"]
1227
+ required: ["routing"],
1228
+ additionalProperties: false
2338
1229
  },
2339
1230
  Routing: {
2340
1231
  type: "array",
@@ -2360,7 +1251,8 @@ var schema_v2_default = {
2360
1251
  }
2361
1252
  }
2362
1253
  },
2363
- required: ["paths"]
1254
+ required: ["paths"],
1255
+ additionalProperties: false
2364
1256
  },
2365
1257
  ApplicationRouting: {
2366
1258
  type: "object",
@@ -2393,19 +1285,20 @@ var schema_v2_default = {
2393
1285
  description: "Applications that only serve a subset of the microfrontend routes only need to reference the name of the primary application that owns the full microfrontends configuration."
2394
1286
  }
2395
1287
  },
2396
- required: ["partOf", "version"]
1288
+ required: ["partOf", "version"],
1289
+ additionalProperties: false
2397
1290
  }
2398
1291
  }
2399
1292
  };
2400
1293
 
2401
- // src/config-v2/schema/utils/load.ts
2402
- var SCHEMA2 = schema_v2_default;
1294
+ // src/config/schema/utils/load.ts
1295
+ var SCHEMA = schema_default;
2403
1296
 
2404
- // src/config-v2/microfrontends/server/validation.ts
2405
- function validateSchema2(configString) {
2406
- const parsedConfig = (0, import_jsonc_parser4.parse)(configString);
2407
- const ajv = new import_ajv2.Ajv();
2408
- const validate = ajv.compile(SCHEMA2);
1297
+ // src/config/microfrontends/server/validation.ts
1298
+ function validateSchema(configString) {
1299
+ const parsedConfig = (0, import_jsonc_parser3.parse)(configString);
1300
+ const ajv = new import_ajv.Ajv();
1301
+ const validate = ajv.compile(SCHEMA);
2409
1302
  const isValid = validate(parsedConfig);
2410
1303
  if (!isValid) {
2411
1304
  throw new MicrofrontendError(
@@ -2416,7 +1309,7 @@ function validateSchema2(configString) {
2416
1309
  return parsedConfig;
2417
1310
  }
2418
1311
 
2419
- // src/config-v2/microfrontends/server/index.ts
1312
+ // src/config/microfrontends/server/index.ts
2420
1313
  var MicrofrontendsServer = class extends Microfrontends {
2421
1314
  /**
2422
1315
  * Writes the configuration to a file.
@@ -2425,8 +1318,8 @@ var MicrofrontendsServer = class extends Microfrontends {
2425
1318
  pretty: true
2426
1319
  }) {
2427
1320
  const outputPath = getOutputFilePath();
2428
- import_node_fs9.default.mkdirSync((0, import_node_path10.dirname)(outputPath), { recursive: true });
2429
- import_node_fs9.default.writeFileSync(
1321
+ import_node_fs7.default.mkdirSync((0, import_node_path8.dirname)(outputPath), { recursive: true });
1322
+ import_node_fs7.default.writeFileSync(
2430
1323
  outputPath,
2431
1324
  JSON.stringify(
2432
1325
  this.config.toSchemaJson(),
@@ -2459,7 +1352,7 @@ var MicrofrontendsServer = class extends Microfrontends {
2459
1352
  meta
2460
1353
  });
2461
1354
  }
2462
- throw new MicrofrontendError2(
1355
+ throw new MicrofrontendError(
2463
1356
  "Invalid config: must be a string or an object",
2464
1357
  { type: "config", subtype: "does_not_match_schema" }
2465
1358
  );
@@ -2483,7 +1376,7 @@ var MicrofrontendsServer = class extends Microfrontends {
2483
1376
  */
2484
1377
  static validate(config) {
2485
1378
  if (typeof config === "string") {
2486
- const c = validateSchema2(config);
1379
+ const c = validateSchema(config);
2487
1380
  return c;
2488
1381
  }
2489
1382
  return config;
@@ -2512,9 +1405,9 @@ var MicrofrontendsServer = class extends Microfrontends {
2512
1405
  }
2513
1406
  try {
2514
1407
  const packageRoot = findPackageRoot(directory);
2515
- const packageJsonPath = (0, import_node_path10.join)(packageRoot, "package.json");
1408
+ const packageJsonPath = (0, import_node_path8.join)(packageRoot, "package.json");
2516
1409
  const packageJson = JSON.parse(
2517
- import_node_fs9.default.readFileSync(packageJsonPath, "utf-8")
1410
+ import_node_fs7.default.readFileSync(packageJsonPath, "utf-8")
2518
1411
  );
2519
1412
  if (!packageJson.name) {
2520
1413
  throw new Error(`No name found in package.json at ${packageJsonPath}`);
@@ -2548,7 +1441,7 @@ var MicrofrontendsServer = class extends Microfrontends {
2548
1441
  }
2549
1442
  throw new Error("Unable to infer");
2550
1443
  } catch (e) {
2551
- throw new MicrofrontendError2(
1444
+ throw new MicrofrontendError(
2552
1445
  "Unable to infer microfrontends configuration",
2553
1446
  { type: "config", subtype: "inference_failed" }
2554
1447
  );
@@ -2564,7 +1457,7 @@ var MicrofrontendsServer = class extends Microfrontends {
2564
1457
  options
2565
1458
  }) {
2566
1459
  try {
2567
- const configJson = import_node_fs9.default.readFileSync(filePath, "utf-8");
1460
+ const configJson = import_node_fs7.default.readFileSync(filePath, "utf-8");
2568
1461
  const config = MicrofrontendsServer.validate(configJson);
2569
1462
  if (!isMainConfig(config) && (options == null ? void 0 : options.resolveMainConfig)) {
2570
1463
  const repositoryRoot = findRepositoryRoot();
@@ -2575,14 +1468,14 @@ var MicrofrontendsServer = class extends Microfrontends {
2575
1468
  name: config.partOf
2576
1469
  });
2577
1470
  if (!packagePath) {
2578
- throw new MicrofrontendError2(
1471
+ throw new MicrofrontendError(
2579
1472
  `Could not find default application "${config.partOf}" in the repository`,
2580
1473
  { type: "config", subtype: "not_found" }
2581
1474
  );
2582
1475
  }
2583
1476
  const maybeConfig = findConfig({ dir: packagePath });
2584
1477
  if (!maybeConfig) {
2585
- throw new MicrofrontendError2(
1478
+ throw new MicrofrontendError(
2586
1479
  `Could not find microfrontends configuration in ${packagePath}`,
2587
1480
  { type: "config", subtype: "not_found" }
2588
1481
  );
@@ -2599,7 +1492,7 @@ var MicrofrontendsServer = class extends Microfrontends {
2599
1492
  meta
2600
1493
  });
2601
1494
  } catch (e) {
2602
- throw MicrofrontendError2.handle(e, {
1495
+ throw MicrofrontendError.handle(e, {
2603
1496
  fileName: filePath
2604
1497
  });
2605
1498
  }
@@ -2612,10 +1505,10 @@ var MicrofrontendsServer = class extends Microfrontends {
2612
1505
  overrides
2613
1506
  }) {
2614
1507
  try {
2615
- const config = import_node_fs9.default.readFileSync(filePath, "utf-8");
1508
+ const config = import_node_fs7.default.readFileSync(filePath, "utf-8");
2616
1509
  const validatedConfig = MicrofrontendsServer.validate(config);
2617
1510
  if (!isMainConfig(validatedConfig)) {
2618
- throw new MicrofrontendError2(
1511
+ throw new MicrofrontendError(
2619
1512
  `${filePath} is not a main microfrontend config`,
2620
1513
  {
2621
1514
  type: "config",
@@ -2625,7 +1518,7 @@ var MicrofrontendsServer = class extends Microfrontends {
2625
1518
  }
2626
1519
  const [defaultApplication] = Object.entries(validatedConfig.applications).filter(([, app]) => isDefaultApp(app)).map(([name]) => name);
2627
1520
  if (!defaultApplication) {
2628
- throw new MicrofrontendError2(
1521
+ throw new MicrofrontendError(
2629
1522
  `No default application found. At least one application needs to be the default by omitting routing.`,
2630
1523
  { type: "config", subtype: "no_default_application" }
2631
1524
  );
@@ -2636,7 +1529,7 @@ var MicrofrontendsServer = class extends Microfrontends {
2636
1529
  meta: { fromApp: defaultApplication }
2637
1530
  });
2638
1531
  } catch (e) {
2639
- throw MicrofrontendError2.handle(e, {
1532
+ throw MicrofrontendError.handle(e, {
2640
1533
  fileName: filePath
2641
1534
  });
2642
1535
  }
@@ -2646,9 +1539,9 @@ var MicrofrontendsServer = class extends Microfrontends {
2646
1539
  // src/utils/mfe-port.ts
2647
1540
  function mfePort(packageDir) {
2648
1541
  const { name: appName, version } = getPackageJson(packageDir);
2649
- const result = loadV2({ packageDir, appName }) || loadV1({ packageDir, appName });
1542
+ const result = loadConfig({ packageDir, appName });
2650
1543
  if (!result) {
2651
- throw new MicrofrontendError2(
1544
+ throw new MicrofrontendError(
2652
1545
  `Unable to determine configured port for ${appName}`,
2653
1546
  { type: "config", subtype: "not_found" }
2654
1547
  );
@@ -2661,10 +1554,10 @@ function mfePort(packageDir) {
2661
1554
  };
2662
1555
  }
2663
1556
  function getPackageJson(packageDir) {
2664
- const filePath = import_node_path11.default.join(packageDir, "package.json");
2665
- return JSON.parse(import_node_fs10.default.readFileSync(filePath, "utf-8"));
1557
+ const filePath = import_node_path9.default.join(packageDir, "package.json");
1558
+ return JSON.parse(import_node_fs8.default.readFileSync(filePath, "utf-8"));
2666
1559
  }
2667
- function loadV2({
1560
+ function loadConfig({
2668
1561
  packageDir,
2669
1562
  appName
2670
1563
  }) {
@@ -2682,21 +1575,6 @@ function loadV2({
2682
1575
  const port = app.development.local.port;
2683
1576
  return { port };
2684
1577
  }
2685
- function loadV1({
2686
- packageDir,
2687
- appName
2688
- }) {
2689
- const filePath = import_node_path11.default.join(packageDir, "micro-frontends.jsonc");
2690
- let config;
2691
- try {
2692
- config = MicrofrontendConfig.fromFile({ filePath });
2693
- } catch (e) {
2694
- return void 0;
2695
- }
2696
- const zone = config.getZone(appName);
2697
- const port = zone.development.local.port;
2698
- return { port };
2699
- }
2700
1578
  // Annotate the CommonJS export names for ESM import in node:
2701
1579
  0 && (module.exports = {
2702
1580
  mfePort