@vercel/microfrontends 0.15.0 → 0.17.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.
@@ -281,13 +281,9 @@ var validateConfigPaths = (applicationConfigsById) => {
281
281
  }
282
282
  for (const pathMatch of app.routing) {
283
283
  for (const path5 of pathMatch.paths) {
284
- const tokens = (0, import_path_to_regexp2.parse)(path5);
285
- for (const token of tokens.slice(0, -1)) {
286
- if (typeof token !== "string") {
287
- errors.push(
288
- `Path ${path5} may only have a :wildcard in the last path component`
289
- );
290
- }
284
+ const maybeError = validatePathExpression(path5);
285
+ if (maybeError) {
286
+ errors.push(maybeError);
291
287
  }
292
288
  const existing = pathsByApplicationId.get(path5);
293
289
  if (existing) {
@@ -337,6 +333,31 @@ var validateConfigPaths = (applicationConfigsById) => {
337
333
  });
338
334
  }
339
335
  };
336
+ var PATH_DEFAULT_PATTERN = "[^\\/#\\?]+?";
337
+ function validatePathExpression(path5) {
338
+ const tokens = (0, import_path_to_regexp2.parse)(path5);
339
+ for (let i = 0; i < tokens.length; i++) {
340
+ const token = tokens[i];
341
+ if (token === void 0) {
342
+ return `token ${i} in ${path5} is undefined, this shouldn't happen`;
343
+ }
344
+ if (typeof token !== "string") {
345
+ if (token.pattern !== PATH_DEFAULT_PATTERN) {
346
+ return `Path ${path5} cannot use a regular expression wildcard`;
347
+ }
348
+ if (token.prefix !== "/") {
349
+ return `Wildcard :${token.name} must be immediately after a / in ${path5}`;
350
+ }
351
+ if (token.suffix) {
352
+ return `Wildcard suffix on :${token.name} is not allowed. Suffixes are not supported`;
353
+ }
354
+ if (token.modifier && i !== tokens.length - 1) {
355
+ return `Modifier ${token.modifier} is not allowed on wildcard :${token.name} in ${path5}. Modifiers are only allowed in the last path component`;
356
+ }
357
+ }
358
+ }
359
+ return void 0;
360
+ }
340
361
  var validateAppPaths = (name, app) => {
341
362
  for (const group of app.routing) {
342
363
  for (const p of group.paths) {