@vercel/microfrontends 0.13.0 → 0.14.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 +3 -3
- package/dist/bin/cli.cjs +85 -60
- package/dist/config/client.d.ts +1 -1
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js.map +1 -1
- package/dist/{index-83133f2d.d.ts → index-bf67a461.d.ts} +3 -10
- package/dist/next/client.cjs +1 -1
- package/dist/next/client.cjs.map +1 -1
- package/dist/next/client.js +1 -1
- package/dist/next/client.js.map +1 -1
- package/dist/next/endpoints.cjs.map +1 -1
- package/dist/next/endpoints.d.ts +1 -1
- package/dist/next/endpoints.js.map +1 -1
- package/dist/next/middleware.cjs +0 -29
- package/dist/next/middleware.cjs.map +1 -1
- package/dist/next/middleware.js +0 -29
- package/dist/next/middleware.js.map +1 -1
- package/dist/{types-a995174e.d.ts → types-a29d224a.d.ts} +1 -7
- package/dist/{types-15b7f215.d.ts → types-cfe3308b.d.ts} +1 -1
- package/dist/types-fc30696d.d.ts +11 -0
- package/dist/utils/mfe-port.cjs +70 -56
- package/dist/utils/mfe-port.cjs.map +1 -1
- package/dist/utils/mfe-port.js +67 -53
- package/dist/utils/mfe-port.js.map +1 -1
- package/dist/v2/config.cjs +0 -14
- package/dist/v2/config.cjs.map +1 -1
- package/dist/v2/config.d.ts +4 -3
- package/dist/v2/config.js +0 -14
- package/dist/v2/config.js.map +1 -1
- package/dist/v2/microfrontends/server.cjs +68 -54
- package/dist/v2/microfrontends/server.cjs.map +1 -1
- package/dist/v2/microfrontends/server.d.ts +6 -5
- package/dist/v2/microfrontends/server.js +65 -51
- package/dist/v2/microfrontends/server.js.map +1 -1
- package/dist/v2/microfrontends.cjs +0 -14
- package/dist/v2/microfrontends.cjs.map +1 -1
- package/dist/v2/microfrontends.d.ts +4 -3
- package/dist/v2/microfrontends.js +0 -14
- 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 +106 -60
- package/dist/v2/next/config.cjs.map +1 -1
- package/dist/v2/next/config.js +103 -57
- package/dist/v2/next/config.js.map +1 -1
- package/dist/v2/next/endpoints.cjs.map +1 -1
- package/dist/v2/next/endpoints.d.ts +13 -2
- package/dist/v2/next/endpoints.js.map +1 -1
- package/dist/v2/next/middleware.cjs +10 -54
- package/dist/v2/next/middleware.cjs.map +1 -1
- package/dist/v2/next/middleware.d.ts +7 -2
- package/dist/v2/next/middleware.js +10 -54
- package/dist/v2/next/middleware.js.map +1 -1
- package/dist/v2/next/testing.cjs +992 -0
- package/dist/v2/next/testing.cjs.map +1 -0
- package/dist/v2/next/testing.d.ts +55 -0
- package/dist/v2/next/testing.js +961 -0
- package/dist/v2/next/testing.js.map +1 -0
- package/dist/v2/overrides.d.ts +3 -3
- package/dist/v2/routing.cjs +19 -0
- package/dist/v2/routing.cjs.map +1 -0
- package/dist/v2/routing.d.ts +26 -0
- package/dist/v2/routing.js +1 -0
- package/dist/v2/routing.js.map +1 -0
- package/dist/v2/schema.cjs.map +1 -1
- package/dist/v2/schema.d.ts +1 -1
- package/dist/validation.cjs +0 -4
- package/dist/validation.cjs.map +1 -1
- package/dist/validation.d.ts +0 -6
- package/dist/validation.js +0 -4
- package/dist/validation.js.map +1 -1
- package/package.json +20 -5
- package/schema/schema-v2.json +0 -4
package/README.md
CHANGED
|
@@ -123,7 +123,7 @@ export async function middleware(
|
|
|
123
123
|
request: NextRequest,
|
|
124
124
|
event: NextFetchEvent,
|
|
125
125
|
): Promise<Response> {
|
|
126
|
-
let response = await runMicrofrontendsMiddleware(request);
|
|
126
|
+
let response = await runMicrofrontendsMiddleware({ request });
|
|
127
127
|
if (response) {
|
|
128
128
|
return response;
|
|
129
129
|
}
|
|
@@ -136,7 +136,7 @@ The Micro-Frontends features rely on information exposed in two `.well-known`
|
|
|
136
136
|
endpoints:
|
|
137
137
|
|
|
138
138
|
- `/.well-known/vercel/micro-frontends/server-config`
|
|
139
|
-
- `/.well-known/vercel/
|
|
139
|
+
- `/.well-known/vercel/microfrontends/client-config`
|
|
140
140
|
|
|
141
141
|
You must define API handlers for these two routes to serve the information to
|
|
142
142
|
the client and Vercel Toolbar for Micro-Frontends features to work.
|
|
@@ -148,7 +148,7 @@ file:
|
|
|
148
148
|
export { wellKnownNextjsServerConfigAppRoute as GET } from '@vercel/microfrontends/next/endpoints';
|
|
149
149
|
```
|
|
150
150
|
|
|
151
|
-
Then do the same for `app/.well-known/vercel/
|
|
151
|
+
Then do the same for `app/.well-known/vercel/microfrontends/client-config/route.ts`:
|
|
152
152
|
|
|
153
153
|
```typescript filename
|
|
154
154
|
export { wellKnownNextjsClientConfigAppRoute as GET } from '@vercel/microfrontends/next/endpoints';
|
package/dist/bin/cli.cjs
CHANGED
|
@@ -29,7 +29,7 @@ var import_commander = require("commander");
|
|
|
29
29
|
// package.json
|
|
30
30
|
var package_default = {
|
|
31
31
|
name: "@vercel/microfrontends",
|
|
32
|
-
version: "0.
|
|
32
|
+
version: "0.14.0",
|
|
33
33
|
private: false,
|
|
34
34
|
description: "Defines configuration and utilities for micro-frontend development",
|
|
35
35
|
repository: {
|
|
@@ -40,6 +40,7 @@ var package_default = {
|
|
|
40
40
|
sideEffects: false,
|
|
41
41
|
type: "module",
|
|
42
42
|
bin: {
|
|
43
|
+
microfrontends: "./cli/index.cjs",
|
|
43
44
|
"micro-frontends": "./cli/index.cjs"
|
|
44
45
|
},
|
|
45
46
|
exports: {
|
|
@@ -92,6 +93,10 @@ var package_default = {
|
|
|
92
93
|
import: "./dist/v2/overrides.js",
|
|
93
94
|
require: "./dist/v2/overrides.cjs"
|
|
94
95
|
},
|
|
96
|
+
"./v2/routing": {
|
|
97
|
+
import: "./dist/v2/routing.js",
|
|
98
|
+
require: "./dist/v2/routing.cjs"
|
|
99
|
+
},
|
|
95
100
|
"./v2/microfrontends/server": {
|
|
96
101
|
import: "./dist/v2/microfrontends/server.js",
|
|
97
102
|
require: "./dist/v2/microfrontends/server.cjs"
|
|
@@ -112,6 +117,10 @@ var package_default = {
|
|
|
112
117
|
import: "./dist/v2/next/endpoints.js",
|
|
113
118
|
require: "./dist/v2/next/endpoints.cjs"
|
|
114
119
|
},
|
|
120
|
+
"./v2/next/testing": {
|
|
121
|
+
import: "./dist/v2/next/testing.js",
|
|
122
|
+
require: "./dist/v2/next/testing.cjs"
|
|
123
|
+
},
|
|
115
124
|
"./next/client": {
|
|
116
125
|
import: "./dist/next/client.js",
|
|
117
126
|
require: "./dist/next/client.cjs"
|
|
@@ -139,11 +148,13 @@ var package_default = {
|
|
|
139
148
|
"v2/config": ["./dist/v2/config.d.ts"],
|
|
140
149
|
"v2/microfrontends": ["./dist/v2/microfrontends.d.ts"],
|
|
141
150
|
"v2/overrides": ["./dist/v2/overrides.d.ts"],
|
|
151
|
+
"v2/routing": ["./dist/v2/routing.d.ts"],
|
|
142
152
|
"v2/microfrontends/server": ["./dist/v2/microfrontends/server.d.ts"],
|
|
143
153
|
"v2/schema": ["./dist/v2/schema.d.ts"],
|
|
144
154
|
"v2/next/config": ["./dist/v2/next/config.d.ts"],
|
|
145
155
|
"v2/next/middleware": ["./dist/v2/next/middleware.d.ts"],
|
|
146
156
|
"v2/next/endpoints": ["./dist/v2/next/endpoints.d.ts"],
|
|
157
|
+
"v2/next/testing": ["./dist/v2/next/testing.d.ts"],
|
|
147
158
|
"next/client": ["./dist/next/client.d.ts"],
|
|
148
159
|
"v2/next/client": ["./dist/v2/next/client.d.ts"],
|
|
149
160
|
"utils/mfe-port": ["./dist/utils/mfe-port.d.ts"]
|
|
@@ -187,7 +198,7 @@ var package_default = {
|
|
|
187
198
|
"@vercel-private/conformance": "^1.12.2-canary.0",
|
|
188
199
|
jest: "^29.7.0",
|
|
189
200
|
"jest-environment-jsdom": "29.2.2",
|
|
190
|
-
next: "15.
|
|
201
|
+
next: "15.2.0-canary.14",
|
|
191
202
|
react: "19.0.0",
|
|
192
203
|
"react-dom": "19.0.0",
|
|
193
204
|
"ts-json-schema-generator": "^1.1.2",
|
|
@@ -197,7 +208,7 @@ var package_default = {
|
|
|
197
208
|
webpack: "5"
|
|
198
209
|
},
|
|
199
210
|
peerDependencies: {
|
|
200
|
-
next: "15.
|
|
211
|
+
next: "15.2.0-canary.14",
|
|
201
212
|
react: "19.0.0",
|
|
202
213
|
"react-dom": "19.0.0"
|
|
203
214
|
},
|
|
@@ -1582,19 +1593,6 @@ var validateConfigDefaultApplication = (applicationConfigsById) => {
|
|
|
1582
1593
|
);
|
|
1583
1594
|
}
|
|
1584
1595
|
};
|
|
1585
|
-
var validateConfigOptions = (options) => {
|
|
1586
|
-
var _a;
|
|
1587
|
-
if ((_a = options == null ? void 0 : options.vercel) == null ? void 0 : _a.previewDeploymentSuffix) {
|
|
1588
|
-
if (!/^[a-zA-Z]{2,}\.[a-zA-Z]{2,}$/.test(
|
|
1589
|
-
options.vercel.previewDeploymentSuffix
|
|
1590
|
-
)) {
|
|
1591
|
-
throw new MicrofrontendError2(
|
|
1592
|
-
`Invalid preview deployment suffix: ${options.vercel.previewDeploymentSuffix}. Should have be formatted like "vercel.app".`,
|
|
1593
|
-
{ type: "config", subtype: "invalid_preview_deployment_suffix" }
|
|
1594
|
-
);
|
|
1595
|
-
}
|
|
1596
|
-
}
|
|
1597
|
-
};
|
|
1598
1596
|
|
|
1599
1597
|
// src/config-v2/microfrontends-config/isomorphic/utils/generate-asset-prefix.ts
|
|
1600
1598
|
var PREFIX = "vc-ap";
|
|
@@ -1933,7 +1931,6 @@ var MicrofrontendConfigIsomorphic = class {
|
|
|
1933
1931
|
validateConfigPaths(c.applications);
|
|
1934
1932
|
validateConfigDefaultApplication(c.applications);
|
|
1935
1933
|
}
|
|
1936
|
-
validateConfigOptions(c.options);
|
|
1937
1934
|
return c;
|
|
1938
1935
|
}
|
|
1939
1936
|
static fromEnv({
|
|
@@ -2097,8 +2094,8 @@ function isMainConfig2(c) {
|
|
|
2097
2094
|
}
|
|
2098
2095
|
|
|
2099
2096
|
// src/config-v2/microfrontends/server/index.ts
|
|
2100
|
-
var
|
|
2101
|
-
var
|
|
2097
|
+
var import_node_fs9 = __toESM(require("fs"), 1);
|
|
2098
|
+
var import_node_path10 = require("path");
|
|
2102
2099
|
|
|
2103
2100
|
// src/config-v2/microfrontends-config/isomorphic/child.ts
|
|
2104
2101
|
var MicrofrontendChildConfig = class extends MicrofrontendConfigIsomorphic {
|
|
@@ -2218,29 +2215,39 @@ function findPackagePath(opts) {
|
|
|
2218
2215
|
// src/config-v2/microfrontends/utils/find-default-package.ts
|
|
2219
2216
|
var import_node_path6 = require("path");
|
|
2220
2217
|
var import_node_fs5 = require("fs");
|
|
2218
|
+
var import_jsonc_parser3 = require("jsonc-parser");
|
|
2221
2219
|
var import_fast_glob2 = __toESM(require("fast-glob"), 1);
|
|
2220
|
+
|
|
2221
|
+
// src/config-v2/constants.ts
|
|
2222
|
+
var CONFIGURATION_FILENAMES = [
|
|
2223
|
+
"microfrontends.jsonc",
|
|
2224
|
+
"microfrontends.json"
|
|
2225
|
+
];
|
|
2226
|
+
|
|
2227
|
+
// src/config-v2/microfrontends/utils/find-default-package.ts
|
|
2222
2228
|
var configCache2 = {};
|
|
2223
2229
|
function findDefaultMicrofrontendsPackages({
|
|
2224
2230
|
repositoryRoot,
|
|
2225
2231
|
applicationName
|
|
2226
2232
|
}) {
|
|
2227
2233
|
try {
|
|
2228
|
-
const microfrontendsJsonPaths = import_fast_glob2.default.globSync(
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2234
|
+
const microfrontendsJsonPaths = import_fast_glob2.default.globSync(
|
|
2235
|
+
`**/{${CONFIGURATION_FILENAMES.join(",")}}`,
|
|
2236
|
+
{
|
|
2237
|
+
cwd: repositoryRoot,
|
|
2238
|
+
absolute: true,
|
|
2239
|
+
onlyFiles: true,
|
|
2240
|
+
followSymbolicLinks: false,
|
|
2241
|
+
ignore: ["**/node_modules/**", "**/.git/**"]
|
|
2242
|
+
}
|
|
2243
|
+
);
|
|
2235
2244
|
const matchingPaths = [];
|
|
2236
2245
|
for (const microfrontendsJsonPath of microfrontendsJsonPaths) {
|
|
2237
2246
|
const microfrontendsJsonContent = (0, import_node_fs5.readFileSync)(
|
|
2238
2247
|
microfrontendsJsonPath,
|
|
2239
2248
|
"utf-8"
|
|
2240
2249
|
);
|
|
2241
|
-
const microfrontendsJson =
|
|
2242
|
-
microfrontendsJsonContent
|
|
2243
|
-
);
|
|
2250
|
+
const microfrontendsJson = (0, import_jsonc_parser3.parse)(microfrontendsJsonContent);
|
|
2244
2251
|
if (isMainConfig(microfrontendsJson) && microfrontendsJson.applications[applicationName]) {
|
|
2245
2252
|
matchingPaths.push(microfrontendsJsonPath);
|
|
2246
2253
|
}
|
|
@@ -2270,7 +2277,7 @@ function findDefaultMicrofrontendsPackage(opts) {
|
|
|
2270
2277
|
const result = findDefaultMicrofrontendsPackages(opts);
|
|
2271
2278
|
if (!result) {
|
|
2272
2279
|
throw new Error(
|
|
2273
|
-
`Error trying to resolve the main microfrontends
|
|
2280
|
+
`Error trying to resolve the main microfrontends configuration`
|
|
2274
2281
|
);
|
|
2275
2282
|
}
|
|
2276
2283
|
configCache2[cacheKey] = result;
|
|
@@ -2322,8 +2329,21 @@ function findPackageRoot(startDir) {
|
|
|
2322
2329
|
);
|
|
2323
2330
|
}
|
|
2324
2331
|
|
|
2332
|
+
// src/config-v2/microfrontends/utils/find-config.ts
|
|
2333
|
+
var import_node_fs8 = __toESM(require("fs"), 1);
|
|
2334
|
+
var import_node_path9 = require("path");
|
|
2335
|
+
function findConfig({ dir }) {
|
|
2336
|
+
for (const filename of CONFIGURATION_FILENAMES) {
|
|
2337
|
+
const maybeConfig = (0, import_node_path9.join)(dir, filename);
|
|
2338
|
+
if (import_node_fs8.default.existsSync(maybeConfig)) {
|
|
2339
|
+
return maybeConfig;
|
|
2340
|
+
}
|
|
2341
|
+
}
|
|
2342
|
+
return null;
|
|
2343
|
+
}
|
|
2344
|
+
|
|
2325
2345
|
// src/config-v2/microfrontends/server/validation.ts
|
|
2326
|
-
var
|
|
2346
|
+
var import_jsonc_parser4 = require("jsonc-parser");
|
|
2327
2347
|
var import_ajv2 = require("ajv");
|
|
2328
2348
|
|
|
2329
2349
|
// schema/schema-v2.json
|
|
@@ -2384,10 +2404,6 @@ var schema_v2_default = {
|
|
|
2384
2404
|
VercelOptions: {
|
|
2385
2405
|
type: "object",
|
|
2386
2406
|
properties: {
|
|
2387
|
-
previewDeploymentSuffix: {
|
|
2388
|
-
type: "string",
|
|
2389
|
-
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`."
|
|
2390
|
-
},
|
|
2391
2407
|
teamSlug: {
|
|
2392
2408
|
type: "string",
|
|
2393
2409
|
description: "Team slug for the Vercel team"
|
|
@@ -2581,7 +2597,7 @@ var SCHEMA2 = schema_v2_default;
|
|
|
2581
2597
|
|
|
2582
2598
|
// src/config-v2/microfrontends/server/validation.ts
|
|
2583
2599
|
function validateSchema2(configString) {
|
|
2584
|
-
const parsedConfig = (0,
|
|
2600
|
+
const parsedConfig = (0, import_jsonc_parser4.parse)(configString);
|
|
2585
2601
|
const ajv = new import_ajv2.Ajv();
|
|
2586
2602
|
const validate = ajv.compile(SCHEMA2);
|
|
2587
2603
|
const isValid = validate(parsedConfig);
|
|
@@ -2603,8 +2619,8 @@ var MicrofrontendsServer = class extends Microfrontends {
|
|
|
2603
2619
|
pretty: true
|
|
2604
2620
|
}) {
|
|
2605
2621
|
const outputPath = getOutputFilePath();
|
|
2606
|
-
|
|
2607
|
-
|
|
2622
|
+
import_node_fs9.default.mkdirSync((0, import_node_path10.dirname)(outputPath), { recursive: true });
|
|
2623
|
+
import_node_fs9.default.writeFileSync(
|
|
2608
2624
|
outputPath,
|
|
2609
2625
|
JSON.stringify(
|
|
2610
2626
|
this.config.toSchemaJson(),
|
|
@@ -2667,8 +2683,8 @@ var MicrofrontendsServer = class extends Microfrontends {
|
|
|
2667
2683
|
return config;
|
|
2668
2684
|
}
|
|
2669
2685
|
/**
|
|
2670
|
-
* Looks up the configuration by inferring the package root and looking for a microfrontends
|
|
2671
|
-
* it will look for a package in the repository with a microfrontends
|
|
2686
|
+
* Looks up the configuration by inferring the package root and looking for a microfrontends config file. If a file is not found,
|
|
2687
|
+
* it will look for a package in the repository with a microfrontends file that contains the current application
|
|
2672
2688
|
* and use that configuration.
|
|
2673
2689
|
*
|
|
2674
2690
|
* This can return either a Child or Main configuration.
|
|
@@ -2690,16 +2706,16 @@ var MicrofrontendsServer = class extends Microfrontends {
|
|
|
2690
2706
|
}
|
|
2691
2707
|
try {
|
|
2692
2708
|
const packageRoot = findPackageRoot(directory);
|
|
2693
|
-
const packageJsonPath = (0,
|
|
2709
|
+
const packageJsonPath = (0, import_node_path10.join)(packageRoot, "package.json");
|
|
2694
2710
|
const packageJson = JSON.parse(
|
|
2695
|
-
|
|
2711
|
+
import_node_fs9.default.readFileSync(packageJsonPath, "utf-8")
|
|
2696
2712
|
);
|
|
2697
2713
|
if (!packageJson.name) {
|
|
2698
2714
|
throw new Error(`No name found in package.json at ${packageJsonPath}`);
|
|
2699
2715
|
}
|
|
2700
2716
|
const configMeta = meta ?? { fromApp: packageJson.name };
|
|
2701
|
-
const maybeConfig = (
|
|
2702
|
-
if (
|
|
2717
|
+
const maybeConfig = findConfig({ dir: packageRoot });
|
|
2718
|
+
if (maybeConfig) {
|
|
2703
2719
|
return MicrofrontendsServer.fromFile({
|
|
2704
2720
|
filePath: maybeConfig,
|
|
2705
2721
|
cookies,
|
|
@@ -2714,12 +2730,15 @@ var MicrofrontendsServer = class extends Microfrontends {
|
|
|
2714
2730
|
repositoryRoot,
|
|
2715
2731
|
applicationName: packageJson.name
|
|
2716
2732
|
});
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2733
|
+
const maybeConfigFromDefault = findConfig({ dir: defaultPackage });
|
|
2734
|
+
if (maybeConfigFromDefault) {
|
|
2735
|
+
return MicrofrontendsServer.fromFile({
|
|
2736
|
+
filePath: maybeConfigFromDefault,
|
|
2737
|
+
cookies,
|
|
2738
|
+
meta: configMeta,
|
|
2739
|
+
options
|
|
2740
|
+
});
|
|
2741
|
+
}
|
|
2723
2742
|
}
|
|
2724
2743
|
throw new Error("Unable to infer");
|
|
2725
2744
|
} catch (e) {
|
|
@@ -2739,7 +2758,7 @@ var MicrofrontendsServer = class extends Microfrontends {
|
|
|
2739
2758
|
options
|
|
2740
2759
|
}) {
|
|
2741
2760
|
try {
|
|
2742
|
-
const configJson =
|
|
2761
|
+
const configJson = import_node_fs9.default.readFileSync(filePath, "utf-8");
|
|
2743
2762
|
const config = MicrofrontendsServer.validate(configJson);
|
|
2744
2763
|
if (!isMainConfig(config) && (options == null ? void 0 : options.resolveMainConfig)) {
|
|
2745
2764
|
const repositoryRoot = findRepositoryRoot();
|
|
@@ -2755,9 +2774,15 @@ var MicrofrontendsServer = class extends Microfrontends {
|
|
|
2755
2774
|
{ type: "config", subtype: "not_found" }
|
|
2756
2775
|
);
|
|
2757
2776
|
}
|
|
2758
|
-
const
|
|
2777
|
+
const maybeConfig = findConfig({ dir: packagePath });
|
|
2778
|
+
if (!maybeConfig) {
|
|
2779
|
+
throw new MicrofrontendError2(
|
|
2780
|
+
`Could not find microfrontends configuration in ${packagePath}`,
|
|
2781
|
+
{ type: "config", subtype: "not_found" }
|
|
2782
|
+
);
|
|
2783
|
+
}
|
|
2759
2784
|
return MicrofrontendsServer.fromMainConfigFile({
|
|
2760
|
-
filePath:
|
|
2785
|
+
filePath: maybeConfig,
|
|
2761
2786
|
overrides: cookies ? parseOverrides(cookies) : void 0
|
|
2762
2787
|
});
|
|
2763
2788
|
}
|
|
@@ -2781,7 +2806,7 @@ var MicrofrontendsServer = class extends Microfrontends {
|
|
|
2781
2806
|
overrides
|
|
2782
2807
|
}) {
|
|
2783
2808
|
try {
|
|
2784
|
-
const config =
|
|
2809
|
+
const config = import_node_fs9.default.readFileSync(filePath, "utf-8");
|
|
2785
2810
|
const validatedConfig = MicrofrontendsServer.validate(config);
|
|
2786
2811
|
if (!isMainConfig(validatedConfig)) {
|
|
2787
2812
|
throw new MicrofrontendError2(
|
|
@@ -3059,7 +3084,7 @@ var LocalProxy = class {
|
|
|
3059
3084
|
const url = new URL(`http://example.comf${path7}`);
|
|
3060
3085
|
const pathname = url.pathname;
|
|
3061
3086
|
switch (pathname) {
|
|
3062
|
-
case "/.well-known/vercel/
|
|
3087
|
+
case "/.well-known/vercel/microfrontends/routing": {
|
|
3063
3088
|
res.writeHead(200, {
|
|
3064
3089
|
"Content-Type": "application/json"
|
|
3065
3090
|
});
|
|
@@ -3146,8 +3171,8 @@ var LocalProxy = class {
|
|
|
3146
3171
|
var import_node_process = require("process");
|
|
3147
3172
|
|
|
3148
3173
|
// src/utils/mfe-port.ts
|
|
3149
|
-
var
|
|
3150
|
-
var
|
|
3174
|
+
var import_node_path11 = __toESM(require("path"), 1);
|
|
3175
|
+
var import_node_fs10 = __toESM(require("fs"), 1);
|
|
3151
3176
|
function mfePort(packageDir) {
|
|
3152
3177
|
const { name: appName, version } = getPackageJson(packageDir);
|
|
3153
3178
|
const result = loadV2({ packageDir, appName }) || loadV1({ packageDir, appName });
|
|
@@ -3165,8 +3190,8 @@ function mfePort(packageDir) {
|
|
|
3165
3190
|
};
|
|
3166
3191
|
}
|
|
3167
3192
|
function getPackageJson(packageDir) {
|
|
3168
|
-
const filePath =
|
|
3169
|
-
return JSON.parse(
|
|
3193
|
+
const filePath = import_node_path11.default.join(packageDir, "package.json");
|
|
3194
|
+
return JSON.parse(import_node_fs10.default.readFileSync(filePath, "utf-8"));
|
|
3170
3195
|
}
|
|
3171
3196
|
function loadV2({
|
|
3172
3197
|
packageDir,
|
|
@@ -3190,7 +3215,7 @@ function loadV1({
|
|
|
3190
3215
|
packageDir,
|
|
3191
3216
|
appName
|
|
3192
3217
|
}) {
|
|
3193
|
-
const filePath =
|
|
3218
|
+
const filePath = import_node_path11.default.join(packageDir, "micro-frontends.jsonc");
|
|
3194
3219
|
let config;
|
|
3195
3220
|
try {
|
|
3196
3221
|
config = MicrofrontendConfig.fromFile({ filePath });
|
package/dist/config/client.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ interface ClientConfig {
|
|
|
5
5
|
applications: Record<string, ClientApplicationConfig>;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
|
-
* Data that is returned from the `.well-known/vercel/
|
|
8
|
+
* Data that is returned from the `.well-known/vercel/microfrontends/client-config`
|
|
9
9
|
* endpoint that is used by the client to ensure that navigations and prefetches
|
|
10
10
|
* are routed correctly.
|
|
11
11
|
*/
|