@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.
@@ -247,13 +247,9 @@ var validateConfigPaths = (applicationConfigsById) => {
247
247
  }
248
248
  for (const pathMatch of app.routing) {
249
249
  for (const path5 of pathMatch.paths) {
250
- const tokens = parsePathRegexp(path5);
251
- for (const token of tokens.slice(0, -1)) {
252
- if (typeof token !== "string") {
253
- errors.push(
254
- `Path ${path5} may only have a :wildcard in the last path component`
255
- );
256
- }
250
+ const maybeError = validatePathExpression(path5);
251
+ if (maybeError) {
252
+ errors.push(maybeError);
257
253
  }
258
254
  const existing = pathsByApplicationId.get(path5);
259
255
  if (existing) {
@@ -303,6 +299,31 @@ var validateConfigPaths = (applicationConfigsById) => {
303
299
  });
304
300
  }
305
301
  };
302
+ var PATH_DEFAULT_PATTERN = "[^\\/#\\?]+?";
303
+ function validatePathExpression(path5) {
304
+ const tokens = parsePathRegexp(path5);
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`;
309
+ }
310
+ if (typeof token !== "string") {
311
+ if (token.pattern !== PATH_DEFAULT_PATTERN) {
312
+ return `Path ${path5} cannot use a regular expression wildcard`;
313
+ }
314
+ if (token.prefix !== "/") {
315
+ return `Wildcard :${token.name} must be immediately after a / in ${path5}`;
316
+ }
317
+ if (token.suffix) {
318
+ return `Wildcard suffix on :${token.name} is not allowed. Suffixes are not supported`;
319
+ }
320
+ if (token.modifier && i !== tokens.length - 1) {
321
+ return `Modifier ${token.modifier} is not allowed on wildcard :${token.name} in ${path5}. Modifiers are only allowed in the last path component`;
322
+ }
323
+ }
324
+ }
325
+ return void 0;
326
+ }
306
327
  var validateAppPaths = (name, app) => {
307
328
  for (const group of app.routing) {
308
329
  for (const p of group.paths) {