@vercel/microfrontends 1.0.1-canary.1 → 1.0.1-canary.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/dist/bin/cli.cjs +43 -33
- package/dist/config.cjs +41 -32
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +41 -32
- package/dist/config.js.map +1 -1
- package/dist/experimental/sveltekit.cjs +41 -32
- package/dist/experimental/sveltekit.cjs.map +1 -1
- package/dist/experimental/sveltekit.js +41 -32
- package/dist/experimental/sveltekit.js.map +1 -1
- package/dist/experimental/vite.cjs +88 -46
- package/dist/experimental/vite.cjs.map +1 -1
- package/dist/experimental/vite.d.ts +1 -1
- package/dist/experimental/vite.js +88 -48
- package/dist/experimental/vite.js.map +1 -1
- package/dist/{index-d5994ac5.d.ts → index-2b59c627.d.ts} +1 -1
- package/dist/microfrontends/server.cjs +41 -32
- package/dist/microfrontends/server.cjs.map +1 -1
- package/dist/microfrontends/server.d.ts +1 -1
- package/dist/microfrontends/server.js +41 -32
- package/dist/microfrontends/server.js.map +1 -1
- package/dist/microfrontends.cjs +41 -32
- package/dist/microfrontends.cjs.map +1 -1
- package/dist/microfrontends.d.ts +1 -1
- package/dist/microfrontends.js +41 -32
- package/dist/microfrontends.js.map +1 -1
- package/dist/next/config.cjs +205 -131
- package/dist/next/config.cjs.map +1 -1
- package/dist/next/config.d.ts +7 -1
- package/dist/next/config.js +205 -131
- package/dist/next/config.js.map +1 -1
- package/dist/next/middleware.cjs +41 -32
- package/dist/next/middleware.cjs.map +1 -1
- package/dist/next/middleware.js +41 -32
- package/dist/next/middleware.js.map +1 -1
- package/dist/next/testing.cjs +41 -32
- package/dist/next/testing.cjs.map +1 -1
- package/dist/next/testing.d.ts +2 -2
- package/dist/next/testing.js +42 -33
- package/dist/next/testing.js.map +1 -1
- package/dist/utils/mfe-port.cjs +41 -32
- package/dist/utils/mfe-port.cjs.map +1 -1
- package/dist/utils/mfe-port.js +41 -32
- package/dist/utils/mfe-port.js.map +1 -1
- package/package.json +2 -1
package/dist/utils/mfe-port.js
CHANGED
|
@@ -240,16 +240,17 @@ var validateConfigPaths = (applicationConfigsById) => {
|
|
|
240
240
|
const maybeError = validatePathExpression(path6);
|
|
241
241
|
if (maybeError) {
|
|
242
242
|
errors.push(maybeError);
|
|
243
|
-
}
|
|
244
|
-
const existing = pathsByApplicationId.get(path6);
|
|
245
|
-
if (existing) {
|
|
246
|
-
existing.applications.push(id);
|
|
247
243
|
} else {
|
|
248
|
-
pathsByApplicationId.
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
244
|
+
const existing = pathsByApplicationId.get(path6);
|
|
245
|
+
if (existing) {
|
|
246
|
+
existing.applications.push(id);
|
|
247
|
+
} else {
|
|
248
|
+
pathsByApplicationId.set(path6, {
|
|
249
|
+
applications: [id],
|
|
250
|
+
matcher: pathToRegexp2(path6),
|
|
251
|
+
applicationId: id
|
|
252
|
+
});
|
|
253
|
+
}
|
|
253
254
|
}
|
|
254
255
|
}
|
|
255
256
|
}
|
|
@@ -289,26 +290,38 @@ var validateConfigPaths = (applicationConfigsById) => {
|
|
|
289
290
|
};
|
|
290
291
|
var PATH_DEFAULT_PATTERN = "[^\\/#\\?]+?";
|
|
291
292
|
function validatePathExpression(path6) {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
if (token
|
|
306
|
-
return `
|
|
293
|
+
try {
|
|
294
|
+
const tokens = parsePathRegexp(path6);
|
|
295
|
+
if (/(?<!\\)\{/.test(path6)) {
|
|
296
|
+
return `Optional paths are not supported: ${path6}`;
|
|
297
|
+
}
|
|
298
|
+
if (/(?<!\\|\()\?/.test(path6)) {
|
|
299
|
+
return `Optional paths are not supported: ${path6}`;
|
|
300
|
+
}
|
|
301
|
+
if (/\/[^/]*(?<!\\):[^/]*(?<!\\):[^/]*/.test(path6)) {
|
|
302
|
+
return `Only one wildcard is allowed per path segment: ${path6}`;
|
|
303
|
+
}
|
|
304
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
305
|
+
const token = tokens[i];
|
|
306
|
+
if (token === void 0) {
|
|
307
|
+
return `token ${i} in ${path6} is undefined, this shouldn't happen`;
|
|
307
308
|
}
|
|
308
|
-
if (token
|
|
309
|
-
|
|
309
|
+
if (typeof token !== "string") {
|
|
310
|
+
if (token.pattern !== PATH_DEFAULT_PATTERN && // Allows (a|b|c) and ((?!a|b|c).*) regex
|
|
311
|
+
// Only limited regex is supported for now, due to performance considerations
|
|
312
|
+
!/^(?<allowed>[\w]+(?:\|[^|()]+)+)$|^\(\?!(?<disallowed>[\w]+(?:\|[^|()]+)+)\)\.\*$/.test(
|
|
313
|
+
token.pattern
|
|
314
|
+
)) {
|
|
315
|
+
return `Path ${path6} cannot use unsupported regular expression wildcard`;
|
|
316
|
+
}
|
|
317
|
+
if (token.modifier && i !== tokens.length - 1) {
|
|
318
|
+
return `Modifier ${token.modifier} is not allowed on wildcard :${token.name} in ${path6}. Modifiers are only allowed in the last path component`;
|
|
319
|
+
}
|
|
310
320
|
}
|
|
311
321
|
}
|
|
322
|
+
} catch (e) {
|
|
323
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
324
|
+
return `Path ${path6} could not be parsed into regexp: ${message}`;
|
|
312
325
|
}
|
|
313
326
|
return void 0;
|
|
314
327
|
}
|
|
@@ -662,12 +675,8 @@ var MicrofrontendConfigIsomorphic = class {
|
|
|
662
675
|
const skipValidation = opts?.skipValidation ?? [];
|
|
663
676
|
const c = typeof config === "string" ? parse(config) : config;
|
|
664
677
|
if (isMainConfig(c)) {
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
}
|
|
668
|
-
if (!skipValidation.includes("defaultApplication")) {
|
|
669
|
-
validateConfigDefaultApplication(c.applications);
|
|
670
|
-
}
|
|
678
|
+
validateConfigPaths(c.applications);
|
|
679
|
+
validateConfigDefaultApplication(c.applications);
|
|
671
680
|
if (!skipValidation.includes("deprecatedFields")) {
|
|
672
681
|
validateDeprecatedFields(c);
|
|
673
682
|
}
|