@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.
Files changed (40) hide show
  1. package/dist/bin/cli.cjs +41 -27
  2. package/dist/config.cjs +39 -26
  3. package/dist/config.cjs.map +1 -1
  4. package/dist/config.js +39 -26
  5. package/dist/config.js.map +1 -1
  6. package/dist/experimental/sveltekit.cjs +39 -26
  7. package/dist/experimental/sveltekit.cjs.map +1 -1
  8. package/dist/experimental/sveltekit.js +39 -26
  9. package/dist/experimental/sveltekit.js.map +1 -1
  10. package/dist/experimental/vite.cjs +39 -26
  11. package/dist/experimental/vite.cjs.map +1 -1
  12. package/dist/experimental/vite.js +39 -26
  13. package/dist/experimental/vite.js.map +1 -1
  14. package/dist/microfrontends/server.cjs +39 -26
  15. package/dist/microfrontends/server.cjs.map +1 -1
  16. package/dist/microfrontends/server.js +39 -26
  17. package/dist/microfrontends/server.js.map +1 -1
  18. package/dist/microfrontends.cjs +39 -26
  19. package/dist/microfrontends.cjs.map +1 -1
  20. package/dist/microfrontends.js +39 -26
  21. package/dist/microfrontends.js.map +1 -1
  22. package/dist/next/config.cjs +203 -125
  23. package/dist/next/config.cjs.map +1 -1
  24. package/dist/next/config.d.ts +7 -1
  25. package/dist/next/config.js +203 -125
  26. package/dist/next/config.js.map +1 -1
  27. package/dist/next/middleware.cjs +39 -26
  28. package/dist/next/middleware.cjs.map +1 -1
  29. package/dist/next/middleware.js +39 -26
  30. package/dist/next/middleware.js.map +1 -1
  31. package/dist/next/testing.cjs +39 -26
  32. package/dist/next/testing.cjs.map +1 -1
  33. package/dist/next/testing.d.ts +1 -1
  34. package/dist/next/testing.js +40 -27
  35. package/dist/next/testing.js.map +1 -1
  36. package/dist/utils/mfe-port.cjs +39 -26
  37. package/dist/utils/mfe-port.cjs.map +1 -1
  38. package/dist/utils/mfe-port.js +39 -26
  39. package/dist/utils/mfe-port.js.map +1 -1
  40. package/package.json +2 -1
@@ -245,16 +245,17 @@ var validateConfigPaths = (applicationConfigsById) => {
245
245
  const maybeError = validatePathExpression(path5);
246
246
  if (maybeError) {
247
247
  errors.push(maybeError);
248
- }
249
- const existing = pathsByApplicationId.get(path5);
250
- if (existing) {
251
- existing.applications.push(id);
252
248
  } else {
253
- pathsByApplicationId.set(path5, {
254
- applications: [id],
255
- matcher: pathToRegexp2(path5),
256
- applicationId: id
257
- });
249
+ const existing = pathsByApplicationId.get(path5);
250
+ if (existing) {
251
+ existing.applications.push(id);
252
+ } else {
253
+ pathsByApplicationId.set(path5, {
254
+ applications: [id],
255
+ matcher: pathToRegexp2(path5),
256
+ applicationId: id
257
+ });
258
+ }
258
259
  }
259
260
  }
260
261
  }
@@ -294,26 +295,38 @@ var validateConfigPaths = (applicationConfigsById) => {
294
295
  };
295
296
  var PATH_DEFAULT_PATTERN = "[^\\/#\\?]+?";
296
297
  function validatePathExpression(path5) {
297
- const tokens = parsePathRegexp(path5);
298
- for (let i = 0; i < tokens.length; i++) {
299
- const token = tokens[i];
300
- if (token === void 0) {
301
- return `token ${i} in ${path5} is undefined, this shouldn't happen`;
302
- }
303
- if (typeof token !== "string") {
304
- if (token.pattern !== PATH_DEFAULT_PATTERN) {
305
- return `Path ${path5} cannot use a regular expression wildcard`;
306
- }
307
- if (token.prefix !== "/") {
308
- return `Wildcard :${token.name} must be immediately after a / in ${path5}`;
309
- }
310
- if (token.suffix) {
311
- return `Wildcard suffix on :${token.name} is not allowed. Suffixes are not supported`;
298
+ try {
299
+ const tokens = parsePathRegexp(path5);
300
+ if (/(?<!\\)\{/.test(path5)) {
301
+ return `Optional paths are not supported: ${path5}`;
302
+ }
303
+ if (/(?<!\\|\()\?/.test(path5)) {
304
+ return `Optional paths are not supported: ${path5}`;
305
+ }
306
+ if (/\/[^/]*(?<!\\):[^/]*(?<!\\):[^/]*/.test(path5)) {
307
+ return `Only one wildcard is allowed per path segment: ${path5}`;
308
+ }
309
+ for (let i = 0; i < tokens.length; i++) {
310
+ const token = tokens[i];
311
+ if (token === void 0) {
312
+ return `token ${i} in ${path5} is undefined, this shouldn't happen`;
312
313
  }
313
- if (token.modifier && i !== tokens.length - 1) {
314
- return `Modifier ${token.modifier} is not allowed on wildcard :${token.name} in ${path5}. Modifiers are only allowed in the last path component`;
314
+ if (typeof token !== "string") {
315
+ if (token.pattern !== PATH_DEFAULT_PATTERN && // Allows (a|b|c) and ((?!a|b|c).*) regex
316
+ // Only limited regex is supported for now, due to performance considerations
317
+ !/^(?<allowed>[\w]+(?:\|[^|()]+)+)$|^\(\?!(?<disallowed>[\w]+(?:\|[^|()]+)+)\)\.\*$/.test(
318
+ token.pattern
319
+ )) {
320
+ return `Path ${path5} cannot use unsupported regular expression wildcard`;
321
+ }
322
+ if (token.modifier && i !== tokens.length - 1) {
323
+ return `Modifier ${token.modifier} is not allowed on wildcard :${token.name} in ${path5}. Modifiers are only allowed in the last path component`;
324
+ }
315
325
  }
316
326
  }
327
+ } catch (e) {
328
+ const message = e instanceof Error ? e.message : String(e);
329
+ return `Path ${path5} could not be parsed into regexp: ${message}`;
317
330
  }
318
331
  return void 0;
319
332
  }