@vercel/microfrontends 0.13.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 (120) hide show
  1. package/README.md +3 -3
  2. package/dist/bin/cli.cjs +403 -1627
  3. package/dist/config.cjs +460 -1004
  4. package/dist/config.cjs.map +1 -1
  5. package/dist/config.d.ts +4 -25
  6. package/dist/config.js +456 -983
  7. package/dist/config.js.map +1 -1
  8. package/dist/{index-83133f2d.d.ts → index-bf67a461.d.ts} +3 -10
  9. package/dist/{v2/microfrontends → microfrontends}/server.cjs +128 -194
  10. package/dist/microfrontends/server.cjs.map +1 -0
  11. package/dist/{v2/microfrontends → microfrontends}/server.d.ts +6 -5
  12. package/dist/{v2/microfrontends → microfrontends}/server.js +125 -191
  13. package/dist/microfrontends/server.js.map +1 -0
  14. package/dist/{v2/microfrontends.cjs → microfrontends.cjs} +21 -35
  15. package/dist/microfrontends.cjs.map +1 -0
  16. package/dist/{v2/microfrontends.d.ts → microfrontends.d.ts} +4 -3
  17. package/dist/{v2/microfrontends.js → microfrontends.js} +20 -34
  18. package/dist/microfrontends.js.map +1 -0
  19. package/dist/next/client.cjs +1 -1
  20. package/dist/next/client.cjs.map +1 -1
  21. package/dist/next/client.js +1 -1
  22. package/dist/next/client.js.map +1 -1
  23. package/dist/next/config.cjs +1323 -1024
  24. package/dist/next/config.cjs.map +1 -1
  25. package/dist/next/config.d.ts +1 -1
  26. package/dist/next/config.js +1327 -1028
  27. package/dist/next/config.js.map +1 -1
  28. package/dist/next/endpoints.cjs +77 -18
  29. package/dist/next/endpoints.cjs.map +1 -1
  30. package/dist/next/endpoints.d.ts +14 -3
  31. package/dist/next/endpoints.js +77 -18
  32. package/dist/next/endpoints.js.map +1 -1
  33. package/dist/next/middleware.cjs +745 -425
  34. package/dist/next/middleware.cjs.map +1 -1
  35. package/dist/next/middleware.d.ts +10 -5
  36. package/dist/next/middleware.js +745 -425
  37. package/dist/next/middleware.js.map +1 -1
  38. package/dist/next/testing.cjs +595 -1032
  39. package/dist/next/testing.cjs.map +1 -1
  40. package/dist/next/testing.d.ts +14 -12
  41. package/dist/next/testing.js +589 -1016
  42. package/dist/next/testing.js.map +1 -1
  43. package/dist/overrides.cjs +40 -108
  44. package/dist/overrides.cjs.map +1 -1
  45. package/dist/overrides.d.ts +24 -2
  46. package/dist/overrides.js +36 -106
  47. package/dist/overrides.js.map +1 -1
  48. package/dist/routing.cjs +19 -0
  49. package/dist/routing.cjs.map +1 -0
  50. package/dist/routing.d.ts +26 -0
  51. package/dist/routing.js +1 -0
  52. package/dist/{v2/schema.cjs → schema.cjs} +1 -1
  53. package/dist/schema.cjs.map +1 -0
  54. package/dist/schema.d.ts +1 -0
  55. package/dist/schema.js.map +1 -0
  56. package/dist/{types-a995174e.d.ts → types-a29d224a.d.ts} +1 -7
  57. package/dist/{types-15b7f215.d.ts → types-cfe3308b.d.ts} +1 -1
  58. package/dist/types-fc30696d.d.ts +11 -0
  59. package/dist/utils/mfe-port.cjs +254 -1362
  60. package/dist/utils/mfe-port.cjs.map +1 -1
  61. package/dist/utils/mfe-port.js +250 -1358
  62. package/dist/utils/mfe-port.js.map +1 -1
  63. package/dist/validation.cjs +31 -365
  64. package/dist/validation.cjs.map +1 -1
  65. package/dist/validation.d.ts +3 -152
  66. package/dist/validation.js +30 -363
  67. package/dist/validation.js.map +1 -1
  68. package/package.json +32 -80
  69. package/schema/schema.json +174 -244
  70. package/dist/config/client.cjs +0 -54
  71. package/dist/config/client.cjs.map +0 -1
  72. package/dist/config/client.d.ts +0 -23
  73. package/dist/config/client.js +0 -28
  74. package/dist/config/client.js.map +0 -1
  75. package/dist/config/edge.cjs +0 -508
  76. package/dist/config/edge.cjs.map +0 -1
  77. package/dist/config/edge.d.ts +0 -20
  78. package/dist/config/edge.js +0 -481
  79. package/dist/config/edge.js.map +0 -1
  80. package/dist/microfrontend-config-983a5139.d.ts +0 -154
  81. package/dist/schema-2922d49e.d.ts +0 -182
  82. package/dist/v2/config.cjs +0 -723
  83. package/dist/v2/config.cjs.map +0 -1
  84. package/dist/v2/config.d.ts +0 -3
  85. package/dist/v2/config.js +0 -698
  86. package/dist/v2/config.js.map +0 -1
  87. package/dist/v2/microfrontends/server.cjs.map +0 -1
  88. package/dist/v2/microfrontends/server.js.map +0 -1
  89. package/dist/v2/microfrontends.cjs.map +0 -1
  90. package/dist/v2/microfrontends.js.map +0 -1
  91. package/dist/v2/next/client.cjs +0 -3
  92. package/dist/v2/next/client.cjs.map +0 -1
  93. package/dist/v2/next/client.d.ts +0 -45
  94. package/dist/v2/next/client.js +0 -3
  95. package/dist/v2/next/client.js.map +0 -1
  96. package/dist/v2/next/config.cjs +0 -2132
  97. package/dist/v2/next/config.cjs.map +0 -1
  98. package/dist/v2/next/config.d.ts +0 -22
  99. package/dist/v2/next/config.js +0 -2097
  100. package/dist/v2/next/config.js.map +0 -1
  101. package/dist/v2/next/endpoints.cjs +0 -141
  102. package/dist/v2/next/endpoints.cjs.map +0 -1
  103. package/dist/v2/next/endpoints.d.ts +0 -15
  104. package/dist/v2/next/endpoints.js +0 -116
  105. package/dist/v2/next/endpoints.js.map +0 -1
  106. package/dist/v2/next/middleware.cjs +0 -1143
  107. package/dist/v2/next/middleware.cjs.map +0 -1
  108. package/dist/v2/next/middleware.d.ts +0 -29
  109. package/dist/v2/next/middleware.js +0 -1115
  110. package/dist/v2/next/middleware.js.map +0 -1
  111. package/dist/v2/overrides.cjs +0 -75
  112. package/dist/v2/overrides.cjs.map +0 -1
  113. package/dist/v2/overrides.d.ts +0 -24
  114. package/dist/v2/overrides.js +0 -45
  115. package/dist/v2/overrides.js.map +0 -1
  116. package/dist/v2/schema.cjs.map +0 -1
  117. package/dist/v2/schema.d.ts +0 -1
  118. package/schema/schema-v2.json +0 -270
  119. /package/dist/{v2/schema.js.map → routing.js.map} +0 -0
  120. /package/dist/{v2/schema.js → schema.js} +0 -0
@@ -1,1165 +1,22 @@
1
1
  // src/utils/mfe-port.ts
2
- import path6 from "node:path";
3
- import fs7 from "node:fs";
4
-
5
- // src/config/types.ts
6
- var isDefaultApplicationConfig = (app) => app.default && typeof app.routing === "undefined";
7
-
8
- // src/config/microfrontend-config.ts
9
- import fs2 from "node:fs";
10
-
11
- // src/config-v2/microfrontends/server/utils/get-output-file-path.ts
12
- import path from "node:path";
13
-
14
- // src/config-v2/microfrontends/server/constants.ts
15
- var MFE_CONFIG_DEFAULT_FILE_PATH = "microfrontends";
16
- var MFE_CONFIG_DEFAULT_FILE_NAME = "microfrontends.json";
17
-
18
- // src/utils/is-vercel.ts
19
- function isVercel() {
20
- return process.env.VERCEL === "1";
21
- }
22
-
23
- // src/config-v2/microfrontends/server/utils/get-output-file-path.ts
24
- function getOutputFilePath() {
25
- if (isVercel()) {
26
- return path.join(
27
- ".vercel",
28
- MFE_CONFIG_DEFAULT_FILE_PATH,
29
- MFE_CONFIG_DEFAULT_FILE_NAME
30
- );
31
- }
32
- return path.join(MFE_CONFIG_DEFAULT_FILE_PATH, MFE_CONFIG_DEFAULT_FILE_NAME);
33
- }
34
-
35
- // src/config/errors.ts
36
- var MicrofrontendError = class extends Error {
37
- constructor(message, opts) {
38
- super(message);
39
- this.name = "MicrofrontendsError";
40
- this.source = (opts == null ? void 0 : opts.source) ?? "@vercel/microfrontends";
41
- this.type = (opts == null ? void 0 : opts.type) ?? "unknown";
42
- this.subtype = opts == null ? void 0 : opts.subtype;
43
- Error.captureStackTrace(this, MicrofrontendError);
44
- }
45
- isKnown() {
46
- return this.type !== "unknown";
47
- }
48
- isUnknown() {
49
- return !this.isKnown();
50
- }
51
- /**
52
- * Converts an error to a MicrofrontendsError.
53
- * @param original - The original error to convert.
54
- * @returns The converted MicrofrontendsError.
55
- */
56
- static convert(original, opts) {
57
- if (opts == null ? void 0 : opts.fileName) {
58
- const err = MicrofrontendError.convertFSError(original, opts.fileName);
59
- if (err) {
60
- return err;
61
- }
62
- }
63
- if (original.message.includes(
64
- "Code generation from strings disallowed for this context"
65
- )) {
66
- return new MicrofrontendError(original.message, {
67
- type: "config",
68
- subtype: "unsupported_validation_env",
69
- source: "ajv"
70
- });
71
- }
72
- return new MicrofrontendError(original.message);
73
- }
74
- static convertFSError(original, fileName) {
75
- if (original instanceof Error && "code" in original) {
76
- if (original.code === "ENOENT") {
77
- return new MicrofrontendError(`Could not find "${fileName}"`, {
78
- type: "config",
79
- subtype: "unable_to_read_file",
80
- source: "fs"
81
- });
82
- }
83
- if (original.code === "EACCES") {
84
- return new MicrofrontendError(
85
- `Permission denied while accessing "${fileName}"`,
86
- {
87
- type: "config",
88
- subtype: "invalid_permissions",
89
- source: "fs"
90
- }
91
- );
92
- }
93
- }
94
- if (original instanceof SyntaxError) {
95
- return new MicrofrontendError(
96
- `Failed to parse "${fileName}": Invalid JSON format.`,
97
- {
98
- type: "config",
99
- subtype: "invalid_syntax",
100
- source: "fs"
101
- }
102
- );
103
- }
104
- return null;
105
- }
106
- /**
107
- * Handles an unknown error and returns a MicrofrontendsError instance.
108
- * @param err - The error to handle.
109
- * @returns A MicrofrontendsError instance.
110
- */
111
- static handle(err, opts) {
112
- if (err instanceof MicrofrontendError) {
113
- return err;
114
- }
115
- if (err instanceof Error) {
116
- return MicrofrontendError.convert(err, opts);
117
- }
118
- if (typeof err === "object" && err !== null) {
119
- if ("message" in err && typeof err.message === "string") {
120
- return MicrofrontendError.convert(new Error(err.message), opts);
121
- }
122
- }
123
- return new MicrofrontendError("An unknown error occurred");
124
- }
125
- };
126
-
127
- // src/routing/url.ts
128
- function buildUrlSafeString(givenOpts = {}) {
129
- const options = {
130
- joinString: "-",
131
- lowercaseOnly: true,
132
- maxLen: 100,
133
- regexRemovePattern: /(?:(?!(?:[a-z0-9])).)/gi,
134
- trimWhitespace: true,
135
- ...givenOpts
136
- };
137
- return {
138
- generate: (...args) => {
139
- const reJoinString = new RegExp(`${options.joinString}+`, "g");
140
- let tag;
141
- if (args.length === 0) {
142
- throw new Error("generate method must be passed at least one argument");
143
- }
144
- for (let i = 0; i < args.length; i++) {
145
- const arg = args[i];
146
- if (typeof arg !== "string")
147
- throw new Error("all supplied arguments must be Strings");
148
- if (options.trimWhitespace) {
149
- args[i] = arg.trim();
150
- }
151
- }
152
- tag = args.join(options.joinString);
153
- tag = tag.replace(/\s/g, options.joinString);
154
- if (options.lowercaseOnly)
155
- tag = tag.toLowerCase();
156
- tag = tag.replace(options.regexRemovePattern, (match) => {
157
- if (match === options.joinString)
158
- return match;
159
- return "";
160
- });
161
- if (tag.length > options.maxLen)
162
- tag = tag.substring(0, options.maxLen);
163
- tag = tag.replace(reJoinString, options.joinString);
164
- return tag;
165
- }
166
- };
167
- }
168
- var urlSafeString = buildUrlSafeString().generate;
169
- function makeUrlSafe(name) {
170
- return urlSafeString(name.replace(/\//g, "-")).replace(/^-*/g, "").replace(/-*$/g, "");
171
- }
172
-
173
- // src/config/overrides/config.ts
174
- var OVERRIDES_COOKIE_PREFIX = "vercel-micro-frontends-override";
175
- var _Overrides = class {
176
- constructor(config) {
177
- this.config = config;
178
- }
179
- static getAppEnvOverrideCookieName(zone) {
180
- return `${_Overrides.overrideEnvCookiePrefix}${zone}`;
181
- }
182
- static isOverrideCookie(cookie) {
183
- var _a;
184
- return Boolean((_a = cookie.name) == null ? void 0 : _a.startsWith(OVERRIDES_COOKIE_PREFIX));
185
- }
186
- static getOverrideFromCookie(cookie) {
187
- if (!_Overrides.isOverrideCookie(cookie) || !cookie.value)
188
- return;
189
- return {
190
- zone: cookie.name.replace(_Overrides.overrideEnvCookiePrefix, ""),
191
- host: cookie.value
192
- };
193
- }
194
- static parseOverrides(cookies) {
195
- const overridesConfig = { applications: {} };
196
- cookies.forEach((cookie) => {
197
- const override = _Overrides.getOverrideFromCookie(cookie);
198
- if (!override)
199
- return;
200
- overridesConfig.applications[override.zone] = {
201
- environment: { host: override.host }
202
- };
203
- });
204
- return overridesConfig;
205
- }
206
- static validOverrideDomainsForZone(microfrontendConfig, zone) {
207
- var _a, _b, _c, _d, _e;
208
- const projectName = (_a = microfrontendConfig.getZone(zone).vercel) == null ? void 0 : _a.projectName;
209
- if (!projectName) {
210
- return [microfrontendConfig.getZone(zone).production.host];
211
- }
212
- const parsedProjectName = makeUrlSafe(projectName);
213
- const previewDeploymentSuffix = (_c = (_b = microfrontendConfig.options) == null ? void 0 : _b.vercel) == null ? void 0 : _c.previewDeploymentSuffix;
214
- const teamSlug = (_e = (_d = microfrontendConfig.options) == null ? void 0 : _d.vercel) == null ? void 0 : _e.teamSlug;
215
- if (!teamSlug && !previewDeploymentSuffix) {
216
- return [microfrontendConfig.getZone(zone).production.host];
217
- }
218
- const suffix = previewDeploymentSuffix ? `.${previewDeploymentSuffix}` : `-${teamSlug}.vercel.app`;
219
- return [
220
- `${parsedProjectName}-git-([a-zA-Z0-9-]+)${suffix}`,
221
- microfrontendConfig.getZone(zone).production.host
222
- ];
223
- }
224
- static validateOverrideDomain(microfrontendConfig, zone, domain) {
225
- return new RegExp(
226
- `^${_Overrides.validOverrideDomainsForZone(microfrontendConfig, zone).join(
227
- "|"
228
- )}$`
229
- ).test(domain);
230
- }
231
- serialize() {
232
- return this.config;
233
- }
234
- };
235
- var Overrides = _Overrides;
236
- Overrides.overrideEnvCookiePrefix = `${OVERRIDES_COOKIE_PREFIX}:env:`;
237
-
238
- // src/config/common/host.ts
239
- var Host = class {
240
- constructor({ protocol, host, port }) {
241
- this.protocol = protocol || "https";
242
- this.host = host;
243
- this.port = Host.getPort({ port, protocol: this.protocol });
244
- this.serialized = {
245
- protocol,
246
- host,
247
- ...port ? { port } : void 0
248
- };
249
- }
250
- isLocal() {
251
- return this.host === "localhost" || this.host === "127.0.0.1";
252
- }
253
- static getPort({
254
- protocol,
255
- port
256
- }) {
257
- if (!port) {
258
- if (protocol === "http") {
259
- return 80;
260
- }
261
- return 443;
262
- }
263
- return port;
264
- }
265
- isDefaultPort() {
266
- return this.port === Host.getPort({ protocol: this.protocol });
267
- }
268
- toString(opts = {}) {
269
- const url = this.toUrl(opts);
270
- return url.toString().replace(/\/$/, "");
271
- }
272
- toUrl(opts = {}) {
273
- const { includeDefaultPort } = opts;
274
- const url = `${this.protocol}://${this.host}${this.isDefaultPort() && !includeDefaultPort ? "" : `:${this.port}`}`;
275
- return new URL(url);
276
- }
277
- serialize() {
278
- return this.serialized;
279
- }
280
- };
281
-
282
- // src/config/common/application.ts
283
- var Application = class {
284
- constructor(name, {
285
- app,
286
- overrides
287
- }) {
288
- Application.validate(name, app);
289
- this.name = name;
290
- this.default = app.default;
291
- this.routing = app.routing;
292
- this.development = {
293
- local: new Host(app.development.local),
294
- fallback: app.development.fallback ? new Host(app.development.fallback) : void 0
295
- };
296
- this.production = new Host(app.production);
297
- this.vercel = app.vercel;
298
- this.overrides = (overrides == null ? void 0 : overrides.environment) ? {
299
- environment: new Host(overrides.environment)
300
- } : void 0;
301
- }
302
- isDefault() {
303
- return this.default;
304
- }
305
- static validate(name, app) {
306
- var _a, _b, _c, _d, _e;
307
- 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("/"))) {
308
- throw new MicrofrontendError(
309
- `Invalid assetPrefix for application "${name}". Must not start or end with a slash.`,
310
- { type: "zone", subtype: "invalid_asset_prefix" }
311
- );
312
- }
313
- for (const group of ((_e = app.routing) == null ? void 0 : _e.matches) ?? []) {
314
- for (const p of group.paths) {
315
- if (p === "/") {
316
- continue;
317
- }
318
- if (p.endsWith("/")) {
319
- throw new MicrofrontendError(
320
- `Invalid path for application "${name}". ${p} must not end with a slash.`,
321
- { type: "zone", subtype: "invalid_path" }
322
- );
323
- }
324
- if (!p.startsWith("/")) {
325
- throw new MicrofrontendError(
326
- `Invalid path for application "${name}". ${p} must start with a slash.`,
327
- { type: "zone", subtype: "invalid_path" }
328
- );
329
- }
330
- }
331
- }
332
- }
333
- serialize() {
334
- var _a, _b;
335
- if (this.routing === void 0 || this.default) {
336
- return {
337
- default: true,
338
- development: {
339
- local: this.development.local.serialize(),
340
- fallback: (_a = this.development.fallback) == null ? void 0 : _a.serialize()
341
- },
342
- production: this.production.serialize(),
343
- vercel: this.vercel
344
- };
345
- }
346
- return {
347
- default: false,
348
- routing: this.routing,
349
- development: {
350
- local: this.development.local.serialize(),
351
- fallback: (_b = this.development.fallback) == null ? void 0 : _b.serialize()
352
- },
353
- production: this.production.serialize(),
354
- vercel: this.vercel
355
- };
356
- }
357
- };
358
-
359
- // src/config/common/microfrontend-config.ts
360
- var SUPPORTED_VERSIONS = ["1"];
361
- var DEFAULT_LOCAL_PROXY_PORT = 3024;
362
- var MicrofrontendConfigCommon = class {
363
- constructor({
364
- config,
365
- overrides
366
- }) {
367
- this.zones = {};
368
- var _a, _b, _c;
369
- if (!SUPPORTED_VERSIONS.includes(config.version)) {
370
- throw new MicrofrontendError(
371
- `Unsupported version: ${config.version}. Supported versions are: ${SUPPORTED_VERSIONS.join(
372
- ", "
373
- )}`,
374
- { type: "config", subtype: "unsupported_version" }
375
- );
376
- }
377
- const disableOverrides = ((_b = (_a = config.options) == null ? void 0 : _a.vercel) == null ? void 0 : _b.disableOverrides) ?? false;
378
- this.overrides = overrides && !disableOverrides ? new Overrides(overrides) : void 0;
379
- for (const [zoneName, zoneConfig] of Object.entries(config.applications)) {
380
- this.zones[zoneName] = new Application(zoneName, {
381
- app: zoneConfig,
382
- overrides: !disableOverrides ? (_c = this.overrides) == null ? void 0 : _c.config.applications[zoneName] : void 0
383
- });
384
- }
385
- this.config = config;
386
- this.name = config.name;
387
- this.version = config.version;
388
- this.options = config.options;
389
- this.$schema = config.$schema;
390
- }
391
- isOverridesDisabled() {
392
- var _a, _b;
393
- return ((_b = (_a = this.options) == null ? void 0 : _a.vercel) == null ? void 0 : _b.disableOverrides) ?? false;
394
- }
395
- static getConfigFromEnv() {
396
- const config = process.env.MFE_CONFIG;
397
- if (!config) {
398
- throw new MicrofrontendError(`Missing "MFE_CONFIG" in environment.`, {
399
- type: "config",
400
- subtype: "not_found_in_env"
401
- });
402
- }
403
- return config;
404
- }
405
- static fromEnv(_) {
406
- throw new Error("Not implemented");
407
- }
408
- getConfig() {
409
- return this.config;
410
- }
411
- getAllApplications() {
412
- return Object.values(this.zones);
413
- }
414
- getZone(name) {
415
- const zone = this.zones[name];
416
- if (!zone) {
417
- throw new MicrofrontendError(
418
- `Could not find microfrontends configuration for application "${name}"`,
419
- {
420
- type: "zone",
421
- subtype: "not_found"
422
- }
423
- );
424
- }
425
- return zone;
426
- }
427
- getApplicationByProjectId(projectId) {
428
- return Object.values(this.zones).find(
429
- (zone) => {
430
- var _a;
431
- return ((_a = zone.vercel) == null ? void 0 : _a.projectId) === projectId;
432
- }
433
- );
434
- }
435
- getDefaultZone() {
436
- const zone = Object.values(this.zones).find((z) => z.default);
437
- if (!zone) {
438
- throw new MicrofrontendError(
439
- `Could not find default zone in microfrontends configuration`,
440
- {
441
- type: "zone",
442
- subtype: "not_found"
443
- }
444
- );
445
- }
446
- return zone;
447
- }
448
- /**
449
- * Returns the configured port for the local proxy
450
- */
451
- getLocalProxyPort() {
452
- var _a, _b;
453
- return ((_b = (_a = this.config.options) == null ? void 0 : _a.localProxy) == null ? void 0 : _b.port) ?? DEFAULT_LOCAL_PROXY_PORT;
454
- }
455
- /**
456
- * Serializes the class back to the Schema type.
457
- *
458
- * NOTE: This is used when writing the config to disk and must always match the input Schema
459
- */
460
- toSchemaJson() {
461
- const applications = {};
462
- for (const [name, zone] of Object.entries(this.zones)) {
463
- applications[name] = zone.serialize();
464
- }
465
- return {
466
- $schema: this.$schema,
467
- name: this.name,
468
- version: this.version,
469
- options: this.options,
470
- applications
471
- };
472
- }
473
- serialize() {
474
- var _a;
475
- const applications = {};
476
- for (const [name, zone] of Object.entries(this.zones)) {
477
- applications[name] = zone.serialize();
478
- }
479
- return {
480
- config: {
481
- name: this.name,
482
- version: this.version,
483
- applications,
484
- options: this.options,
485
- $schema: this.$schema
486
- },
487
- overrides: (_a = this.overrides) == null ? void 0 : _a.serialize()
488
- };
489
- }
490
- write(_) {
491
- throw new MicrofrontendError(
492
- `Writing to file to disk requires using an instance of "MicrofrontendConfig".`,
493
- { type: "config", subtype: "unsupported_operation" }
494
- );
495
- }
496
- };
497
-
498
- // src/config/utils/get-output-file-path.ts
499
- import path2 from "node:path";
500
-
501
- // src/config/constants.ts
502
- var MFE_CONFIG_DEFAULT_FILE_PATH2 = "micro-frontends";
503
- var MFE_CONFIG_DEFAULT_FILE_NAME2 = "micro-frontends.config.json";
504
-
505
- // src/config/utils/get-output-file-path.ts
506
- function getOutputFilePath2() {
507
- if (isVercel()) {
508
- return path2.join(
509
- ".vercel",
510
- MFE_CONFIG_DEFAULT_FILE_PATH2,
511
- MFE_CONFIG_DEFAULT_FILE_NAME2
512
- );
513
- }
514
- return path2.join(MFE_CONFIG_DEFAULT_FILE_PATH2, MFE_CONFIG_DEFAULT_FILE_NAME2);
515
- }
516
-
517
- // src/config/validation.ts
518
- import { parse } from "jsonc-parser";
519
- import { pathToRegexp, parse as parsePathRegexp } from "path-to-regexp";
520
- import { Ajv } from "ajv";
521
-
522
- // schema/schema.json
523
- var schema_default = {
524
- $schema: "http://json-schema.org/draft-07/schema#",
525
- $ref: "#/definitions/Config",
526
- definitions: {
527
- Config: {
528
- type: "object",
529
- properties: {
530
- version: {
531
- type: "string"
532
- },
533
- $schema: {
534
- type: "string"
535
- },
536
- name: {
537
- type: "string",
538
- description: 'Name for the micro-frontend site (eg. "vercel.com", "vercel-site" etc.).'
539
- },
540
- applications: {
541
- $ref: "#/definitions/ApplicationConfigsById"
542
- },
543
- options: {
544
- $ref: "#/definitions/Options",
545
- description: "Optional configuration for the entire micro-frontends setup."
546
- }
547
- },
548
- required: ["version", "applications"],
549
- description: "Configuration for micro-frontend applications\n\nTODO: Add proxy configuration"
550
- },
551
- ApplicationConfigsById: {
552
- type: "object",
553
- additionalProperties: {
554
- $ref: "#/definitions/ApplicationConfig"
555
- }
556
- },
557
- ApplicationConfig: {
558
- anyOf: [
559
- {
560
- $ref: "#/definitions/DefaultApplicationConfig"
561
- },
562
- {
563
- $ref: "#/definitions/CommonApplicationConfig"
564
- }
565
- ],
566
- description: "A Micro-Frontend Deployment Target"
567
- },
568
- DefaultApplicationConfig: {
569
- type: "object",
570
- properties: {
571
- default: {
572
- type: "boolean",
573
- const: true,
574
- description: "The default application is used no other application is matched via the routing config"
575
- },
576
- routing: {
577
- $ref: "#/definitions/Routing"
578
- },
579
- development: {
580
- type: "object",
581
- properties: {
582
- local: {
583
- $ref: "#/definitions/HostConfig"
584
- },
585
- fallback: {
586
- $ref: "#/definitions/HostConfig",
587
- 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."
588
- },
589
- task: {
590
- type: "string",
591
- description: "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
592
- }
593
- },
594
- required: ["local"]
595
- },
596
- production: {
597
- $ref: "#/definitions/HostConfig"
598
- },
599
- metadata: {
600
- type: "object",
601
- additionalProperties: {
602
- type: "string"
603
- }
604
- },
605
- federation: {
606
- type: "object",
607
- properties: {
608
- exposes: {
609
- type: "array",
610
- items: {
611
- type: "object",
612
- properties: {
613
- name: {
614
- type: "string",
615
- description: "The name of the module - should be used when importing the module from another application"
616
- },
617
- path: {
618
- type: "string",
619
- description: "Relative path to the module within its `application`"
620
- }
621
- },
622
- required: ["name", "path"]
623
- },
624
- description: "Modules that are exposed by this application"
625
- },
626
- uses: {
627
- type: "array",
628
- items: {
629
- type: "string"
630
- },
631
- description: "Modules that are used by this application. Only the name of the module is required."
632
- }
633
- }
634
- },
635
- vercel: {
636
- $ref: "#/definitions/Vercel"
637
- }
638
- },
639
- required: ["default", "development", "production"]
640
- },
641
- Routing: {
642
- type: "object",
643
- properties: {
644
- assetPrefix: {
645
- type: "string",
646
- description: "[assetPrefix] for the application"
647
- },
648
- matches: {
649
- type: "array",
650
- items: {
651
- $ref: "#/definitions/PathGroup"
652
- },
653
- description: "Path expressions that are routed to this application."
654
- }
655
- },
656
- required: ["matches"]
657
- },
658
- PathGroup: {
659
- type: "object",
660
- properties: {
661
- group: {
662
- type: "string",
663
- description: "Optional group name for the paths"
664
- },
665
- options: {
666
- type: "object",
667
- properties: {
668
- flag: {
669
- type: "string",
670
- description: "flag name that can be used to enable/disable all paths in the group"
671
- }
672
- }
673
- },
674
- paths: {
675
- type: "array",
676
- items: {
677
- type: "string"
678
- }
679
- }
680
- },
681
- required: ["paths"]
682
- },
683
- HostConfig: {
684
- type: "object",
685
- properties: {
686
- protocol: {
687
- type: "string",
688
- enum: ["http", "https"],
689
- 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"'
690
- },
691
- host: {
692
- type: "string",
693
- 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`)."
694
- },
695
- port: {
696
- type: "number",
697
- 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"
698
- }
699
- },
700
- required: ["host"]
701
- },
702
- Vercel: {
703
- type: "object",
704
- properties: {
705
- projectId: {
706
- type: "string",
707
- description: "Vercel project ID"
708
- },
709
- projectName: {
710
- type: "string",
711
- description: "Vercel project name (temporary until we can use project ID)"
712
- },
713
- defaultRoute: {
714
- type: "string",
715
- description: "The default route for the application. Used to render screenshots, favicons, and provide direct zone links"
716
- },
717
- routeSpeedInsightsToDefaultZone: {
718
- type: "boolean",
719
- description: "Whether to route Speed Insights to the default zone or each individual microfrontend."
720
- }
721
- },
722
- required: ["projectId"]
723
- },
724
- CommonApplicationConfig: {
725
- type: "object",
726
- properties: {
727
- default: {
728
- type: "boolean",
729
- const: false,
730
- description: "The default application is used no other application is matched via the routing config"
731
- },
732
- routing: {
733
- $ref: "#/definitions/Routing"
734
- },
735
- development: {
736
- type: "object",
737
- properties: {
738
- local: {
739
- $ref: "#/definitions/HostConfig"
740
- },
741
- fallback: {
742
- $ref: "#/definitions/HostConfig",
743
- 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."
744
- },
745
- task: {
746
- type: "string",
747
- description: "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
748
- }
749
- },
750
- required: ["local"]
751
- },
752
- production: {
753
- $ref: "#/definitions/HostConfig"
754
- },
755
- metadata: {
756
- type: "object",
757
- additionalProperties: {
758
- type: "string"
759
- }
760
- },
761
- federation: {
762
- type: "object",
763
- properties: {
764
- exposes: {
765
- type: "array",
766
- items: {
767
- type: "object",
768
- properties: {
769
- name: {
770
- type: "string",
771
- description: "The name of the module - should be used when importing the module from another application"
772
- },
773
- path: {
774
- type: "string",
775
- description: "Relative path to the module within its `application`"
776
- }
777
- },
778
- required: ["name", "path"]
779
- },
780
- description: "Modules that are exposed by this application"
781
- },
782
- uses: {
783
- type: "array",
784
- items: {
785
- type: "string"
786
- },
787
- description: "Modules that are used by this application. Only the name of the module is required."
788
- }
789
- }
790
- },
791
- vercel: {
792
- $ref: "#/definitions/Vercel"
793
- }
794
- },
795
- required: ["default", "development", "production", "routing"]
796
- },
797
- Options: {
798
- type: "object",
799
- properties: {
800
- vercel: {
801
- $ref: "#/definitions/VercelOptions",
802
- description: "Micro-Frontends wide options for Vercel."
803
- },
804
- localProxy: {
805
- $ref: "#/definitions/LocalProxyOptions",
806
- description: "Options for local proxy."
807
- }
808
- }
809
- },
810
- VercelOptions: {
811
- type: "object",
812
- properties: {
813
- previewDeploymentSuffix: {
814
- type: "string",
815
- 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`."
816
- },
817
- teamSlug: {
818
- type: "string",
819
- description: "Team slug for the Vercel team"
820
- },
821
- disableOverrides: {
822
- type: "boolean",
823
- 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."
824
- }
825
- }
826
- },
827
- LocalProxyOptions: {
828
- type: "object",
829
- properties: {
830
- port: {
831
- type: "number",
832
- description: "The port number used by the local proxy server.\n\nThe default is `3024`."
833
- }
834
- }
835
- }
836
- }
837
- };
838
-
839
- // src/config/utils/load-schema.ts
840
- var SCHEMA = schema_default;
841
-
842
- // src/config/validation.ts
843
- var validateSchema = (configString) => {
844
- const parsedConfig = parse(configString);
845
- const ajv = new Ajv();
846
- const validate = ajv.compile(SCHEMA);
847
- const isValid = validate(parsedConfig);
848
- if (!isValid) {
849
- throw new MicrofrontendError(
850
- `Invalid config: ${ajv.errorsText(validate.errors)}`,
851
- { type: "config", subtype: "does_not_match_schema" }
852
- );
853
- }
854
- return parsedConfig;
855
- };
856
- var SUPPORTED_VERSIONS2 = ["1"];
857
- var validateVersion = (version) => {
858
- if (!SUPPORTED_VERSIONS2.includes(version)) {
859
- throw new MicrofrontendError(
860
- `Unsupported version: ${version}. Supported versions are: ${SUPPORTED_VERSIONS2.join(
861
- ", "
862
- )}`,
863
- { type: "config", subtype: "unsupported_version" }
864
- );
865
- }
866
- };
867
- function validateMainPath(applicationConfigsById) {
868
- for (const [id, app] of Object.entries(applicationConfigsById)) {
869
- const { defaultRoute } = app.vercel ?? {};
870
- if (!defaultRoute) {
871
- continue;
872
- }
873
- if (isDefaultApplicationConfig(app)) {
874
- const pathsWithApp = [];
875
- for (const [otherId, otherApp] of Object.entries(
876
- applicationConfigsById
877
- )) {
878
- if (isDefaultApplicationConfig(otherApp)) {
879
- continue;
880
- }
881
- pathsWithApp.push({
882
- id: otherId,
883
- paths: otherApp.routing.matches.flatMap((match) => match.paths)
884
- });
885
- }
886
- for (const { id: otherId, paths } of pathsWithApp) {
887
- const isValid = paths.every((path7) => {
888
- const matcher = pathToRegexp(path7);
889
- return !matcher.test(defaultRoute);
890
- });
891
- if (!isValid) {
892
- throw new MicrofrontendError(
893
- `default route "${defaultRoute}" cannot be used for "${id}" because it is matched by "${otherId}"`,
894
- { type: "config", subtype: "invalid_main_path" }
895
- );
896
- }
897
- }
898
- } else {
899
- const allPaths = app.routing.matches.flatMap((match) => match.paths);
900
- const isValid = allPaths.some((path7) => {
901
- const matcher = pathToRegexp(path7);
902
- return matcher.test(defaultRoute);
903
- });
904
- if (!isValid) {
905
- throw new MicrofrontendError(
906
- `default route "${defaultRoute}" is not included by the routing config for application "${id}"`,
907
- { type: "config", subtype: "invalid_main_path" }
908
- );
909
- }
910
- }
911
- }
912
- }
913
- var validatePaths = (applicationConfigsById) => {
914
- const pathsByApplicationId = /* @__PURE__ */ new Map();
915
- const errors = [];
916
- for (const [id, app] of Object.entries(applicationConfigsById)) {
917
- if (isDefaultApplicationConfig(app)) {
918
- continue;
919
- }
920
- for (const pathMatch of app.routing.matches) {
921
- for (const path7 of pathMatch.paths) {
922
- const maybeError = validatePathExpression(path7);
923
- if (maybeError) {
924
- errors.push(maybeError);
925
- }
926
- const existing = pathsByApplicationId.get(path7);
927
- if (existing) {
928
- existing.applications.push(id);
929
- } else {
930
- pathsByApplicationId.set(path7, {
931
- applications: [id],
932
- matcher: pathToRegexp(path7),
933
- applicationId: id
934
- });
935
- }
936
- }
937
- }
938
- }
939
- const entries = Array.from(pathsByApplicationId.entries());
940
- entries.forEach(([path7, { applications: ids, matcher, applicationId }]) => {
941
- if (ids.length > 1) {
942
- errors.push(
943
- `Duplicate path "${path7}" for applications "${ids.join(", ")}"`
944
- );
945
- }
946
- entries.forEach(
947
- ([
948
- matchPath,
949
- { applications: matchIds, applicationId: matchApplicationId }
950
- ]) => {
951
- if (path7 === matchPath) {
952
- return;
953
- }
954
- if (applicationId === matchApplicationId) {
955
- return;
956
- }
957
- if (matcher.test(matchPath)) {
958
- const source = `"${path7}" of application${ids.length > 0 ? "s" : ""} ${ids.join(", ")}`;
959
- const destination = `"${matchPath}" of application${matchIds.length > 0 ? "s" : ""} ${matchIds.join(", ")}`;
960
- errors.push(
961
- `Overlapping path detected between ${source} and ${destination}`
962
- );
963
- }
964
- }
965
- );
966
- });
967
- if (errors.length) {
968
- throw new MicrofrontendError(`Invalid paths: ${errors.join(", ")}`, {
969
- type: "config",
970
- subtype: "conflicting_paths"
971
- });
972
- }
973
- };
974
- var PATH_DEFAULT_PATTERN = "[^\\/#\\?]+?";
975
- function validatePathExpression(path7) {
976
- const tokens = parsePathRegexp(path7);
977
- for (let i = 0; i < tokens.length; i++) {
978
- const token = tokens[i];
979
- if (token === void 0) {
980
- return `token ${i} in ${path7} is undefined, this shouldn't happen`;
981
- }
982
- if (typeof token !== "string") {
983
- if (token.pattern !== PATH_DEFAULT_PATTERN) {
984
- return `Path ${path7} cannot use a regular expression wildcard`;
985
- }
986
- if (token.prefix !== "/") {
987
- return `Wildcard :${token.name} must be immediately after a / in ${path7}`;
988
- }
989
- if (token.suffix) {
990
- return `Wildcard suffix on :${token.name} is not allowed. Suffixes are not supported`;
991
- }
992
- if (token.modifier && i !== tokens.length - 1) {
993
- return `Modifier ${token.modifier} is not allowed on wildcard :${token.name} in ${path7}. Modifiers are only allowed in the last path component`;
994
- }
995
- }
996
- }
997
- return void 0;
998
- }
999
- var validateDefaults = (applicationConfigsById) => {
1000
- const defaultApplicationIds = Object.entries(applicationConfigsById).reduce((acc, [id, app]) => app.default ? [...acc, id] : acc, []);
1001
- if (defaultApplicationIds.length === 0) {
1002
- throw new MicrofrontendError(
1003
- `No default application found. At least one application must be marked as default.`,
1004
- { type: "config", subtype: "no_default_application" }
1005
- );
1006
- }
1007
- if (defaultApplicationIds.length > 1) {
1008
- throw new MicrofrontendError(
1009
- `Only one default application is allowed. Found ${defaultApplicationIds.join(", ")}.`,
1010
- { type: "config", subtype: "multiple_default_applications" }
1011
- );
1012
- }
1013
- };
1014
- var validateOptions = (options) => {
1015
- var _a;
1016
- if ((_a = options == null ? void 0 : options.vercel) == null ? void 0 : _a.previewDeploymentSuffix) {
1017
- if (!/^[a-zA-Z]{2,}\.[a-zA-Z]{2,}$/.test(
1018
- options.vercel.previewDeploymentSuffix
1019
- )) {
1020
- throw new MicrofrontendError(
1021
- `Invalid preview deployment suffix: ${options.vercel.previewDeploymentSuffix}. Should have be formatted like "vercel.app".`,
1022
- { type: "config", subtype: "invalid_preview_deployment_suffix" }
1023
- );
1024
- }
1025
- }
1026
- };
1027
-
1028
- // src/config/utils/convert.ts
1029
- function convertV1RoutingToV2Routing(routing) {
1030
- return routing.matches.map((group) => {
1031
- var _a;
1032
- return {
1033
- group: group.group,
1034
- flag: (_a = group.options) == null ? void 0 : _a.flag,
1035
- paths: group.paths
1036
- };
1037
- });
1038
- }
1039
- function convertV1ApplicationToV2Application(application) {
1040
- const common = {
1041
- production: application.production,
1042
- development: application.development,
1043
- vercel: application.vercel
1044
- };
1045
- if (application.default) {
1046
- return common;
1047
- }
1048
- return {
1049
- ...common,
1050
- routing: convertV1RoutingToV2Routing(application.routing)
1051
- };
1052
- }
1053
- function convertV1ConfigToV2Config(config, fromApp) {
1054
- if (!config.applications[fromApp]) {
1055
- throw new Error(`Application "${fromApp}" not found in the config`);
1056
- }
1057
- const common = {
1058
- version: "2",
1059
- options: config.options
1060
- };
1061
- if (config.applications[fromApp].default) {
1062
- return {
1063
- ...common,
1064
- applications: Object.fromEntries(
1065
- Object.entries(config.applications).map(([id, application]) => [
1066
- id,
1067
- convertV1ApplicationToV2Application(application)
1068
- ])
1069
- )
1070
- };
1071
- }
1072
- const defaultApplication = Object.entries(config.applications).find(
1073
- ([, application]) => application.default
1074
- );
1075
- if (!defaultApplication) {
1076
- throw new Error("No default application found in the config");
1077
- }
1078
- return {
1079
- ...common,
1080
- partOf: defaultApplication[0]
1081
- };
1082
- }
1083
-
1084
- // src/config/utils/write-file.ts
1085
- import fs from "node:fs";
1086
- import { dirname } from "node:path";
1087
- function writeFile(outputPath, config, prettify) {
1088
- fs.mkdirSync(dirname(outputPath), { recursive: true });
1089
- fs.writeFileSync(
1090
- outputPath,
1091
- JSON.stringify(config, null, prettify ? 2 : void 0)
1092
- );
1093
- }
1094
-
1095
- // src/config/microfrontend-config.ts
1096
- var MicrofrontendConfig = class extends MicrofrontendConfigCommon {
1097
- static validate(configString) {
1098
- const config = validateSchema(configString);
1099
- validateVersion(config.version);
1100
- validatePaths(config.applications);
1101
- validateMainPath(config.applications);
1102
- validateDefaults(config.applications);
1103
- validateOptions(config.options);
1104
- return config;
1105
- }
1106
- static fromEnv({
1107
- cookies
1108
- }) {
1109
- return new MicrofrontendConfigCommon({
1110
- config: MicrofrontendConfig.validate(
1111
- MicrofrontendConfigCommon.getConfigFromEnv()
1112
- ),
1113
- overrides: Overrides.parseOverrides(cookies)
1114
- });
1115
- }
1116
- static fromFile({
1117
- filePath
1118
- }) {
1119
- try {
1120
- const config = fs2.readFileSync(filePath, "utf-8");
1121
- return new MicrofrontendConfig({
1122
- config: MicrofrontendConfig.validate(config)
1123
- });
1124
- } catch (e) {
1125
- throw MicrofrontendError.handle(e, {
1126
- fileName: filePath
1127
- });
1128
- }
1129
- }
1130
- /**
1131
- * Writes the configuration to a file.
1132
- */
1133
- write(fromApp, opts = {}) {
1134
- const { pretty = true, versions = ["v1", "v2"] } = opts;
1135
- const config = this.toSchemaJson();
1136
- if (versions.includes("v1")) {
1137
- const outputPath = getOutputFilePath2();
1138
- writeFile(outputPath, config, pretty);
1139
- }
1140
- if (versions.includes("v2")) {
1141
- const outputPath = getOutputFilePath();
1142
- const v2Config = convertV1ConfigToV2Config(config, fromApp);
1143
- writeFile(outputPath, v2Config, pretty);
1144
- }
1145
- }
1146
- };
1147
-
1148
- // src/config-v2/microfrontends/server/index.ts
2
+ import path5 from "node:path";
1149
3
  import fs6 from "node:fs";
1150
- import { dirname as dirname4, join } from "node:path";
1151
4
 
1152
- // src/config-v2/overrides/constants.ts
1153
- var OVERRIDES_COOKIE_PREFIX2 = "vercel-micro-frontends-override";
1154
- var OVERRIDES_ENV_COOKIE_PREFIX = `${OVERRIDES_COOKIE_PREFIX2}:env:`;
5
+ // src/config/microfrontends/server/index.ts
6
+ import fs5 from "node:fs";
7
+ import { dirname as dirname3, join as join2 } from "node:path";
8
+
9
+ // src/config/overrides/constants.ts
10
+ var OVERRIDES_COOKIE_PREFIX = "vercel-micro-frontends-override";
11
+ var OVERRIDES_ENV_COOKIE_PREFIX = `${OVERRIDES_COOKIE_PREFIX}:env:`;
1155
12
 
1156
- // src/config-v2/overrides/is-override-cookie.ts
13
+ // src/config/overrides/is-override-cookie.ts
1157
14
  function isOverrideCookie(cookie) {
1158
15
  var _a;
1159
- return Boolean((_a = cookie.name) == null ? void 0 : _a.startsWith(OVERRIDES_COOKIE_PREFIX2));
16
+ return Boolean((_a = cookie.name) == null ? void 0 : _a.startsWith(OVERRIDES_COOKIE_PREFIX));
1160
17
  }
1161
18
 
1162
- // src/config-v2/overrides/get-override-from-cookie.ts
19
+ // src/config/overrides/get-override-from-cookie.ts
1163
20
  function getOverrideFromCookie(cookie) {
1164
21
  if (!isOverrideCookie(cookie) || !cookie.value)
1165
22
  return;
@@ -1169,7 +26,7 @@ function getOverrideFromCookie(cookie) {
1169
26
  };
1170
27
  }
1171
28
 
1172
- // src/config-v2/overrides/parse-overrides.ts
29
+ // src/config/overrides/parse-overrides.ts
1173
30
  function parseOverrides(cookies) {
1174
31
  const overridesConfig = { applications: {} };
1175
32
  cookies.forEach((cookie) => {
@@ -1183,15 +40,15 @@ function parseOverrides(cookies) {
1183
40
  return overridesConfig;
1184
41
  }
1185
42
 
1186
- // src/config-v2/errors.ts
1187
- var MicrofrontendError2 = class extends Error {
43
+ // src/config/errors.ts
44
+ var MicrofrontendError = class extends Error {
1188
45
  constructor(message, opts) {
1189
46
  super(message);
1190
47
  this.name = "MicrofrontendsError";
1191
48
  this.source = (opts == null ? void 0 : opts.source) ?? "@vercel/microfrontends";
1192
49
  this.type = (opts == null ? void 0 : opts.type) ?? "unknown";
1193
50
  this.subtype = opts == null ? void 0 : opts.subtype;
1194
- Error.captureStackTrace(this, MicrofrontendError2);
51
+ Error.captureStackTrace(this, MicrofrontendError);
1195
52
  }
1196
53
  isKnown() {
1197
54
  return this.type !== "unknown";
@@ -1206,7 +63,7 @@ var MicrofrontendError2 = class extends Error {
1206
63
  */
1207
64
  static convert(original, opts) {
1208
65
  if (opts == null ? void 0 : opts.fileName) {
1209
- const err = MicrofrontendError2.convertFSError(original, opts.fileName);
66
+ const err = MicrofrontendError.convertFSError(original, opts.fileName);
1210
67
  if (err) {
1211
68
  return err;
1212
69
  }
@@ -1214,25 +71,25 @@ var MicrofrontendError2 = class extends Error {
1214
71
  if (original.message.includes(
1215
72
  "Code generation from strings disallowed for this context"
1216
73
  )) {
1217
- return new MicrofrontendError2(original.message, {
74
+ return new MicrofrontendError(original.message, {
1218
75
  type: "config",
1219
76
  subtype: "unsupported_validation_env",
1220
77
  source: "ajv"
1221
78
  });
1222
79
  }
1223
- return new MicrofrontendError2(original.message);
80
+ return new MicrofrontendError(original.message);
1224
81
  }
1225
82
  static convertFSError(original, fileName) {
1226
83
  if (original instanceof Error && "code" in original) {
1227
84
  if (original.code === "ENOENT") {
1228
- return new MicrofrontendError2(`Could not find "${fileName}"`, {
85
+ return new MicrofrontendError(`Could not find "${fileName}"`, {
1229
86
  type: "config",
1230
87
  subtype: "unable_to_read_file",
1231
88
  source: "fs"
1232
89
  });
1233
90
  }
1234
91
  if (original.code === "EACCES") {
1235
- return new MicrofrontendError2(
92
+ return new MicrofrontendError(
1236
93
  `Permission denied while accessing "${fileName}"`,
1237
94
  {
1238
95
  type: "config",
@@ -1243,7 +100,7 @@ var MicrofrontendError2 = class extends Error {
1243
100
  }
1244
101
  }
1245
102
  if (original instanceof SyntaxError) {
1246
- return new MicrofrontendError2(
103
+ return new MicrofrontendError(
1247
104
  `Failed to parse "${fileName}": Invalid JSON format.`,
1248
105
  {
1249
106
  type: "config",
@@ -1260,26 +117,26 @@ var MicrofrontendError2 = class extends Error {
1260
117
  * @returns A MicrofrontendsError instance.
1261
118
  */
1262
119
  static handle(err, opts) {
1263
- if (err instanceof MicrofrontendError2) {
120
+ if (err instanceof MicrofrontendError) {
1264
121
  return err;
1265
122
  }
1266
123
  if (err instanceof Error) {
1267
- return MicrofrontendError2.convert(err, opts);
124
+ return MicrofrontendError.convert(err, opts);
1268
125
  }
1269
126
  if (typeof err === "object" && err !== null) {
1270
127
  if ("message" in err && typeof err.message === "string") {
1271
- return MicrofrontendError2.convert(new Error(err.message), opts);
128
+ return MicrofrontendError.convert(new Error(err.message), opts);
1272
129
  }
1273
130
  }
1274
- return new MicrofrontendError2("An unknown error occurred");
131
+ return new MicrofrontendError("An unknown error occurred");
1275
132
  }
1276
133
  };
1277
134
 
1278
- // src/config-v2/microfrontends-config/utils/get-config-from-env.ts
135
+ // src/config/microfrontends-config/utils/get-config-from-env.ts
1279
136
  function getConfigStringFromEnv() {
1280
137
  const config = process.env.MFE_CONFIG;
1281
138
  if (!config) {
1282
- throw new MicrofrontendError2(`Missing "MFE_CONFIG" in environment.`, {
139
+ throw new MicrofrontendError(`Missing "MFE_CONFIG" in environment.`, {
1283
140
  type: "config",
1284
141
  subtype: "not_found_in_env"
1285
142
  });
@@ -1287,21 +144,21 @@ function getConfigStringFromEnv() {
1287
144
  return config;
1288
145
  }
1289
146
 
1290
- // src/config-v2/microfrontends-config/isomorphic/index.ts
1291
- import { parse as parse2 } from "jsonc-parser";
147
+ // src/config/microfrontends-config/isomorphic/index.ts
148
+ import { parse } from "jsonc-parser";
1292
149
 
1293
- // src/config-v2/schema/utils/is-main-config.ts
150
+ // src/config/schema/utils/is-main-config.ts
1294
151
  function isMainConfig(c) {
1295
152
  return !("partOf" in c);
1296
153
  }
1297
154
 
1298
- // src/config-v2/schema/utils/is-default-app.ts
155
+ // src/config/schema/utils/is-default-app.ts
1299
156
  function isDefaultApp(a) {
1300
157
  return !("routing" in a);
1301
158
  }
1302
159
 
1303
- // src/config-v2/microfrontends-config/client/index.ts
1304
- import { pathToRegexp as pathToRegexp2 } from "path-to-regexp";
160
+ // src/config/microfrontends-config/client/index.ts
161
+ import { pathToRegexp } from "path-to-regexp";
1305
162
  var MicrofrontendConfigClient = class {
1306
163
  constructor(config, opts) {
1307
164
  this.pathCache = {};
@@ -1331,21 +188,21 @@ var MicrofrontendConfigClient = class {
1331
188
  isEqual(other) {
1332
189
  return JSON.stringify(this.applications) === JSON.stringify(other.applications);
1333
190
  }
1334
- getApplicationNameForPath(path7) {
1335
- if (!path7.startsWith("/")) {
191
+ getApplicationNameForPath(path6) {
192
+ if (!path6.startsWith("/")) {
1336
193
  throw new Error(`Path must start with a /`);
1337
194
  }
1338
- if (this.pathCache[path7]) {
1339
- return this.pathCache[path7];
195
+ if (this.pathCache[path6]) {
196
+ return this.pathCache[path6];
1340
197
  }
1341
- const pathname = new URL(path7, "https://example.com").pathname;
198
+ const pathname = new URL(path6, "https://example.com").pathname;
1342
199
  for (const [name, application] of Object.entries(this.applications)) {
1343
200
  if (application.routing) {
1344
201
  for (const group of application.routing) {
1345
202
  for (const childPath of group.paths) {
1346
- const regexp = pathToRegexp2(childPath);
203
+ const regexp = pathToRegexp(childPath);
1347
204
  if (regexp.test(pathname)) {
1348
- this.pathCache[path7] = name;
205
+ this.pathCache[path6] = name;
1349
206
  return name;
1350
207
  }
1351
208
  }
@@ -1358,7 +215,7 @@ var MicrofrontendConfigClient = class {
1358
215
  if (!defaultApplication) {
1359
216
  return null;
1360
217
  }
1361
- this.pathCache[path7] = defaultApplication[0];
218
+ this.pathCache[path6] = defaultApplication[0];
1362
219
  return defaultApplication[0];
1363
220
  }
1364
221
  serialize() {
@@ -1366,13 +223,13 @@ var MicrofrontendConfigClient = class {
1366
223
  }
1367
224
  };
1368
225
 
1369
- // src/config-v2/microfrontends-config/isomorphic/validation.ts
1370
- import { pathToRegexp as pathToRegexp3, parse as parsePathRegexp2 } from "path-to-regexp";
1371
- var SUPPORTED_VERSIONS3 = ["2"];
226
+ // src/config/microfrontends-config/isomorphic/validation.ts
227
+ import { pathToRegexp as pathToRegexp2, parse as parsePathRegexp } from "path-to-regexp";
228
+ var SUPPORTED_VERSIONS = ["2"];
1372
229
  var validateConfigVersion = (version) => {
1373
- if (!SUPPORTED_VERSIONS3.includes(version)) {
1374
- throw new MicrofrontendError2(
1375
- `Unsupported version: ${version}. Supported versions are: ${SUPPORTED_VERSIONS3.join(
230
+ if (!SUPPORTED_VERSIONS.includes(version)) {
231
+ throw new MicrofrontendError(
232
+ `Unsupported version: ${version}. Supported versions are: ${SUPPORTED_VERSIONS.join(
1376
233
  ", "
1377
234
  )}`,
1378
235
  { type: "config", subtype: "unsupported_version" }
@@ -1390,22 +247,22 @@ var validateConfigPaths = (applicationConfigsById) => {
1390
247
  continue;
1391
248
  }
1392
249
  for (const pathMatch of app.routing) {
1393
- for (const path7 of pathMatch.paths) {
1394
- const tokens = parsePathRegexp2(path7);
250
+ for (const path6 of pathMatch.paths) {
251
+ const tokens = parsePathRegexp(path6);
1395
252
  for (const token of tokens.slice(0, -1)) {
1396
253
  if (typeof token !== "string") {
1397
254
  errors.push(
1398
- `Path ${path7} may only have a :wildcard in the last path component`
255
+ `Path ${path6} may only have a :wildcard in the last path component`
1399
256
  );
1400
257
  }
1401
258
  }
1402
- const existing = pathsByApplicationId.get(path7);
259
+ const existing = pathsByApplicationId.get(path6);
1403
260
  if (existing) {
1404
261
  existing.applications.push(id);
1405
262
  } else {
1406
- pathsByApplicationId.set(path7, {
263
+ pathsByApplicationId.set(path6, {
1407
264
  applications: [id],
1408
- matcher: pathToRegexp3(path7),
265
+ matcher: pathToRegexp2(path6),
1409
266
  applicationId: id
1410
267
  });
1411
268
  }
@@ -1413,10 +270,10 @@ var validateConfigPaths = (applicationConfigsById) => {
1413
270
  }
1414
271
  }
1415
272
  const entries = Array.from(pathsByApplicationId.entries());
1416
- entries.forEach(([path7, { applications: ids, matcher, applicationId }]) => {
273
+ entries.forEach(([path6, { applications: ids, matcher, applicationId }]) => {
1417
274
  if (ids.length > 1) {
1418
275
  errors.push(
1419
- `Duplicate path "${path7}" for applications "${ids.join(", ")}"`
276
+ `Duplicate path "${path6}" for applications "${ids.join(", ")}"`
1420
277
  );
1421
278
  }
1422
279
  entries.forEach(
@@ -1424,14 +281,14 @@ var validateConfigPaths = (applicationConfigsById) => {
1424
281
  matchPath,
1425
282
  { applications: matchIds, applicationId: matchApplicationId }
1426
283
  ]) => {
1427
- if (path7 === matchPath) {
284
+ if (path6 === matchPath) {
1428
285
  return;
1429
286
  }
1430
287
  if (applicationId === matchApplicationId) {
1431
288
  return;
1432
289
  }
1433
290
  if (matcher.test(matchPath)) {
1434
- const source = `"${path7}" of application${ids.length > 0 ? "s" : ""} ${ids.join(", ")}`;
291
+ const source = `"${path6}" of application${ids.length > 0 ? "s" : ""} ${ids.join(", ")}`;
1435
292
  const destination = `"${matchPath}" of application${matchIds.length > 0 ? "s" : ""} ${matchIds.join(", ")}`;
1436
293
  errors.push(
1437
294
  `Overlapping path detected between ${source} and ${destination}`
@@ -1441,7 +298,7 @@ var validateConfigPaths = (applicationConfigsById) => {
1441
298
  );
1442
299
  });
1443
300
  if (errors.length) {
1444
- throw new MicrofrontendError2(`Invalid paths: ${errors.join(", ")}`, {
301
+ throw new MicrofrontendError(`Invalid paths: ${errors.join(", ")}`, {
1445
302
  type: "config",
1446
303
  subtype: "conflicting_paths"
1447
304
  });
@@ -1454,13 +311,13 @@ var validateAppPaths = (name, app) => {
1454
311
  continue;
1455
312
  }
1456
313
  if (p.endsWith("/")) {
1457
- throw new MicrofrontendError2(
314
+ throw new MicrofrontendError(
1458
315
  `Invalid path for application "${name}". ${p} must not end with a slash.`,
1459
316
  { type: "application", subtype: "invalid_path" }
1460
317
  );
1461
318
  }
1462
319
  if (!p.startsWith("/")) {
1463
- throw new MicrofrontendError2(
320
+ throw new MicrofrontendError(
1464
321
  `Invalid path for application "${name}". ${p} must start with a slash.`,
1465
322
  { type: "application", subtype: "invalid_path" }
1466
323
  );
@@ -1482,33 +339,20 @@ var validateConfigDefaultApplication = (applicationConfigsById) => {
1482
339
  const numApplicationsWithRouting = applicationsWithRoutingNames.length;
1483
340
  const numApplicationsWithoutRouting = numApplications - numApplicationsWithRouting;
1484
341
  if (numApplicationsWithoutRouting === 0) {
1485
- throw new MicrofrontendError2(
342
+ throw new MicrofrontendError(
1486
343
  `No default application found. At least one application needs to be the default by omitting routing.`,
1487
344
  { type: "config", subtype: "no_default_application" }
1488
345
  );
1489
346
  }
1490
347
  if (numApplicationsWithoutRouting > 1) {
1491
- throw new MicrofrontendError2(
348
+ throw new MicrofrontendError(
1492
349
  `Only one application can omit "routing". Found ${applicationsWithRoutingNames.length - Object.keys(applicationConfigsById).length > 1}.`,
1493
350
  { type: "config", subtype: "multiple_default_applications" }
1494
351
  );
1495
352
  }
1496
353
  };
1497
- var validateConfigOptions = (options) => {
1498
- var _a;
1499
- if ((_a = options == null ? void 0 : options.vercel) == null ? void 0 : _a.previewDeploymentSuffix) {
1500
- if (!/^[a-zA-Z]{2,}\.[a-zA-Z]{2,}$/.test(
1501
- options.vercel.previewDeploymentSuffix
1502
- )) {
1503
- throw new MicrofrontendError2(
1504
- `Invalid preview deployment suffix: ${options.vercel.previewDeploymentSuffix}. Should have be formatted like "vercel.app".`,
1505
- { type: "config", subtype: "invalid_preview_deployment_suffix" }
1506
- );
1507
- }
1508
- }
1509
- };
1510
354
 
1511
- // src/config-v2/microfrontends-config/isomorphic/utils/generate-asset-prefix.ts
355
+ // src/config/microfrontends-config/isomorphic/utils/generate-asset-prefix.ts
1512
356
  var PREFIX = "vc-ap";
1513
357
  function generateAssetPrefixFromName({
1514
358
  name
@@ -1519,7 +363,7 @@ function generateAssetPrefixFromName({
1519
363
  return `${PREFIX}-${name}`;
1520
364
  }
1521
365
 
1522
- // src/config-v2/microfrontends-config/isomorphic/utils/generate-port.ts
366
+ // src/config/microfrontends-config/isomorphic/utils/generate-port.ts
1523
367
  function generatePortFromName({
1524
368
  name,
1525
369
  minPort = 3e3,
@@ -1539,13 +383,13 @@ function generatePortFromName({
1539
383
  return port;
1540
384
  }
1541
385
 
1542
- // src/config-v2/microfrontends-config/isomorphic/host.ts
1543
- var Host2 = class {
386
+ // src/config/microfrontends-config/isomorphic/host.ts
387
+ var Host = class {
1544
388
  constructor(hostConfig, options) {
1545
389
  const { protocol = "https", host, port } = hostConfig;
1546
390
  this.protocol = protocol;
1547
391
  this.host = host;
1548
- this.port = Host2.getPort({ port, protocol: this.protocol });
392
+ this.port = Host.getPort({ port, protocol: this.protocol });
1549
393
  this.local = options == null ? void 0 : options.isLocal;
1550
394
  }
1551
395
  isLocal() {
@@ -1564,7 +408,7 @@ var Host2 = class {
1564
408
  return port;
1565
409
  }
1566
410
  isDefaultPort() {
1567
- return this.port === Host2.getPort({ protocol: this.protocol });
411
+ return this.port === Host.getPort({ protocol: this.protocol });
1568
412
  }
1569
413
  toString(opts = {}) {
1570
414
  const url = this.toUrl(opts);
@@ -1576,7 +420,7 @@ var Host2 = class {
1576
420
  return new URL(url);
1577
421
  }
1578
422
  };
1579
- var LocalHost = class extends Host2 {
423
+ var LocalHost = class extends Host {
1580
424
  constructor({
1581
425
  appName,
1582
426
  ...hostConfig
@@ -1588,8 +432,8 @@ var LocalHost = class extends Host2 {
1588
432
  }
1589
433
  };
1590
434
 
1591
- // src/config-v2/microfrontends-config/isomorphic/application.ts
1592
- var Application2 = class {
435
+ // src/config/microfrontends-config/isomorphic/application.ts
436
+ var Application = class {
1593
437
  constructor(name, {
1594
438
  app,
1595
439
  overrides,
@@ -1602,12 +446,12 @@ var Application2 = class {
1602
446
  appName: name,
1603
447
  ...(_a = app.development) == null ? void 0 : _a.local
1604
448
  }),
1605
- fallback: ((_b = app.development) == null ? void 0 : _b.fallback) ? new Host2(app.development.fallback) : void 0
449
+ fallback: ((_b = app.development) == null ? void 0 : _b.fallback) ? new Host(app.development.fallback) : void 0
1606
450
  };
1607
- this.production = app.production ? new Host2(app.production) : void 0;
451
+ this.production = app.production ? new Host(app.production) : void 0;
1608
452
  this.vercel = app.vercel;
1609
453
  this.overrides = (overrides == null ? void 0 : overrides.environment) ? {
1610
- environment: new Host2(overrides.environment)
454
+ environment: new Host(overrides.environment)
1611
455
  } : void 0;
1612
456
  this.default = isDefault ?? false;
1613
457
  this.serialized = app;
@@ -1622,7 +466,7 @@ var Application2 = class {
1622
466
  return this.serialized;
1623
467
  }
1624
468
  };
1625
- var DefaultApplication = class extends Application2 {
469
+ var DefaultApplication = class extends Application {
1626
470
  constructor(name, {
1627
471
  app,
1628
472
  overrides
@@ -1633,13 +477,13 @@ var DefaultApplication = class extends Application2 {
1633
477
  isDefault: true
1634
478
  });
1635
479
  this.default = true;
1636
- this.production = new Host2(app.production);
480
+ this.production = new Host(app.production);
1637
481
  }
1638
482
  getAssetPrefix() {
1639
483
  return "";
1640
484
  }
1641
485
  };
1642
- var ChildApplication = class extends Application2 {
486
+ var ChildApplication = class extends Application {
1643
487
  constructor(name, {
1644
488
  app,
1645
489
  overrides
@@ -1658,10 +502,10 @@ var ChildApplication = class extends Application2 {
1658
502
  }
1659
503
  };
1660
504
 
1661
- // src/config-v2/microfrontends-config/isomorphic/constants.ts
1662
- var DEFAULT_LOCAL_PROXY_PORT2 = 3024;
505
+ // src/config/microfrontends-config/isomorphic/constants.ts
506
+ var DEFAULT_LOCAL_PROXY_PORT = 3024;
1663
507
 
1664
- // src/config-v2/microfrontends-config/isomorphic/index.ts
508
+ // src/config/microfrontends-config/isomorphic/index.ts
1665
509
  var MicrofrontendConfigIsomorphic = class {
1666
510
  constructor({
1667
511
  config,
@@ -1702,7 +546,7 @@ var MicrofrontendConfigIsomorphic = class {
1702
546
  );
1703
547
  }
1704
548
  if (isMainConfig(config) && !this.defaultApplication) {
1705
- throw new MicrofrontendError2(
549
+ throw new MicrofrontendError(
1706
550
  `Could not find default application in microfrontends configuration`,
1707
551
  {
1708
552
  type: "application",
@@ -1719,13 +563,12 @@ var MicrofrontendConfigIsomorphic = class {
1719
563
  };
1720
564
  }
1721
565
  static validate(config) {
1722
- const c = typeof config === "string" ? parse2(config) : config;
566
+ const c = typeof config === "string" ? parse(config) : config;
1723
567
  if (isMainConfig(c)) {
1724
568
  validateConfigVersion(c.version);
1725
569
  validateConfigPaths(c.applications);
1726
570
  validateConfigDefaultApplication(c.applications);
1727
571
  }
1728
- validateConfigOptions(c.options);
1729
572
  return c;
1730
573
  }
1731
574
  static fromEnv({
@@ -1733,7 +576,7 @@ var MicrofrontendConfigIsomorphic = class {
1733
576
  cookies
1734
577
  }) {
1735
578
  return new MicrofrontendConfigIsomorphic({
1736
- config: parse2(getConfigStringFromEnv()),
579
+ config: parse(getConfigStringFromEnv()),
1737
580
  overrides: parseOverrides(cookies ?? []),
1738
581
  meta
1739
582
  });
@@ -1767,7 +610,7 @@ var MicrofrontendConfigIsomorphic = class {
1767
610
  }
1768
611
  const app = this.childApplications[name];
1769
612
  if (!app) {
1770
- throw new MicrofrontendError2(
613
+ throw new MicrofrontendError(
1771
614
  `Could not find microfrontends configuration for application "${name}"`,
1772
615
  {
1773
616
  type: "application",
@@ -1795,7 +638,7 @@ var MicrofrontendConfigIsomorphic = class {
1795
638
  */
1796
639
  getDefaultApplication() {
1797
640
  if (!this.defaultApplication) {
1798
- throw new MicrofrontendError2(
641
+ throw new MicrofrontendError(
1799
642
  `Could not find default application in microfrontends configuration`,
1800
643
  {
1801
644
  type: "application",
@@ -1810,7 +653,7 @@ var MicrofrontendConfigIsomorphic = class {
1810
653
  */
1811
654
  getLocalProxyPort() {
1812
655
  var _a, _b;
1813
- return ((_b = (_a = this.config.options) == null ? void 0 : _a.localProxy) == null ? void 0 : _b.port) ?? DEFAULT_LOCAL_PROXY_PORT2;
656
+ return ((_b = (_a = this.config.options) == null ? void 0 : _a.localProxy) == null ? void 0 : _b.port) ?? DEFAULT_LOCAL_PROXY_PORT;
1814
657
  }
1815
658
  /**
1816
659
  * Serializes the class back to the Schema type.
@@ -1844,7 +687,7 @@ var MicrofrontendConfigIsomorphic = class {
1844
687
  }
1845
688
  };
1846
689
 
1847
- // src/config-v2/microfrontends-config/isomorphic/child.ts
690
+ // src/config/microfrontends-config/isomorphic/child.ts
1848
691
  var MicrofrontendChildConfig = class extends MicrofrontendConfigIsomorphic {
1849
692
  constructor({
1850
693
  config,
@@ -1857,7 +700,7 @@ var MicrofrontendChildConfig = class extends MicrofrontendConfigIsomorphic {
1857
700
  }
1858
701
  };
1859
702
 
1860
- // src/config-v2/microfrontends-config/isomorphic/main.ts
703
+ // src/config/microfrontends-config/isomorphic/main.ts
1861
704
  var MicrofrontendMainConfig = class extends MicrofrontendConfigIsomorphic {
1862
705
  constructor({
1863
706
  config,
@@ -1884,7 +727,7 @@ var MicrofrontendMainConfig = class extends MicrofrontendConfigIsomorphic {
1884
727
  }
1885
728
  }
1886
729
  if (!defaultApplication) {
1887
- throw new MicrofrontendError2(
730
+ throw new MicrofrontendError(
1888
731
  `Could not find default application in microfrontends configuration`,
1889
732
  {
1890
733
  type: "application",
@@ -1896,7 +739,7 @@ var MicrofrontendMainConfig = class extends MicrofrontendConfigIsomorphic {
1896
739
  }
1897
740
  };
1898
741
 
1899
- // src/config-v2/microfrontends/isomorphic/index.ts
742
+ // src/config/microfrontends/isomorphic/index.ts
1900
743
  var Microfrontends = class {
1901
744
  constructor({
1902
745
  config,
@@ -1924,26 +767,26 @@ var Microfrontends = class {
1924
767
  }
1925
768
  };
1926
769
 
1927
- // src/config-v2/microfrontends/utils/find-repository-root.ts
1928
- import fs3 from "node:fs";
1929
- import path3 from "node:path";
770
+ // src/config/microfrontends/utils/find-repository-root.ts
771
+ import fs from "node:fs";
772
+ import path from "node:path";
1930
773
  var GIT_DIRECTORY = ".git";
1931
774
  function findRepositoryRoot(startDir) {
1932
775
  let currentDir = startDir || process.cwd();
1933
- while (currentDir !== path3.parse(currentDir).root) {
1934
- const gitPath = path3.join(currentDir, GIT_DIRECTORY);
1935
- if (fs3.existsSync(gitPath) && fs3.statSync(gitPath).isDirectory()) {
776
+ while (currentDir !== path.parse(currentDir).root) {
777
+ const gitPath = path.join(currentDir, GIT_DIRECTORY);
778
+ if (fs.existsSync(gitPath) && fs.statSync(gitPath).isDirectory()) {
1936
779
  return currentDir;
1937
780
  }
1938
- currentDir = path3.dirname(currentDir);
781
+ currentDir = path.dirname(currentDir);
1939
782
  }
1940
783
  throw new Error(
1941
784
  "Repository root not found. Specify the root of the repository with the `repository.root` option."
1942
785
  );
1943
786
  }
1944
787
 
1945
- // src/config-v2/microfrontends/utils/find-package-path.ts
1946
- import { dirname as dirname2 } from "node:path";
788
+ // src/config/microfrontends/utils/find-package-path.ts
789
+ import { dirname } from "node:path";
1947
790
  import { readFileSync } from "node:fs";
1948
791
  import fg from "fast-glob";
1949
792
  var configCache = {};
@@ -1978,7 +821,7 @@ function findPackagePathWithGlob({
1978
821
  );
1979
822
  }
1980
823
  const [packageJsonPath] = matchingPaths;
1981
- return dirname2(packageJsonPath);
824
+ return dirname(packageJsonPath);
1982
825
  } catch (error) {
1983
826
  return null;
1984
827
  }
@@ -1998,32 +841,42 @@ function findPackagePath(opts) {
1998
841
  return result;
1999
842
  }
2000
843
 
2001
- // src/config-v2/microfrontends/utils/find-default-package.ts
2002
- import { dirname as dirname3 } from "node:path";
844
+ // src/config/microfrontends/utils/find-default-package.ts
845
+ import { dirname as dirname2 } from "node:path";
2003
846
  import { readFileSync as readFileSync2 } from "node:fs";
847
+ import { parse as parse2 } from "jsonc-parser";
2004
848
  import fg2 from "fast-glob";
849
+
850
+ // src/config/constants.ts
851
+ var CONFIGURATION_FILENAMES = [
852
+ "microfrontends.jsonc",
853
+ "microfrontends.json"
854
+ ];
855
+
856
+ // src/config/microfrontends/utils/find-default-package.ts
2005
857
  var configCache2 = {};
2006
858
  function findDefaultMicrofrontendsPackages({
2007
859
  repositoryRoot,
2008
860
  applicationName
2009
861
  }) {
2010
862
  try {
2011
- const microfrontendsJsonPaths = fg2.globSync("**/microfrontends.json", {
2012
- cwd: repositoryRoot,
2013
- absolute: true,
2014
- onlyFiles: true,
2015
- followSymbolicLinks: false,
2016
- ignore: ["**/node_modules/**", "**/.git/**"]
2017
- });
863
+ const microfrontendsJsonPaths = fg2.globSync(
864
+ `**/{${CONFIGURATION_FILENAMES.join(",")}}`,
865
+ {
866
+ cwd: repositoryRoot,
867
+ absolute: true,
868
+ onlyFiles: true,
869
+ followSymbolicLinks: false,
870
+ ignore: ["**/node_modules/**", "**/.git/**"]
871
+ }
872
+ );
2018
873
  const matchingPaths = [];
2019
874
  for (const microfrontendsJsonPath of microfrontendsJsonPaths) {
2020
875
  const microfrontendsJsonContent = readFileSync2(
2021
876
  microfrontendsJsonPath,
2022
877
  "utf-8"
2023
878
  );
2024
- const microfrontendsJson = JSON.parse(
2025
- microfrontendsJsonContent
2026
- );
879
+ const microfrontendsJson = parse2(microfrontendsJsonContent);
2027
880
  if (isMainConfig(microfrontendsJson) && microfrontendsJson.applications[applicationName]) {
2028
881
  matchingPaths.push(microfrontendsJsonPath);
2029
882
  }
@@ -2040,7 +893,7 @@ ${matchingPaths.join("\n \u2022 ")}`
2040
893
  );
2041
894
  }
2042
895
  const [packageJsonPath] = matchingPaths;
2043
- return dirname3(packageJsonPath);
896
+ return dirname2(packageJsonPath);
2044
897
  } catch (error) {
2045
898
  return null;
2046
899
  }
@@ -2053,32 +906,32 @@ function findDefaultMicrofrontendsPackage(opts) {
2053
906
  const result = findDefaultMicrofrontendsPackages(opts);
2054
907
  if (!result) {
2055
908
  throw new Error(
2056
- `Error trying to resolve the main microfrontends.json configuration`
909
+ `Error trying to resolve the main microfrontends configuration`
2057
910
  );
2058
911
  }
2059
912
  configCache2[cacheKey] = result;
2060
913
  return result;
2061
914
  }
2062
915
 
2063
- // src/config-v2/microfrontends/utils/is-monorepo.ts
2064
- import fs4 from "node:fs";
2065
- import path4 from "node:path";
916
+ // src/config/microfrontends/utils/is-monorepo.ts
917
+ import fs2 from "node:fs";
918
+ import path2 from "node:path";
2066
919
  function isMonorepo({
2067
920
  repositoryRoot
2068
921
  }) {
2069
922
  try {
2070
- if (fs4.existsSync(path4.join(repositoryRoot, "pnpm-workspace.yaml"))) {
923
+ if (fs2.existsSync(path2.join(repositoryRoot, "pnpm-workspace.yaml"))) {
2071
924
  return true;
2072
925
  }
2073
- if (fs4.existsSync(path4.join(repositoryRoot, "vlt-workspaces.json"))) {
926
+ if (fs2.existsSync(path2.join(repositoryRoot, "vlt-workspaces.json"))) {
2074
927
  return true;
2075
928
  }
2076
- const packageJsonPath = path4.join(repositoryRoot, "package.json");
2077
- if (!fs4.existsSync(packageJsonPath)) {
929
+ const packageJsonPath = path2.join(repositoryRoot, "package.json");
930
+ if (!fs2.existsSync(packageJsonPath)) {
2078
931
  return false;
2079
932
  }
2080
933
  const packageJson = JSON.parse(
2081
- fs4.readFileSync(packageJsonPath, "utf-8")
934
+ fs2.readFileSync(packageJsonPath, "utf-8")
2082
935
  );
2083
936
  return packageJson.workspaces !== void 0;
2084
937
  } catch (error) {
@@ -2087,30 +940,67 @@ function isMonorepo({
2087
940
  }
2088
941
  }
2089
942
 
2090
- // src/config-v2/microfrontends/utils/find-package-root.ts
2091
- import fs5 from "node:fs";
2092
- import path5 from "node:path";
943
+ // src/config/microfrontends/utils/find-package-root.ts
944
+ import fs3 from "node:fs";
945
+ import path3 from "node:path";
2093
946
  var PACKAGE_JSON = "package.json";
2094
947
  function findPackageRoot(startDir) {
2095
948
  let currentDir = startDir || process.cwd();
2096
- while (currentDir !== path5.parse(currentDir).root) {
2097
- const pkgJsonPath = path5.join(currentDir, PACKAGE_JSON);
2098
- if (fs5.existsSync(pkgJsonPath)) {
949
+ while (currentDir !== path3.parse(currentDir).root) {
950
+ const pkgJsonPath = path3.join(currentDir, PACKAGE_JSON);
951
+ if (fs3.existsSync(pkgJsonPath)) {
2099
952
  return currentDir;
2100
953
  }
2101
- currentDir = path5.dirname(currentDir);
954
+ currentDir = path3.dirname(currentDir);
2102
955
  }
2103
956
  throw new Error(
2104
957
  "Package root not found. Specify the root of the package with the `package.root` option."
2105
958
  );
2106
959
  }
2107
960
 
2108
- // src/config-v2/microfrontends/server/validation.ts
961
+ // src/config/microfrontends/utils/find-config.ts
962
+ import fs4 from "node:fs";
963
+ import { join } from "node:path";
964
+ function findConfig({ dir }) {
965
+ for (const filename of CONFIGURATION_FILENAMES) {
966
+ const maybeConfig = join(dir, filename);
967
+ if (fs4.existsSync(maybeConfig)) {
968
+ return maybeConfig;
969
+ }
970
+ }
971
+ return null;
972
+ }
973
+
974
+ // src/config/microfrontends/server/utils/get-output-file-path.ts
975
+ import path4 from "node:path";
976
+
977
+ // src/config/microfrontends/server/constants.ts
978
+ var MFE_CONFIG_DEFAULT_FILE_PATH = "microfrontends";
979
+ var MFE_CONFIG_DEFAULT_FILE_NAME = "microfrontends.json";
980
+
981
+ // src/utils/is-vercel.ts
982
+ function isVercel() {
983
+ return process.env.VERCEL === "1";
984
+ }
985
+
986
+ // src/config/microfrontends/server/utils/get-output-file-path.ts
987
+ function getOutputFilePath() {
988
+ if (isVercel()) {
989
+ return path4.join(
990
+ ".vercel",
991
+ MFE_CONFIG_DEFAULT_FILE_PATH,
992
+ MFE_CONFIG_DEFAULT_FILE_NAME
993
+ );
994
+ }
995
+ return path4.join(MFE_CONFIG_DEFAULT_FILE_PATH, MFE_CONFIG_DEFAULT_FILE_NAME);
996
+ }
997
+
998
+ // src/config/microfrontends/server/validation.ts
2109
999
  import { parse as parse3 } from "jsonc-parser";
2110
- import { Ajv as Ajv2 } from "ajv";
1000
+ import { Ajv } from "ajv";
2111
1001
 
2112
- // schema/schema-v2.json
2113
- var schema_v2_default = {
1002
+ // schema/schema.json
1003
+ var schema_default = {
2114
1004
  $schema: "http://json-schema.org/draft-07/schema#",
2115
1005
  $ref: "#/definitions/Config",
2116
1006
  definitions: {
@@ -2149,7 +1039,8 @@ var schema_v2_default = {
2149
1039
  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"
2150
1040
  }
2151
1041
  },
2152
- required: ["applications", "version"]
1042
+ required: ["applications", "version"],
1043
+ additionalProperties: false
2153
1044
  },
2154
1045
  Options: {
2155
1046
  type: "object",
@@ -2162,15 +1053,12 @@ var schema_v2_default = {
2162
1053
  $ref: "#/definitions/LocalProxyOptions",
2163
1054
  description: "Options for local proxy."
2164
1055
  }
2165
- }
1056
+ },
1057
+ additionalProperties: false
2166
1058
  },
2167
1059
  VercelOptions: {
2168
1060
  type: "object",
2169
1061
  properties: {
2170
- previewDeploymentSuffix: {
2171
- type: "string",
2172
- 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`."
2173
- },
2174
1062
  teamSlug: {
2175
1063
  type: "string",
2176
1064
  description: "Team slug for the Vercel team"
@@ -2179,7 +1067,8 @@ var schema_v2_default = {
2179
1067
  type: "boolean",
2180
1068
  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."
2181
1069
  }
2182
- }
1070
+ },
1071
+ additionalProperties: false
2183
1072
  },
2184
1073
  LocalProxyOptions: {
2185
1074
  type: "object",
@@ -2188,7 +1077,8 @@ var schema_v2_default = {
2188
1077
  type: "number",
2189
1078
  description: "The port number used by the local proxy server.\n\nThe default is `3024`."
2190
1079
  }
2191
- }
1080
+ },
1081
+ additionalProperties: false
2192
1082
  },
2193
1083
  Application: {
2194
1084
  anyOf: [
@@ -2213,7 +1103,8 @@ var schema_v2_default = {
2213
1103
  $ref: "#/definitions/HostConfig"
2214
1104
  }
2215
1105
  },
2216
- required: ["production"]
1106
+ required: ["production"],
1107
+ additionalProperties: false
2217
1108
  },
2218
1109
  Vercel: {
2219
1110
  type: "object",
@@ -2223,7 +1114,8 @@ var schema_v2_default = {
2223
1114
  description: "Vercel project ID"
2224
1115
  }
2225
1116
  },
2226
- required: ["projectId"]
1117
+ required: ["projectId"],
1118
+ additionalProperties: false
2227
1119
  },
2228
1120
  Development: {
2229
1121
  type: "object",
@@ -2239,10 +1131,12 @@ var schema_v2_default = {
2239
1131
  type: "string",
2240
1132
  description: "Optional task to run when starting the development server. Should reference a script in the package.json of the application."
2241
1133
  }
2242
- }
1134
+ },
1135
+ additionalProperties: false
2243
1136
  },
2244
1137
  LocalHostConfig: {
2245
1138
  type: "object",
1139
+ additionalProperties: false,
2246
1140
  properties: {
2247
1141
  host: {
2248
1142
  type: "string",
@@ -2276,7 +1170,8 @@ var schema_v2_default = {
2276
1170
  description: "The port number to be used for the connection. Common values include `80` for HTTP and `443` for HTTPS."
2277
1171
  }
2278
1172
  },
2279
- required: ["host"]
1173
+ required: ["host"],
1174
+ additionalProperties: false
2280
1175
  },
2281
1176
  ChildApplication: {
2282
1177
  type: "object",
@@ -2295,7 +1190,8 @@ var schema_v2_default = {
2295
1190
  $ref: "#/definitions/HostConfig"
2296
1191
  }
2297
1192
  },
2298
- required: ["routing"]
1193
+ required: ["routing"],
1194
+ additionalProperties: false
2299
1195
  },
2300
1196
  Routing: {
2301
1197
  type: "array",
@@ -2321,7 +1217,8 @@ var schema_v2_default = {
2321
1217
  }
2322
1218
  }
2323
1219
  },
2324
- required: ["paths"]
1220
+ required: ["paths"],
1221
+ additionalProperties: false
2325
1222
  },
2326
1223
  ApplicationRouting: {
2327
1224
  type: "object",
@@ -2354,19 +1251,20 @@ var schema_v2_default = {
2354
1251
  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."
2355
1252
  }
2356
1253
  },
2357
- required: ["partOf", "version"]
1254
+ required: ["partOf", "version"],
1255
+ additionalProperties: false
2358
1256
  }
2359
1257
  }
2360
1258
  };
2361
1259
 
2362
- // src/config-v2/schema/utils/load.ts
2363
- var SCHEMA2 = schema_v2_default;
1260
+ // src/config/schema/utils/load.ts
1261
+ var SCHEMA = schema_default;
2364
1262
 
2365
- // src/config-v2/microfrontends/server/validation.ts
2366
- function validateSchema2(configString) {
1263
+ // src/config/microfrontends/server/validation.ts
1264
+ function validateSchema(configString) {
2367
1265
  const parsedConfig = parse3(configString);
2368
- const ajv = new Ajv2();
2369
- const validate = ajv.compile(SCHEMA2);
1266
+ const ajv = new Ajv();
1267
+ const validate = ajv.compile(SCHEMA);
2370
1268
  const isValid = validate(parsedConfig);
2371
1269
  if (!isValid) {
2372
1270
  throw new MicrofrontendError(
@@ -2377,7 +1275,7 @@ function validateSchema2(configString) {
2377
1275
  return parsedConfig;
2378
1276
  }
2379
1277
 
2380
- // src/config-v2/microfrontends/server/index.ts
1278
+ // src/config/microfrontends/server/index.ts
2381
1279
  var MicrofrontendsServer = class extends Microfrontends {
2382
1280
  /**
2383
1281
  * Writes the configuration to a file.
@@ -2386,8 +1284,8 @@ var MicrofrontendsServer = class extends Microfrontends {
2386
1284
  pretty: true
2387
1285
  }) {
2388
1286
  const outputPath = getOutputFilePath();
2389
- fs6.mkdirSync(dirname4(outputPath), { recursive: true });
2390
- fs6.writeFileSync(
1287
+ fs5.mkdirSync(dirname3(outputPath), { recursive: true });
1288
+ fs5.writeFileSync(
2391
1289
  outputPath,
2392
1290
  JSON.stringify(
2393
1291
  this.config.toSchemaJson(),
@@ -2420,7 +1318,7 @@ var MicrofrontendsServer = class extends Microfrontends {
2420
1318
  meta
2421
1319
  });
2422
1320
  }
2423
- throw new MicrofrontendError2(
1321
+ throw new MicrofrontendError(
2424
1322
  "Invalid config: must be a string or an object",
2425
1323
  { type: "config", subtype: "does_not_match_schema" }
2426
1324
  );
@@ -2444,14 +1342,14 @@ var MicrofrontendsServer = class extends Microfrontends {
2444
1342
  */
2445
1343
  static validate(config) {
2446
1344
  if (typeof config === "string") {
2447
- const c = validateSchema2(config);
1345
+ const c = validateSchema(config);
2448
1346
  return c;
2449
1347
  }
2450
1348
  return config;
2451
1349
  }
2452
1350
  /**
2453
- * Looks up the configuration by inferring the package root and looking for a microfrontends.json file. If a file is not found,
2454
- * it will look for a package in the repository with a microfrontends.json file that contains the current application
1351
+ * Looks up the configuration by inferring the package root and looking for a microfrontends config file. If a file is not found,
1352
+ * it will look for a package in the repository with a microfrontends file that contains the current application
2455
1353
  * and use that configuration.
2456
1354
  *
2457
1355
  * This can return either a Child or Main configuration.
@@ -2473,16 +1371,16 @@ var MicrofrontendsServer = class extends Microfrontends {
2473
1371
  }
2474
1372
  try {
2475
1373
  const packageRoot = findPackageRoot(directory);
2476
- const packageJsonPath = join(packageRoot, "package.json");
1374
+ const packageJsonPath = join2(packageRoot, "package.json");
2477
1375
  const packageJson = JSON.parse(
2478
- fs6.readFileSync(packageJsonPath, "utf-8")
1376
+ fs5.readFileSync(packageJsonPath, "utf-8")
2479
1377
  );
2480
1378
  if (!packageJson.name) {
2481
1379
  throw new Error(`No name found in package.json at ${packageJsonPath}`);
2482
1380
  }
2483
1381
  const configMeta = meta ?? { fromApp: packageJson.name };
2484
- const maybeConfig = join(packageRoot, "microfrontends.json");
2485
- if (fs6.existsSync(maybeConfig)) {
1382
+ const maybeConfig = findConfig({ dir: packageRoot });
1383
+ if (maybeConfig) {
2486
1384
  return MicrofrontendsServer.fromFile({
2487
1385
  filePath: maybeConfig,
2488
1386
  cookies,
@@ -2497,16 +1395,19 @@ var MicrofrontendsServer = class extends Microfrontends {
2497
1395
  repositoryRoot,
2498
1396
  applicationName: packageJson.name
2499
1397
  });
2500
- return MicrofrontendsServer.fromFile({
2501
- filePath: join(defaultPackage, "microfrontends.json"),
2502
- cookies,
2503
- meta: configMeta,
2504
- options
2505
- });
1398
+ const maybeConfigFromDefault = findConfig({ dir: defaultPackage });
1399
+ if (maybeConfigFromDefault) {
1400
+ return MicrofrontendsServer.fromFile({
1401
+ filePath: maybeConfigFromDefault,
1402
+ cookies,
1403
+ meta: configMeta,
1404
+ options
1405
+ });
1406
+ }
2506
1407
  }
2507
1408
  throw new Error("Unable to infer");
2508
1409
  } catch (e) {
2509
- throw new MicrofrontendError2(
1410
+ throw new MicrofrontendError(
2510
1411
  "Unable to infer microfrontends configuration",
2511
1412
  { type: "config", subtype: "inference_failed" }
2512
1413
  );
@@ -2522,7 +1423,7 @@ var MicrofrontendsServer = class extends Microfrontends {
2522
1423
  options
2523
1424
  }) {
2524
1425
  try {
2525
- const configJson = fs6.readFileSync(filePath, "utf-8");
1426
+ const configJson = fs5.readFileSync(filePath, "utf-8");
2526
1427
  const config = MicrofrontendsServer.validate(configJson);
2527
1428
  if (!isMainConfig(config) && (options == null ? void 0 : options.resolveMainConfig)) {
2528
1429
  const repositoryRoot = findRepositoryRoot();
@@ -2533,14 +1434,20 @@ var MicrofrontendsServer = class extends Microfrontends {
2533
1434
  name: config.partOf
2534
1435
  });
2535
1436
  if (!packagePath) {
2536
- throw new MicrofrontendError2(
1437
+ throw new MicrofrontendError(
2537
1438
  `Could not find default application "${config.partOf}" in the repository`,
2538
1439
  { type: "config", subtype: "not_found" }
2539
1440
  );
2540
1441
  }
2541
- const mainConfigPath = join(packagePath, "microfrontends.json");
1442
+ const maybeConfig = findConfig({ dir: packagePath });
1443
+ if (!maybeConfig) {
1444
+ throw new MicrofrontendError(
1445
+ `Could not find microfrontends configuration in ${packagePath}`,
1446
+ { type: "config", subtype: "not_found" }
1447
+ );
1448
+ }
2542
1449
  return MicrofrontendsServer.fromMainConfigFile({
2543
- filePath: mainConfigPath,
1450
+ filePath: maybeConfig,
2544
1451
  overrides: cookies ? parseOverrides(cookies) : void 0
2545
1452
  });
2546
1453
  }
@@ -2551,7 +1458,7 @@ var MicrofrontendsServer = class extends Microfrontends {
2551
1458
  meta
2552
1459
  });
2553
1460
  } catch (e) {
2554
- throw MicrofrontendError2.handle(e, {
1461
+ throw MicrofrontendError.handle(e, {
2555
1462
  fileName: filePath
2556
1463
  });
2557
1464
  }
@@ -2564,10 +1471,10 @@ var MicrofrontendsServer = class extends Microfrontends {
2564
1471
  overrides
2565
1472
  }) {
2566
1473
  try {
2567
- const config = fs6.readFileSync(filePath, "utf-8");
1474
+ const config = fs5.readFileSync(filePath, "utf-8");
2568
1475
  const validatedConfig = MicrofrontendsServer.validate(config);
2569
1476
  if (!isMainConfig(validatedConfig)) {
2570
- throw new MicrofrontendError2(
1477
+ throw new MicrofrontendError(
2571
1478
  `${filePath} is not a main microfrontend config`,
2572
1479
  {
2573
1480
  type: "config",
@@ -2577,7 +1484,7 @@ var MicrofrontendsServer = class extends Microfrontends {
2577
1484
  }
2578
1485
  const [defaultApplication] = Object.entries(validatedConfig.applications).filter(([, app]) => isDefaultApp(app)).map(([name]) => name);
2579
1486
  if (!defaultApplication) {
2580
- throw new MicrofrontendError2(
1487
+ throw new MicrofrontendError(
2581
1488
  `No default application found. At least one application needs to be the default by omitting routing.`,
2582
1489
  { type: "config", subtype: "no_default_application" }
2583
1490
  );
@@ -2588,7 +1495,7 @@ var MicrofrontendsServer = class extends Microfrontends {
2588
1495
  meta: { fromApp: defaultApplication }
2589
1496
  });
2590
1497
  } catch (e) {
2591
- throw MicrofrontendError2.handle(e, {
1498
+ throw MicrofrontendError.handle(e, {
2592
1499
  fileName: filePath
2593
1500
  });
2594
1501
  }
@@ -2598,9 +1505,9 @@ var MicrofrontendsServer = class extends Microfrontends {
2598
1505
  // src/utils/mfe-port.ts
2599
1506
  function mfePort(packageDir) {
2600
1507
  const { name: appName, version } = getPackageJson(packageDir);
2601
- const result = loadV2({ packageDir, appName }) || loadV1({ packageDir, appName });
1508
+ const result = loadConfig({ packageDir, appName });
2602
1509
  if (!result) {
2603
- throw new MicrofrontendError2(
1510
+ throw new MicrofrontendError(
2604
1511
  `Unable to determine configured port for ${appName}`,
2605
1512
  { type: "config", subtype: "not_found" }
2606
1513
  );
@@ -2613,10 +1520,10 @@ function mfePort(packageDir) {
2613
1520
  };
2614
1521
  }
2615
1522
  function getPackageJson(packageDir) {
2616
- const filePath = path6.join(packageDir, "package.json");
2617
- return JSON.parse(fs7.readFileSync(filePath, "utf-8"));
1523
+ const filePath = path5.join(packageDir, "package.json");
1524
+ return JSON.parse(fs6.readFileSync(filePath, "utf-8"));
2618
1525
  }
2619
- function loadV2({
1526
+ function loadConfig({
2620
1527
  packageDir,
2621
1528
  appName
2622
1529
  }) {
@@ -2634,21 +1541,6 @@ function loadV2({
2634
1541
  const port = app.development.local.port;
2635
1542
  return { port };
2636
1543
  }
2637
- function loadV1({
2638
- packageDir,
2639
- appName
2640
- }) {
2641
- const filePath = path6.join(packageDir, "micro-frontends.jsonc");
2642
- let config;
2643
- try {
2644
- config = MicrofrontendConfig.fromFile({ filePath });
2645
- } catch (e) {
2646
- return void 0;
2647
- }
2648
- const zone = config.getZone(appName);
2649
- const port = zone.development.local.port;
2650
- return { port };
2651
- }
2652
1544
  export {
2653
1545
  mfePort
2654
1546
  };