@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
|
@@ -270,16 +270,17 @@ var validateConfigPaths = (applicationConfigsById) => {
|
|
|
270
270
|
const maybeError = validatePathExpression(path5);
|
|
271
271
|
if (maybeError) {
|
|
272
272
|
errors.push(maybeError);
|
|
273
|
-
}
|
|
274
|
-
const existing = pathsByApplicationId.get(path5);
|
|
275
|
-
if (existing) {
|
|
276
|
-
existing.applications.push(id);
|
|
277
273
|
} else {
|
|
278
|
-
pathsByApplicationId.
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
274
|
+
const existing = pathsByApplicationId.get(path5);
|
|
275
|
+
if (existing) {
|
|
276
|
+
existing.applications.push(id);
|
|
277
|
+
} else {
|
|
278
|
+
pathsByApplicationId.set(path5, {
|
|
279
|
+
applications: [id],
|
|
280
|
+
matcher: (0, import_path_to_regexp2.pathToRegexp)(path5),
|
|
281
|
+
applicationId: id
|
|
282
|
+
});
|
|
283
|
+
}
|
|
283
284
|
}
|
|
284
285
|
}
|
|
285
286
|
}
|
|
@@ -319,26 +320,38 @@ var validateConfigPaths = (applicationConfigsById) => {
|
|
|
319
320
|
};
|
|
320
321
|
var PATH_DEFAULT_PATTERN = "[^\\/#\\?]+?";
|
|
321
322
|
function validatePathExpression(path5) {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
if (token
|
|
336
|
-
return `
|
|
323
|
+
try {
|
|
324
|
+
const tokens = (0, import_path_to_regexp2.parse)(path5);
|
|
325
|
+
if (/(?<!\\)\{/.test(path5)) {
|
|
326
|
+
return `Optional paths are not supported: ${path5}`;
|
|
327
|
+
}
|
|
328
|
+
if (/(?<!\\|\()\?/.test(path5)) {
|
|
329
|
+
return `Optional paths are not supported: ${path5}`;
|
|
330
|
+
}
|
|
331
|
+
if (/\/[^/]*(?<!\\):[^/]*(?<!\\):[^/]*/.test(path5)) {
|
|
332
|
+
return `Only one wildcard is allowed per path segment: ${path5}`;
|
|
333
|
+
}
|
|
334
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
335
|
+
const token = tokens[i];
|
|
336
|
+
if (token === void 0) {
|
|
337
|
+
return `token ${i} in ${path5} is undefined, this shouldn't happen`;
|
|
337
338
|
}
|
|
338
|
-
if (token
|
|
339
|
-
|
|
339
|
+
if (typeof token !== "string") {
|
|
340
|
+
if (token.pattern !== PATH_DEFAULT_PATTERN && // Allows (a|b|c) and ((?!a|b|c).*) regex
|
|
341
|
+
// Only limited regex is supported for now, due to performance considerations
|
|
342
|
+
!/^(?<allowed>[\w]+(?:\|[^|()]+)+)$|^\(\?!(?<disallowed>[\w]+(?:\|[^|()]+)+)\)\.\*$/.test(
|
|
343
|
+
token.pattern
|
|
344
|
+
)) {
|
|
345
|
+
return `Path ${path5} cannot use unsupported regular expression wildcard`;
|
|
346
|
+
}
|
|
347
|
+
if (token.modifier && i !== tokens.length - 1) {
|
|
348
|
+
return `Modifier ${token.modifier} is not allowed on wildcard :${token.name} in ${path5}. Modifiers are only allowed in the last path component`;
|
|
349
|
+
}
|
|
340
350
|
}
|
|
341
351
|
}
|
|
352
|
+
} catch (e) {
|
|
353
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
354
|
+
return `Path ${path5} could not be parsed into regexp: ${message}`;
|
|
342
355
|
}
|
|
343
356
|
return void 0;
|
|
344
357
|
}
|
|
@@ -692,12 +705,8 @@ var MicrofrontendConfigIsomorphic = class {
|
|
|
692
705
|
const skipValidation = opts?.skipValidation ?? [];
|
|
693
706
|
const c = typeof config === "string" ? (0, import_jsonc_parser.parse)(config) : config;
|
|
694
707
|
if (isMainConfig(c)) {
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
}
|
|
698
|
-
if (!skipValidation.includes("defaultApplication")) {
|
|
699
|
-
validateConfigDefaultApplication(c.applications);
|
|
700
|
-
}
|
|
708
|
+
validateConfigPaths(c.applications);
|
|
709
|
+
validateConfigDefaultApplication(c.applications);
|
|
701
710
|
if (!skipValidation.includes("deprecatedFields")) {
|
|
702
711
|
validateDeprecatedFields(c);
|
|
703
712
|
}
|