@vercel/microfrontends 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/bin/cli.cjs +1483 -186
- package/dist/config/edge.cjs +47 -47
- package/dist/config/edge.cjs.map +1 -1
- package/dist/config/edge.d.ts +6 -6
- package/dist/config/edge.js +46 -46
- package/dist/config/edge.js.map +1 -1
- package/dist/config.cjs +66 -60
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.ts +3 -3
- package/dist/config.js +65 -59
- package/dist/config.js.map +1 -1
- package/dist/{index-eff254d8.d.ts → index-05742bef.d.ts} +11 -22
- package/dist/{micro-frontend-config-42886104.d.ts → microfrontend-config-2425db74.d.ts} +12 -12
- package/dist/next/config.cjs +83 -77
- package/dist/next/config.cjs.map +1 -1
- package/dist/next/config.d.ts +3 -3
- package/dist/next/config.js +82 -76
- package/dist/next/config.js.map +1 -1
- package/dist/next/middleware.cjs +55 -55
- package/dist/next/middleware.cjs.map +1 -1
- package/dist/next/middleware.d.ts +11 -11
- package/dist/next/middleware.js +53 -53
- package/dist/next/middleware.js.map +1 -1
- package/dist/next/testing.cjs +79 -73
- package/dist/next/testing.cjs.map +1 -1
- package/dist/next/testing.d.ts +9 -9
- package/dist/next/testing.js +79 -73
- package/dist/next/testing.js.map +1 -1
- package/dist/overrides.cjs +9 -9
- package/dist/overrides.cjs.map +1 -1
- package/dist/overrides.d.ts +1 -1
- package/dist/overrides.js +9 -9
- package/dist/overrides.js.map +1 -1
- package/dist/types-13f3e535.d.ts +15 -0
- package/dist/v2/config.cjs +39 -39
- package/dist/v2/config.cjs.map +1 -1
- package/dist/v2/config.d.ts +2 -1
- package/dist/v2/config.js +38 -38
- package/dist/v2/config.js.map +1 -1
- package/dist/v2/microfrontends/server.cjs +102 -65
- package/dist/v2/microfrontends/server.cjs.map +1 -1
- package/dist/v2/microfrontends/server.d.ts +6 -1
- package/dist/v2/microfrontends/server.js +102 -65
- package/dist/v2/microfrontends/server.js.map +1 -1
- package/dist/v2/microfrontends.cjs +44 -44
- package/dist/v2/microfrontends.cjs.map +1 -1
- package/dist/v2/microfrontends.d.ts +5 -4
- package/dist/v2/microfrontends.js +44 -44
- package/dist/v2/microfrontends.js.map +1 -1
- package/dist/v2/next/client.cjs +1 -1
- package/dist/v2/next/client.cjs.map +1 -1
- package/dist/v2/next/client.js +1 -1
- package/dist/v2/next/client.js.map +1 -1
- package/dist/v2/next/config.cjs +120 -83
- package/dist/v2/next/config.cjs.map +1 -1
- package/dist/v2/next/config.d.ts +4 -4
- package/dist/v2/next/config.js +119 -82
- package/dist/v2/next/config.js.map +1 -1
- package/dist/v2/next/endpoints.cjs +5 -5
- package/dist/v2/next/endpoints.cjs.map +1 -1
- package/dist/v2/next/endpoints.js +5 -5
- package/dist/v2/next/endpoints.js.map +1 -1
- package/dist/v2/next/middleware.cjs +54 -54
- package/dist/v2/next/middleware.cjs.map +1 -1
- package/dist/v2/next/middleware.d.ts +8 -8
- package/dist/v2/next/middleware.js +52 -52
- package/dist/v2/next/middleware.js.map +1 -1
- package/dist/v2/overrides.cjs +75 -0
- package/dist/v2/overrides.cjs.map +1 -0
- package/dist/v2/overrides.d.ts +24 -0
- package/dist/v2/overrides.js +45 -0
- package/dist/v2/overrides.js.map +1 -0
- package/dist/validation.cjs +20 -20
- package/dist/validation.cjs.map +1 -1
- package/dist/validation.js +20 -20
- package/dist/validation.js.map +1 -1
- package/package.json +10 -3
package/dist/config.cjs
CHANGED
|
@@ -30,7 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/config/index.ts
|
|
31
31
|
var config_exports = {};
|
|
32
32
|
__export(config_exports, {
|
|
33
|
-
|
|
33
|
+
MicrofrontendConfig: () => MicrofrontendConfig,
|
|
34
34
|
getClientConfigFromEnv: () => getClientConfigFromEnv,
|
|
35
35
|
getConfigForClient: () => getConfigForClient,
|
|
36
36
|
getWellKnownClientData: () => getWellKnownClientData,
|
|
@@ -102,7 +102,7 @@ async function getWellKnownClientData(flagValues = {}) {
|
|
|
102
102
|
var isCommonApplicationConfig = (app) => !app.default && typeof app.routing === "object";
|
|
103
103
|
var isDefaultApplicationConfig = (app) => app.default && typeof app.routing === "undefined";
|
|
104
104
|
|
|
105
|
-
// src/config/
|
|
105
|
+
// src/config/microfrontend-config.ts
|
|
106
106
|
var import_node_fs2 = __toESM(require("fs"), 1);
|
|
107
107
|
|
|
108
108
|
// src/config-v2/microfrontends/server/utils/get-output-file-path.ts
|
|
@@ -130,14 +130,14 @@ function getOutputFilePath() {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
// src/config/errors.ts
|
|
133
|
-
var
|
|
133
|
+
var MicrofrontendError = class extends Error {
|
|
134
134
|
constructor(message, opts) {
|
|
135
135
|
super(message);
|
|
136
|
-
this.name = "
|
|
137
|
-
this.source = (opts == null ? void 0 : opts.source) ?? "@vercel/
|
|
136
|
+
this.name = "MicrofrontendsError";
|
|
137
|
+
this.source = (opts == null ? void 0 : opts.source) ?? "@vercel/microfrontends";
|
|
138
138
|
this.type = (opts == null ? void 0 : opts.type) ?? "unknown";
|
|
139
139
|
this.subtype = opts == null ? void 0 : opts.subtype;
|
|
140
|
-
Error.captureStackTrace(this,
|
|
140
|
+
Error.captureStackTrace(this, MicrofrontendError);
|
|
141
141
|
}
|
|
142
142
|
isKnown() {
|
|
143
143
|
return this.type !== "unknown";
|
|
@@ -146,13 +146,13 @@ var MicroFrontendError = class extends Error {
|
|
|
146
146
|
return !this.isKnown();
|
|
147
147
|
}
|
|
148
148
|
/**
|
|
149
|
-
* Converts an error to a
|
|
149
|
+
* Converts an error to a MicrofrontendsError.
|
|
150
150
|
* @param original - The original error to convert.
|
|
151
|
-
* @returns The converted
|
|
151
|
+
* @returns The converted MicrofrontendsError.
|
|
152
152
|
*/
|
|
153
153
|
static convert(original, opts) {
|
|
154
154
|
if (opts == null ? void 0 : opts.fileName) {
|
|
155
|
-
const err =
|
|
155
|
+
const err = MicrofrontendError.convertFSError(original, opts.fileName);
|
|
156
156
|
if (err) {
|
|
157
157
|
return err;
|
|
158
158
|
}
|
|
@@ -160,25 +160,25 @@ var MicroFrontendError = class extends Error {
|
|
|
160
160
|
if (original.message.includes(
|
|
161
161
|
"Code generation from strings disallowed for this context"
|
|
162
162
|
)) {
|
|
163
|
-
return new
|
|
163
|
+
return new MicrofrontendError(original.message, {
|
|
164
164
|
type: "config",
|
|
165
165
|
subtype: "unsupported_validation_env",
|
|
166
166
|
source: "ajv"
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
|
-
return new
|
|
169
|
+
return new MicrofrontendError(original.message);
|
|
170
170
|
}
|
|
171
171
|
static convertFSError(original, fileName) {
|
|
172
172
|
if (original instanceof Error && "code" in original) {
|
|
173
173
|
if (original.code === "ENOENT") {
|
|
174
|
-
return new
|
|
174
|
+
return new MicrofrontendError(`Could not find "${fileName}"`, {
|
|
175
175
|
type: "config",
|
|
176
176
|
subtype: "unable_to_read_file",
|
|
177
177
|
source: "fs"
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
180
|
if (original.code === "EACCES") {
|
|
181
|
-
return new
|
|
181
|
+
return new MicrofrontendError(
|
|
182
182
|
`Permission denied while accessing "${fileName}"`,
|
|
183
183
|
{
|
|
184
184
|
type: "config",
|
|
@@ -189,7 +189,7 @@ var MicroFrontendError = class extends Error {
|
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
if (original instanceof SyntaxError) {
|
|
192
|
-
return new
|
|
192
|
+
return new MicrofrontendError(
|
|
193
193
|
`Failed to parse "${fileName}": Invalid JSON format.`,
|
|
194
194
|
{
|
|
195
195
|
type: "config",
|
|
@@ -201,23 +201,23 @@ var MicroFrontendError = class extends Error {
|
|
|
201
201
|
return null;
|
|
202
202
|
}
|
|
203
203
|
/**
|
|
204
|
-
* Handles an unknown error and returns a
|
|
204
|
+
* Handles an unknown error and returns a MicrofrontendsError instance.
|
|
205
205
|
* @param err - The error to handle.
|
|
206
|
-
* @returns A
|
|
206
|
+
* @returns A MicrofrontendsError instance.
|
|
207
207
|
*/
|
|
208
208
|
static handle(err, opts) {
|
|
209
|
-
if (err instanceof
|
|
209
|
+
if (err instanceof MicrofrontendError) {
|
|
210
210
|
return err;
|
|
211
211
|
}
|
|
212
212
|
if (err instanceof Error) {
|
|
213
|
-
return
|
|
213
|
+
return MicrofrontendError.convert(err, opts);
|
|
214
214
|
}
|
|
215
215
|
if (typeof err === "object" && err !== null) {
|
|
216
216
|
if ("message" in err && typeof err.message === "string") {
|
|
217
|
-
return
|
|
217
|
+
return MicrofrontendError.convert(new Error(err.message), opts);
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
return new
|
|
220
|
+
return new MicrofrontendError("An unknown error occurred");
|
|
221
221
|
}
|
|
222
222
|
};
|
|
223
223
|
|
|
@@ -300,27 +300,27 @@ var _Overrides = class {
|
|
|
300
300
|
});
|
|
301
301
|
return overridesConfig;
|
|
302
302
|
}
|
|
303
|
-
static validOverrideDomainsForZone(
|
|
303
|
+
static validOverrideDomainsForZone(microfrontendConfig, zone) {
|
|
304
304
|
var _a, _b, _c, _d, _e;
|
|
305
|
-
const projectName = (_a =
|
|
305
|
+
const projectName = (_a = microfrontendConfig.getZone(zone).vercel) == null ? void 0 : _a.projectName;
|
|
306
306
|
if (!projectName) {
|
|
307
|
-
return [
|
|
307
|
+
return [microfrontendConfig.getZone(zone).production.host];
|
|
308
308
|
}
|
|
309
309
|
const parsedProjectName = makeUrlSafe(projectName);
|
|
310
|
-
const previewDeploymentSuffix = (_c = (_b =
|
|
311
|
-
const teamSlug = (_e = (_d =
|
|
310
|
+
const previewDeploymentSuffix = (_c = (_b = microfrontendConfig.options) == null ? void 0 : _b.vercel) == null ? void 0 : _c.previewDeploymentSuffix;
|
|
311
|
+
const teamSlug = (_e = (_d = microfrontendConfig.options) == null ? void 0 : _d.vercel) == null ? void 0 : _e.teamSlug;
|
|
312
312
|
if (!teamSlug && !previewDeploymentSuffix) {
|
|
313
|
-
return [
|
|
313
|
+
return [microfrontendConfig.getZone(zone).production.host];
|
|
314
314
|
}
|
|
315
315
|
const suffix = previewDeploymentSuffix ? `.${previewDeploymentSuffix}` : `-${teamSlug}.vercel.app`;
|
|
316
316
|
return [
|
|
317
317
|
`${parsedProjectName}-git-([a-zA-Z0-9-]+)${suffix}`,
|
|
318
|
-
|
|
318
|
+
microfrontendConfig.getZone(zone).production.host
|
|
319
319
|
];
|
|
320
320
|
}
|
|
321
|
-
static validateOverrideDomain(
|
|
321
|
+
static validateOverrideDomain(microfrontendConfig, zone, domain) {
|
|
322
322
|
return new RegExp(
|
|
323
|
-
`^${_Overrides.validOverrideDomainsForZone(
|
|
323
|
+
`^${_Overrides.validOverrideDomainsForZone(microfrontendConfig, zone).join(
|
|
324
324
|
"|"
|
|
325
325
|
)}$`
|
|
326
326
|
).test(domain);
|
|
@@ -402,7 +402,7 @@ var Application = class {
|
|
|
402
402
|
static validate(name, app) {
|
|
403
403
|
var _a, _b, _c, _d, _e;
|
|
404
404
|
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("/"))) {
|
|
405
|
-
throw new
|
|
405
|
+
throw new MicrofrontendError(
|
|
406
406
|
`Invalid assetPrefix for application "${name}". Must not start or end with a slash.`,
|
|
407
407
|
{ type: "zone", subtype: "invalid_asset_prefix" }
|
|
408
408
|
);
|
|
@@ -413,13 +413,13 @@ var Application = class {
|
|
|
413
413
|
continue;
|
|
414
414
|
}
|
|
415
415
|
if (p.endsWith("/")) {
|
|
416
|
-
throw new
|
|
416
|
+
throw new MicrofrontendError(
|
|
417
417
|
`Invalid path for application "${name}". ${p} must not end with a slash.`,
|
|
418
418
|
{ type: "zone", subtype: "invalid_path" }
|
|
419
419
|
);
|
|
420
420
|
}
|
|
421
421
|
if (!p.startsWith("/")) {
|
|
422
|
-
throw new
|
|
422
|
+
throw new MicrofrontendError(
|
|
423
423
|
`Invalid path for application "${name}". ${p} must start with a slash.`,
|
|
424
424
|
{ type: "zone", subtype: "invalid_path" }
|
|
425
425
|
);
|
|
@@ -453,10 +453,10 @@ var Application = class {
|
|
|
453
453
|
}
|
|
454
454
|
};
|
|
455
455
|
|
|
456
|
-
// src/config/common/
|
|
456
|
+
// src/config/common/microfrontend-config.ts
|
|
457
457
|
var SUPPORTED_VERSIONS = ["1"];
|
|
458
458
|
var DEFAULT_LOCAL_PROXY_PORT = 3024;
|
|
459
|
-
var
|
|
459
|
+
var MicrofrontendConfigCommon = class {
|
|
460
460
|
constructor({
|
|
461
461
|
config,
|
|
462
462
|
overrides
|
|
@@ -464,7 +464,7 @@ var MicroFrontendConfigCommon = class {
|
|
|
464
464
|
this.zones = {};
|
|
465
465
|
var _a, _b, _c;
|
|
466
466
|
if (!SUPPORTED_VERSIONS.includes(config.version)) {
|
|
467
|
-
throw new
|
|
467
|
+
throw new MicrofrontendError(
|
|
468
468
|
`Unsupported version: ${config.version}. Supported versions are: ${SUPPORTED_VERSIONS.join(
|
|
469
469
|
", "
|
|
470
470
|
)}`,
|
|
@@ -492,7 +492,7 @@ var MicroFrontendConfigCommon = class {
|
|
|
492
492
|
static getConfigFromEnv() {
|
|
493
493
|
const config = process.env.MFE_CONFIG;
|
|
494
494
|
if (!config) {
|
|
495
|
-
throw new
|
|
495
|
+
throw new MicrofrontendError(`Missing "MFE_CONFIG" in environment.`, {
|
|
496
496
|
type: "config",
|
|
497
497
|
subtype: "not_found_in_env"
|
|
498
498
|
});
|
|
@@ -511,8 +511,8 @@ var MicroFrontendConfigCommon = class {
|
|
|
511
511
|
getZone(name) {
|
|
512
512
|
const zone = this.zones[name];
|
|
513
513
|
if (!zone) {
|
|
514
|
-
throw new
|
|
515
|
-
`Could not find
|
|
514
|
+
throw new MicrofrontendError(
|
|
515
|
+
`Could not find microfrontends configuration for application "${name}"`,
|
|
516
516
|
{
|
|
517
517
|
type: "zone",
|
|
518
518
|
subtype: "not_found"
|
|
@@ -532,8 +532,8 @@ var MicroFrontendConfigCommon = class {
|
|
|
532
532
|
getDefaultZone() {
|
|
533
533
|
const zone = Object.values(this.zones).find((z) => z.default);
|
|
534
534
|
if (!zone) {
|
|
535
|
-
throw new
|
|
536
|
-
`Could not find default zone in
|
|
535
|
+
throw new MicrofrontendError(
|
|
536
|
+
`Could not find default zone in microfrontends configuration`,
|
|
537
537
|
{
|
|
538
538
|
type: "zone",
|
|
539
539
|
subtype: "not_found"
|
|
@@ -585,8 +585,8 @@ var MicroFrontendConfigCommon = class {
|
|
|
585
585
|
};
|
|
586
586
|
}
|
|
587
587
|
write(_) {
|
|
588
|
-
throw new
|
|
589
|
-
`Writing to file to disk requires using an instance of "
|
|
588
|
+
throw new MicrofrontendError(
|
|
589
|
+
`Writing to file to disk requires using an instance of "MicrofrontendConfig".`,
|
|
590
590
|
{ type: "config", subtype: "unsupported_operation" }
|
|
591
591
|
);
|
|
592
592
|
}
|
|
@@ -947,7 +947,7 @@ var validateSchema = (configString) => {
|
|
|
947
947
|
const validate = ajv.compile(SCHEMA);
|
|
948
948
|
const isValid = validate(parsedConfig);
|
|
949
949
|
if (!isValid) {
|
|
950
|
-
throw new
|
|
950
|
+
throw new MicrofrontendError(
|
|
951
951
|
`Invalid config: ${ajv.errorsText(validate.errors)}`,
|
|
952
952
|
{ type: "config", subtype: "does_not_match_schema" }
|
|
953
953
|
);
|
|
@@ -957,7 +957,7 @@ var validateSchema = (configString) => {
|
|
|
957
957
|
var SUPPORTED_VERSIONS2 = ["1"];
|
|
958
958
|
var validateVersion = (version) => {
|
|
959
959
|
if (!SUPPORTED_VERSIONS2.includes(version)) {
|
|
960
|
-
throw new
|
|
960
|
+
throw new MicrofrontendError(
|
|
961
961
|
`Unsupported version: ${version}. Supported versions are: ${SUPPORTED_VERSIONS2.join(
|
|
962
962
|
", "
|
|
963
963
|
)}`,
|
|
@@ -990,7 +990,7 @@ function validateMainPath(applicationConfigsById) {
|
|
|
990
990
|
return !matcher.test(defaultRoute);
|
|
991
991
|
});
|
|
992
992
|
if (!isValid) {
|
|
993
|
-
throw new
|
|
993
|
+
throw new MicrofrontendError(
|
|
994
994
|
`default route "${defaultRoute}" cannot be used for "${id}" because it is matched by "${otherId}"`,
|
|
995
995
|
{ type: "config", subtype: "invalid_main_path" }
|
|
996
996
|
);
|
|
@@ -1003,7 +1003,7 @@ function validateMainPath(applicationConfigsById) {
|
|
|
1003
1003
|
return matcher.test(defaultRoute);
|
|
1004
1004
|
});
|
|
1005
1005
|
if (!isValid) {
|
|
1006
|
-
throw new
|
|
1006
|
+
throw new MicrofrontendError(
|
|
1007
1007
|
`default route "${defaultRoute}" is not included by the routing config for application "${id}"`,
|
|
1008
1008
|
{ type: "config", subtype: "invalid_main_path" }
|
|
1009
1009
|
);
|
|
@@ -1066,7 +1066,7 @@ var validatePaths = (applicationConfigsById) => {
|
|
|
1066
1066
|
);
|
|
1067
1067
|
});
|
|
1068
1068
|
if (errors.length) {
|
|
1069
|
-
throw new
|
|
1069
|
+
throw new MicrofrontendError(`Invalid paths: ${errors.join(", ")}`, {
|
|
1070
1070
|
type: "config",
|
|
1071
1071
|
subtype: "conflicting_paths"
|
|
1072
1072
|
});
|
|
@@ -1100,13 +1100,13 @@ function validatePathExpression(path3) {
|
|
|
1100
1100
|
var validateDefaults = (applicationConfigsById) => {
|
|
1101
1101
|
const defaultApplicationIds = Object.entries(applicationConfigsById).reduce((acc, [id, app]) => app.default ? [...acc, id] : acc, []);
|
|
1102
1102
|
if (defaultApplicationIds.length === 0) {
|
|
1103
|
-
throw new
|
|
1103
|
+
throw new MicrofrontendError(
|
|
1104
1104
|
`No default application found. At least one application must be marked as default.`,
|
|
1105
1105
|
{ type: "config", subtype: "no_default_application" }
|
|
1106
1106
|
);
|
|
1107
1107
|
}
|
|
1108
1108
|
if (defaultApplicationIds.length > 1) {
|
|
1109
|
-
throw new
|
|
1109
|
+
throw new MicrofrontendError(
|
|
1110
1110
|
`Only one default application is allowed. Found ${defaultApplicationIds.join(", ")}.`,
|
|
1111
1111
|
{ type: "config", subtype: "multiple_default_applications" }
|
|
1112
1112
|
);
|
|
@@ -1118,7 +1118,7 @@ var validateOptions = (options) => {
|
|
|
1118
1118
|
if (!/^[a-zA-Z]{2,}\.[a-zA-Z]{2,}$/.test(
|
|
1119
1119
|
options.vercel.previewDeploymentSuffix
|
|
1120
1120
|
)) {
|
|
1121
|
-
throw new
|
|
1121
|
+
throw new MicrofrontendError(
|
|
1122
1122
|
`Invalid preview deployment suffix: ${options.vercel.previewDeploymentSuffix}. Should have be formatted like "vercel.app".`,
|
|
1123
1123
|
{ type: "config", subtype: "invalid_preview_deployment_suffix" }
|
|
1124
1124
|
);
|
|
@@ -1173,9 +1173,15 @@ function convertV1ConfigToV2Config(config, fromApp) {
|
|
|
1173
1173
|
)
|
|
1174
1174
|
};
|
|
1175
1175
|
}
|
|
1176
|
+
const defaultApplication = Object.entries(config.applications).find(
|
|
1177
|
+
([, application]) => application.default
|
|
1178
|
+
);
|
|
1179
|
+
if (!defaultApplication) {
|
|
1180
|
+
throw new Error("No default application found in the config");
|
|
1181
|
+
}
|
|
1176
1182
|
return {
|
|
1177
1183
|
...common,
|
|
1178
|
-
partOf:
|
|
1184
|
+
partOf: defaultApplication[0]
|
|
1179
1185
|
};
|
|
1180
1186
|
}
|
|
1181
1187
|
|
|
@@ -1190,8 +1196,8 @@ function writeFile(outputPath, config, prettify) {
|
|
|
1190
1196
|
);
|
|
1191
1197
|
}
|
|
1192
1198
|
|
|
1193
|
-
// src/config/
|
|
1194
|
-
var
|
|
1199
|
+
// src/config/microfrontend-config.ts
|
|
1200
|
+
var MicrofrontendConfig = class extends MicrofrontendConfigCommon {
|
|
1195
1201
|
static validate(configString) {
|
|
1196
1202
|
const config = validateSchema(configString);
|
|
1197
1203
|
validateVersion(config.version);
|
|
@@ -1204,9 +1210,9 @@ var MicroFrontendConfig = class extends MicroFrontendConfigCommon {
|
|
|
1204
1210
|
static fromEnv({
|
|
1205
1211
|
cookies
|
|
1206
1212
|
}) {
|
|
1207
|
-
return new
|
|
1208
|
-
config:
|
|
1209
|
-
|
|
1213
|
+
return new MicrofrontendConfigCommon({
|
|
1214
|
+
config: MicrofrontendConfig.validate(
|
|
1215
|
+
MicrofrontendConfigCommon.getConfigFromEnv()
|
|
1210
1216
|
),
|
|
1211
1217
|
overrides: Overrides.parseOverrides(cookies)
|
|
1212
1218
|
});
|
|
@@ -1216,11 +1222,11 @@ var MicroFrontendConfig = class extends MicroFrontendConfigCommon {
|
|
|
1216
1222
|
}) {
|
|
1217
1223
|
try {
|
|
1218
1224
|
const config = import_node_fs2.default.readFileSync(filePath, "utf-8");
|
|
1219
|
-
return new
|
|
1220
|
-
config:
|
|
1225
|
+
return new MicrofrontendConfig({
|
|
1226
|
+
config: MicrofrontendConfig.validate(config)
|
|
1221
1227
|
});
|
|
1222
1228
|
} catch (e) {
|
|
1223
|
-
throw
|
|
1229
|
+
throw MicrofrontendError.handle(e, {
|
|
1224
1230
|
fileName: filePath
|
|
1225
1231
|
});
|
|
1226
1232
|
}
|
|
@@ -1244,7 +1250,7 @@ var MicroFrontendConfig = class extends MicroFrontendConfigCommon {
|
|
|
1244
1250
|
};
|
|
1245
1251
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1246
1252
|
0 && (module.exports = {
|
|
1247
|
-
|
|
1253
|
+
MicrofrontendConfig,
|
|
1248
1254
|
getClientConfigFromEnv,
|
|
1249
1255
|
getConfigForClient,
|
|
1250
1256
|
getWellKnownClientData,
|