@vercel/microfrontends 1.0.1-canary.1 → 1.0.1-canary.2
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 +41 -27
- package/dist/config.cjs +39 -26
- package/dist/config.cjs.map +1 -1
- package/dist/config.js +39 -26
- package/dist/config.js.map +1 -1
- package/dist/experimental/sveltekit.cjs +39 -26
- package/dist/experimental/sveltekit.cjs.map +1 -1
- package/dist/experimental/sveltekit.js +39 -26
- package/dist/experimental/sveltekit.js.map +1 -1
- package/dist/experimental/vite.cjs +39 -26
- package/dist/experimental/vite.cjs.map +1 -1
- package/dist/experimental/vite.js +39 -26
- package/dist/experimental/vite.js.map +1 -1
- package/dist/microfrontends/server.cjs +39 -26
- package/dist/microfrontends/server.cjs.map +1 -1
- package/dist/microfrontends/server.js +39 -26
- package/dist/microfrontends/server.js.map +1 -1
- package/dist/microfrontends.cjs +39 -26
- package/dist/microfrontends.cjs.map +1 -1
- package/dist/microfrontends.js +39 -26
- package/dist/microfrontends.js.map +1 -1
- package/dist/next/config.cjs +203 -125
- package/dist/next/config.cjs.map +1 -1
- package/dist/next/config.d.ts +7 -1
- package/dist/next/config.js +203 -125
- package/dist/next/config.js.map +1 -1
- package/dist/next/middleware.cjs +39 -26
- package/dist/next/middleware.cjs.map +1 -1
- package/dist/next/middleware.js +39 -26
- package/dist/next/middleware.js.map +1 -1
- package/dist/next/testing.cjs +39 -26
- package/dist/next/testing.cjs.map +1 -1
- package/dist/next/testing.d.ts +1 -1
- package/dist/next/testing.js +40 -27
- package/dist/next/testing.js.map +1 -1
- package/dist/utils/mfe-port.cjs +39 -26
- package/dist/utils/mfe-port.cjs.map +1 -1
- package/dist/utils/mfe-port.js +39 -26
- package/dist/utils/mfe-port.js.map +1 -1
- package/package.json +2 -1
|
@@ -241,16 +241,17 @@ var validateConfigPaths = (applicationConfigsById) => {
|
|
|
241
241
|
const maybeError = validatePathExpression(path5);
|
|
242
242
|
if (maybeError) {
|
|
243
243
|
errors.push(maybeError);
|
|
244
|
-
}
|
|
245
|
-
const existing = pathsByApplicationId.get(path5);
|
|
246
|
-
if (existing) {
|
|
247
|
-
existing.applications.push(id);
|
|
248
244
|
} else {
|
|
249
|
-
pathsByApplicationId.
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
245
|
+
const existing = pathsByApplicationId.get(path5);
|
|
246
|
+
if (existing) {
|
|
247
|
+
existing.applications.push(id);
|
|
248
|
+
} else {
|
|
249
|
+
pathsByApplicationId.set(path5, {
|
|
250
|
+
applications: [id],
|
|
251
|
+
matcher: pathToRegexp2(path5),
|
|
252
|
+
applicationId: id
|
|
253
|
+
});
|
|
254
|
+
}
|
|
254
255
|
}
|
|
255
256
|
}
|
|
256
257
|
}
|
|
@@ -290,26 +291,38 @@ var validateConfigPaths = (applicationConfigsById) => {
|
|
|
290
291
|
};
|
|
291
292
|
var PATH_DEFAULT_PATTERN = "[^\\/#\\?]+?";
|
|
292
293
|
function validatePathExpression(path5) {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
if (token
|
|
307
|
-
return `
|
|
294
|
+
try {
|
|
295
|
+
const tokens = parsePathRegexp(path5);
|
|
296
|
+
if (/(?<!\\)\{/.test(path5)) {
|
|
297
|
+
return `Optional paths are not supported: ${path5}`;
|
|
298
|
+
}
|
|
299
|
+
if (/(?<!\\|\()\?/.test(path5)) {
|
|
300
|
+
return `Optional paths are not supported: ${path5}`;
|
|
301
|
+
}
|
|
302
|
+
if (/\/[^/]*(?<!\\):[^/]*(?<!\\):[^/]*/.test(path5)) {
|
|
303
|
+
return `Only one wildcard is allowed per path segment: ${path5}`;
|
|
304
|
+
}
|
|
305
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
306
|
+
const token = tokens[i];
|
|
307
|
+
if (token === void 0) {
|
|
308
|
+
return `token ${i} in ${path5} is undefined, this shouldn't happen`;
|
|
308
309
|
}
|
|
309
|
-
if (token
|
|
310
|
-
|
|
310
|
+
if (typeof token !== "string") {
|
|
311
|
+
if (token.pattern !== PATH_DEFAULT_PATTERN && // Allows (a|b|c) and ((?!a|b|c).*) regex
|
|
312
|
+
// Only limited regex is supported for now, due to performance considerations
|
|
313
|
+
!/^(?<allowed>[\w]+(?:\|[^|()]+)+)$|^\(\?!(?<disallowed>[\w]+(?:\|[^|()]+)+)\)\.\*$/.test(
|
|
314
|
+
token.pattern
|
|
315
|
+
)) {
|
|
316
|
+
return `Path ${path5} cannot use unsupported regular expression wildcard`;
|
|
317
|
+
}
|
|
318
|
+
if (token.modifier && i !== tokens.length - 1) {
|
|
319
|
+
return `Modifier ${token.modifier} is not allowed on wildcard :${token.name} in ${path5}. Modifiers are only allowed in the last path component`;
|
|
320
|
+
}
|
|
311
321
|
}
|
|
312
322
|
}
|
|
323
|
+
} catch (e) {
|
|
324
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
325
|
+
return `Path ${path5} could not be parsed into regexp: ${message}`;
|
|
313
326
|
}
|
|
314
327
|
return void 0;
|
|
315
328
|
}
|