@vercel/microfrontends 1.2.1 → 1.2.3
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 -7
- package/dist/bin/cli.cjs +23 -10
- package/dist/experimental/sveltekit.cjs +22 -9
- package/dist/experimental/sveltekit.cjs.map +1 -1
- package/dist/experimental/sveltekit.js +22 -9
- package/dist/experimental/sveltekit.js.map +1 -1
- package/dist/experimental/vite.cjs +22 -9
- package/dist/experimental/vite.cjs.map +1 -1
- package/dist/experimental/vite.js +22 -9
- package/dist/experimental/vite.js.map +1 -1
- package/dist/microfrontends/server.cjs +22 -9
- package/dist/microfrontends/server.cjs.map +1 -1
- package/dist/microfrontends/server.js +22 -9
- package/dist/microfrontends/server.js.map +1 -1
- package/dist/microfrontends/utils.cjs +111 -6
- package/dist/microfrontends/utils.cjs.map +1 -1
- package/dist/microfrontends/utils.js +111 -6
- package/dist/microfrontends/utils.js.map +1 -1
- 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/config.cjs +22 -9
- package/dist/next/config.cjs.map +1 -1
- package/dist/next/config.js +22 -9
- package/dist/next/config.js.map +1 -1
- package/dist/utils/mfe-port.cjs +22 -9
- package/dist/utils/mfe-port.cjs.map +1 -1
- package/dist/utils/mfe-port.js +22 -9
- package/dist/utils/mfe-port.js.map +1 -1
- package/package.json +1 -1
package/dist/next/config.cjs
CHANGED
|
@@ -255,19 +255,29 @@ function findPackageWithMicrofrontendsConfig({
|
|
|
255
255
|
const microfrontendsJson = (0, import_jsonc_parser.parse)(microfrontendsJsonContent);
|
|
256
256
|
if (microfrontendsJson.applications[applicationName]) {
|
|
257
257
|
matchingPaths.push(microfrontendsJsonPath);
|
|
258
|
+
} else {
|
|
259
|
+
for (const [_, app] of Object.entries(
|
|
260
|
+
microfrontendsJson.applications
|
|
261
|
+
)) {
|
|
262
|
+
if (app.packageName === applicationName) {
|
|
263
|
+
matchingPaths.push(microfrontendsJsonPath);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
258
266
|
}
|
|
259
267
|
} catch (error) {
|
|
260
268
|
}
|
|
261
269
|
}
|
|
262
270
|
if (matchingPaths.length > 1) {
|
|
263
|
-
throw new
|
|
271
|
+
throw new MicrofrontendError(
|
|
264
272
|
`Found multiple \`microfrontends.json\` files in the repository referencing the application "${applicationName}", but only one is allowed.
|
|
265
|
-
${matchingPaths.join("\n \u2022 ")}
|
|
273
|
+
${matchingPaths.join("\n \u2022 ")}`,
|
|
274
|
+
{ type: "config", subtype: "inference_failed" }
|
|
266
275
|
);
|
|
267
276
|
}
|
|
268
277
|
if (matchingPaths.length === 0) {
|
|
269
|
-
throw new
|
|
270
|
-
`Could not find a \`microfrontends.json\` file in the repository that contains "applications.${applicationName}". Microfrontends defined in separate repositories are not supported yet
|
|
278
|
+
throw new MicrofrontendError(
|
|
279
|
+
`Could not find a \`microfrontends.json\` file in the repository that contains "applications.${applicationName}". Microfrontends defined in separate repositories are not supported yet.`,
|
|
280
|
+
{ type: "config", subtype: "inference_failed" }
|
|
271
281
|
);
|
|
272
282
|
}
|
|
273
283
|
const [packageJsonPath] = matchingPaths;
|
|
@@ -283,8 +293,9 @@ function inferMicrofrontendsLocation(opts) {
|
|
|
283
293
|
}
|
|
284
294
|
const result = findPackageWithMicrofrontendsConfig(opts);
|
|
285
295
|
if (!result) {
|
|
286
|
-
throw new
|
|
287
|
-
`Could not infer the location of the \`microfrontends.json\` file for application "${opts.applicationName}" starting in directory "${opts.repositoryRoot}"
|
|
296
|
+
throw new MicrofrontendError(
|
|
297
|
+
`Could not infer the location of the \`microfrontends.json\` file for application "${opts.applicationName}" starting in directory "${opts.repositoryRoot}".`,
|
|
298
|
+
{ type: "config", subtype: "inference_failed" }
|
|
288
299
|
);
|
|
289
300
|
}
|
|
290
301
|
configCache[cacheKey] = result;
|
|
@@ -1412,15 +1423,17 @@ var MicrofrontendsServer = class {
|
|
|
1412
1423
|
});
|
|
1413
1424
|
}
|
|
1414
1425
|
}
|
|
1415
|
-
throw new
|
|
1416
|
-
"Unable to automatically infer the location of the `microfrontends.json` file. Microfrontends defined in separate repositories are not supported yet. If you suspect this is thrown in error, please reach out to the Vercel team."
|
|
1426
|
+
throw new MicrofrontendError(
|
|
1427
|
+
"Unable to automatically infer the location of the `microfrontends.json` file. Microfrontends defined in separate repositories are not supported yet. If you suspect this is thrown in error, please reach out to the Vercel team.",
|
|
1428
|
+
{ type: "config", subtype: "inference_failed" }
|
|
1417
1429
|
);
|
|
1418
1430
|
} catch (e) {
|
|
1419
1431
|
if (e instanceof MicrofrontendError) {
|
|
1420
1432
|
throw e;
|
|
1421
1433
|
}
|
|
1434
|
+
const errorMessage = e instanceof Error ? e.message : String(e);
|
|
1422
1435
|
throw new MicrofrontendError(
|
|
1423
|
-
|
|
1436
|
+
`Unable to locate and parse the \`microfrontends.json\` configuration file. Original error message: ${errorMessage}`,
|
|
1424
1437
|
{ cause: e, type: "config", subtype: "inference_failed" }
|
|
1425
1438
|
);
|
|
1426
1439
|
}
|