@vercel/microfrontends 0.9.0 → 0.10.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.
Files changed (78) hide show
  1. package/README.md +2 -2
  2. package/dist/bin/cli.cjs +1483 -186
  3. package/dist/config/edge.cjs +47 -47
  4. package/dist/config/edge.cjs.map +1 -1
  5. package/dist/config/edge.d.ts +6 -6
  6. package/dist/config/edge.js +46 -46
  7. package/dist/config/edge.js.map +1 -1
  8. package/dist/config.cjs +66 -60
  9. package/dist/config.cjs.map +1 -1
  10. package/dist/config.d.ts +3 -3
  11. package/dist/config.js +65 -59
  12. package/dist/config.js.map +1 -1
  13. package/dist/{index-eff254d8.d.ts → index-05742bef.d.ts} +11 -22
  14. package/dist/{micro-frontend-config-42886104.d.ts → microfrontend-config-2425db74.d.ts} +12 -12
  15. package/dist/next/config.cjs +83 -77
  16. package/dist/next/config.cjs.map +1 -1
  17. package/dist/next/config.d.ts +3 -3
  18. package/dist/next/config.js +82 -76
  19. package/dist/next/config.js.map +1 -1
  20. package/dist/next/middleware.cjs +55 -55
  21. package/dist/next/middleware.cjs.map +1 -1
  22. package/dist/next/middleware.d.ts +11 -11
  23. package/dist/next/middleware.js +53 -53
  24. package/dist/next/middleware.js.map +1 -1
  25. package/dist/next/testing.cjs +79 -73
  26. package/dist/next/testing.cjs.map +1 -1
  27. package/dist/next/testing.d.ts +9 -9
  28. package/dist/next/testing.js +79 -73
  29. package/dist/next/testing.js.map +1 -1
  30. package/dist/overrides.cjs +9 -9
  31. package/dist/overrides.cjs.map +1 -1
  32. package/dist/overrides.d.ts +1 -1
  33. package/dist/overrides.js +9 -9
  34. package/dist/overrides.js.map +1 -1
  35. package/dist/types-13f3e535.d.ts +15 -0
  36. package/dist/v2/config.cjs +39 -39
  37. package/dist/v2/config.cjs.map +1 -1
  38. package/dist/v2/config.d.ts +2 -1
  39. package/dist/v2/config.js +38 -38
  40. package/dist/v2/config.js.map +1 -1
  41. package/dist/v2/microfrontends/server.cjs +102 -65
  42. package/dist/v2/microfrontends/server.cjs.map +1 -1
  43. package/dist/v2/microfrontends/server.d.ts +6 -1
  44. package/dist/v2/microfrontends/server.js +102 -65
  45. package/dist/v2/microfrontends/server.js.map +1 -1
  46. package/dist/v2/microfrontends.cjs +44 -44
  47. package/dist/v2/microfrontends.cjs.map +1 -1
  48. package/dist/v2/microfrontends.d.ts +5 -4
  49. package/dist/v2/microfrontends.js +44 -44
  50. package/dist/v2/microfrontends.js.map +1 -1
  51. package/dist/v2/next/client.cjs +1 -1
  52. package/dist/v2/next/client.cjs.map +1 -1
  53. package/dist/v2/next/client.js +1 -1
  54. package/dist/v2/next/client.js.map +1 -1
  55. package/dist/v2/next/config.cjs +120 -83
  56. package/dist/v2/next/config.cjs.map +1 -1
  57. package/dist/v2/next/config.d.ts +4 -4
  58. package/dist/v2/next/config.js +119 -82
  59. package/dist/v2/next/config.js.map +1 -1
  60. package/dist/v2/next/endpoints.cjs +5 -5
  61. package/dist/v2/next/endpoints.cjs.map +1 -1
  62. package/dist/v2/next/endpoints.js +5 -5
  63. package/dist/v2/next/endpoints.js.map +1 -1
  64. package/dist/v2/next/middleware.cjs +54 -54
  65. package/dist/v2/next/middleware.cjs.map +1 -1
  66. package/dist/v2/next/middleware.d.ts +8 -8
  67. package/dist/v2/next/middleware.js +52 -52
  68. package/dist/v2/next/middleware.js.map +1 -1
  69. package/dist/v2/overrides.cjs +75 -0
  70. package/dist/v2/overrides.cjs.map +1 -0
  71. package/dist/v2/overrides.d.ts +24 -0
  72. package/dist/v2/overrides.js +45 -0
  73. package/dist/v2/overrides.js.map +1 -0
  74. package/dist/validation.cjs +20 -20
  75. package/dist/validation.cjs.map +1 -1
  76. package/dist/validation.js +20 -20
  77. package/dist/validation.js.map +1 -1
  78. package/package.json +10 -3
@@ -30,14 +30,14 @@ var import_jsonc_parser = require("jsonc-parser");
30
30
  var import_ajv = require("ajv");
31
31
 
32
32
  // src/config/errors.ts
33
- var MicroFrontendError = class extends Error {
33
+ var MicrofrontendError = class extends Error {
34
34
  constructor(message, opts) {
35
35
  super(message);
36
- this.name = "MicroFrontendsError";
37
- this.source = (opts == null ? void 0 : opts.source) ?? "@vercel/micro-frontends";
36
+ this.name = "MicrofrontendsError";
37
+ this.source = (opts == null ? void 0 : opts.source) ?? "@vercel/microfrontends";
38
38
  this.type = (opts == null ? void 0 : opts.type) ?? "unknown";
39
39
  this.subtype = opts == null ? void 0 : opts.subtype;
40
- Error.captureStackTrace(this, MicroFrontendError);
40
+ Error.captureStackTrace(this, MicrofrontendError);
41
41
  }
42
42
  isKnown() {
43
43
  return this.type !== "unknown";
@@ -46,13 +46,13 @@ var MicroFrontendError = class extends Error {
46
46
  return !this.isKnown();
47
47
  }
48
48
  /**
49
- * Converts an error to a MicroFrontendsError.
49
+ * Converts an error to a MicrofrontendsError.
50
50
  * @param original - The original error to convert.
51
- * @returns The converted MicroFrontendsError.
51
+ * @returns The converted MicrofrontendsError.
52
52
  */
53
53
  static convert(original, opts) {
54
54
  if (opts == null ? void 0 : opts.fileName) {
55
- const err = MicroFrontendError.convertFSError(original, opts.fileName);
55
+ const err = MicrofrontendError.convertFSError(original, opts.fileName);
56
56
  if (err) {
57
57
  return err;
58
58
  }
@@ -60,25 +60,25 @@ var MicroFrontendError = class extends Error {
60
60
  if (original.message.includes(
61
61
  "Code generation from strings disallowed for this context"
62
62
  )) {
63
- return new MicroFrontendError(original.message, {
63
+ return new MicrofrontendError(original.message, {
64
64
  type: "config",
65
65
  subtype: "unsupported_validation_env",
66
66
  source: "ajv"
67
67
  });
68
68
  }
69
- return new MicroFrontendError(original.message);
69
+ return new MicrofrontendError(original.message);
70
70
  }
71
71
  static convertFSError(original, fileName) {
72
72
  if (original instanceof Error && "code" in original) {
73
73
  if (original.code === "ENOENT") {
74
- return new MicroFrontendError(`Could not find "${fileName}"`, {
74
+ return new MicrofrontendError(`Could not find "${fileName}"`, {
75
75
  type: "config",
76
76
  subtype: "unable_to_read_file",
77
77
  source: "fs"
78
78
  });
79
79
  }
80
80
  if (original.code === "EACCES") {
81
- return new MicroFrontendError(
81
+ return new MicrofrontendError(
82
82
  `Permission denied while accessing "${fileName}"`,
83
83
  {
84
84
  type: "config",
@@ -89,7 +89,7 @@ var MicroFrontendError = class extends Error {
89
89
  }
90
90
  }
91
91
  if (original instanceof SyntaxError) {
92
- return new MicroFrontendError(
92
+ return new MicrofrontendError(
93
93
  `Failed to parse "${fileName}": Invalid JSON format.`,
94
94
  {
95
95
  type: "config",
@@ -101,23 +101,23 @@ var MicroFrontendError = class extends Error {
101
101
  return null;
102
102
  }
103
103
  /**
104
- * Handles an unknown error and returns a MicroFrontendsError instance.
104
+ * Handles an unknown error and returns a MicrofrontendsError instance.
105
105
  * @param err - The error to handle.
106
- * @returns A MicroFrontendsError instance.
106
+ * @returns A MicrofrontendsError instance.
107
107
  */
108
108
  static handle(err, opts) {
109
- if (err instanceof MicroFrontendError) {
109
+ if (err instanceof MicrofrontendError) {
110
110
  return err;
111
111
  }
112
112
  if (err instanceof Error) {
113
- return MicroFrontendError.convert(err, opts);
113
+ return MicrofrontendError.convert(err, opts);
114
114
  }
115
115
  if (typeof err === "object" && err !== null) {
116
116
  if ("message" in err && typeof err.message === "string") {
117
- return MicroFrontendError.convert(new Error(err.message), opts);
117
+ return MicrofrontendError.convert(new Error(err.message), opts);
118
118
  }
119
119
  }
120
- return new MicroFrontendError("An unknown error occurred");
120
+ return new MicrofrontendError("An unknown error occurred");
121
121
  }
122
122
  };
123
123
 
@@ -395,7 +395,7 @@ function validateSchema(configString) {
395
395
  const validate = ajv.compile(SCHEMA);
396
396
  const isValid = validate(parsedConfig);
397
397
  if (!isValid) {
398
- throw new MicroFrontendError(
398
+ throw new MicrofrontendError(
399
399
  `Invalid config: ${ajv.errorsText(validate.errors)}`,
400
400
  { type: "config", subtype: "does_not_match_schema" }
401
401
  );
@@ -739,7 +739,7 @@ var validateSchema2 = (configString) => {
739
739
  const validate = ajv.compile(SCHEMA2);
740
740
  const isValid = validate(parsedConfig);
741
741
  if (!isValid) {
742
- throw new MicroFrontendError(
742
+ throw new MicrofrontendError(
743
743
  `Invalid config: ${ajv.errorsText(validate.errors)}`,
744
744
  { type: "config", subtype: "does_not_match_schema" }
745
745
  );
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/schema/validation.ts","../src/config-v2/microfrontends/server/validation.ts","../src/config/errors.ts","../schema/schema-v2.json","../src/config-v2/schema/utils/load.ts","../src/config/validation.ts","../schema/schema.json","../src/config/utils/load-schema.ts"],"sourcesContent":["export { validateSchema as validateV2Schema } from '../config-v2/microfrontends/server/validation';\nexport { validateSchema as validateV1Schema } from '../config/validation';\n","import { parse } from 'jsonc-parser';\nimport { Ajv } from 'ajv';\nimport type { Config } from '../../schema/types';\nimport { MicroFrontendError } from '../../../config/errors';\nimport { SCHEMA } from '../../schema/utils/load';\n\nexport function validateSchema(configString: string): Config {\n const parsedConfig = parse(configString) as Config;\n const ajv = new Ajv();\n const validate = ajv.compile(SCHEMA);\n const isValid = validate(parsedConfig);\n if (!isValid) {\n throw new MicroFrontendError(\n `Invalid config: ${ajv.errorsText(validate.errors)}`,\n { type: 'config', subtype: 'does_not_match_schema' },\n );\n }\n return parsedConfig;\n}\n","export type MicroFrontendErrorType =\n | 'config'\n | 'packageJson'\n | 'vercelJson'\n | 'zone'\n | 'unknown';\n\nexport type MicroFrontendErrorSubtype =\n | 'not_found'\n | 'not_found_in_env'\n | 'invalid_asset_prefix'\n | 'invalid_main_path'\n | 'does_not_match_schema'\n | 'unable_to_read_file'\n | 'unsupported_validation_env'\n | 'unsupported_version'\n | 'invalid_path'\n | 'invalid_permissions'\n | 'invalid_syntax'\n | 'missing_microFrontend_config_path'\n | 'unsupported_operation';\n\n// A mapping of error types to their subtypes.\ninterface TypeToSubtype {\n zone:\n | 'invalid_asset_prefix'\n | 'invalid_path'\n | 'multiple_package_managers'\n | 'not_found';\n config:\n | 'conflicting_paths'\n | 'does_not_match_schema'\n | 'invalid_main_path'\n | 'invalid_preview_deployment_suffix'\n | 'multiple_default_applications'\n | 'no_default_application'\n | 'not_found_in_env'\n | 'not_found'\n | 'unable_to_read_file'\n | 'invalid_syntax'\n | 'invalid_permissions'\n | 'unsupported_operation'\n | 'unsupported_validation_env'\n | 'unsupported_version';\n packageJson:\n | 'missing_field_name'\n | 'unable_to_read_file'\n | 'invalid_permissions'\n | 'invalid_syntax';\n vercelJson:\n | 'missing_field_microFrontend_config_path'\n | 'unable_to_read_file'\n | 'invalid_permissions'\n | 'invalid_syntax';\n unknown: never;\n}\n\nexport type MicroFrontendErrorSource =\n | '@vercel/micro-frontends'\n | '@vercel/micro-frontends/next'\n | 'fs'\n | 'ajv';\n\nexport interface MicroFrontendErrorOptions<T extends MicroFrontendErrorType> {\n source?: MicroFrontendErrorSource;\n type?: T;\n subtype?: TypeToSubtype[T];\n}\n\ninterface HandleOptions {\n fileName?: string;\n}\n\nexport class MicroFrontendError<\n T extends MicroFrontendErrorType = 'unknown',\n> extends Error {\n public source: MicroFrontendErrorSource;\n public type: T;\n public subtype?: TypeToSubtype[T];\n\n constructor(message: string, opts?: MicroFrontendErrorOptions<T>) {\n super(message);\n this.name = 'MicroFrontendsError';\n this.source = opts?.source ?? '@vercel/micro-frontends';\n this.type = opts?.type ?? ('unknown' as T);\n this.subtype = opts?.subtype;\n Error.captureStackTrace(this, MicroFrontendError);\n }\n\n isKnown(): boolean {\n return this.type !== 'unknown';\n }\n\n isUnknown(): boolean {\n return !this.isKnown();\n }\n\n /**\n * Converts an error to a MicroFrontendsError.\n * @param original - The original error to convert.\n * @returns The converted MicroFrontendsError.\n */\n static convert(\n original: Error,\n opts?: HandleOptions,\n ): MicroFrontendError<MicroFrontendErrorType> {\n if (opts?.fileName) {\n const err = MicroFrontendError.convertFSError(original, opts.fileName);\n if (err) {\n return err;\n }\n }\n\n if (\n original.message.includes(\n 'Code generation from strings disallowed for this context',\n )\n ) {\n return new MicroFrontendError(original.message, {\n type: 'config',\n subtype: 'unsupported_validation_env',\n source: 'ajv',\n });\n }\n\n // unknown catch-all\n return new MicroFrontendError(original.message);\n }\n\n static convertFSError(\n original: Error,\n fileName: string,\n ): MicroFrontendError<MicroFrontendErrorType> | null {\n if (original instanceof Error && 'code' in original) {\n if (original.code === 'ENOENT') {\n return new MicroFrontendError(`Could not find \"${fileName}\"`, {\n type: 'config',\n subtype: 'unable_to_read_file',\n source: 'fs',\n });\n }\n if (original.code === 'EACCES') {\n return new MicroFrontendError(\n `Permission denied while accessing \"${fileName}\"`,\n {\n type: 'config',\n subtype: 'invalid_permissions',\n source: 'fs',\n },\n );\n }\n }\n\n if (original instanceof SyntaxError) {\n return new MicroFrontendError(\n `Failed to parse \"${fileName}\": Invalid JSON format.`,\n {\n type: 'config',\n subtype: 'invalid_syntax',\n source: 'fs',\n },\n );\n }\n\n return null;\n }\n\n /**\n * Handles an unknown error and returns a MicroFrontendsError instance.\n * @param err - The error to handle.\n * @returns A MicroFrontendsError instance.\n */\n static handle(\n err: unknown,\n opts?: HandleOptions,\n ): MicroFrontendError<MicroFrontendErrorType> {\n if (err instanceof MicroFrontendError) {\n return err as MicroFrontendError<MicroFrontendErrorType>;\n }\n\n // handle Error instances\n if (err instanceof Error) {\n return MicroFrontendError.convert(err, opts);\n }\n\n // handle object errors\n if (typeof err === 'object' && err !== null) {\n if ('message' in err && typeof err.message === 'string') {\n return MicroFrontendError.convert(new Error(err.message), opts);\n }\n }\n\n return new MicroFrontendError('An unknown error occurred');\n }\n}\n","{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$ref\": \"#/definitions/Config\",\n \"definitions\": {\n \"Config\": {\n \"anyOf\": [\n {\n \"$ref\": \"#/definitions/MainConfig\"\n },\n {\n \"$ref\": \"#/definitions/ChildConfig\"\n }\n ]\n },\n \"MainConfig\": {\n \"type\": \"object\",\n \"properties\": {\n \"$schema\": {\n \"type\": \"string\"\n },\n \"version\": {\n \"type\": \"string\",\n \"const\": \"2\"\n },\n \"options\": {\n \"$ref\": \"#/definitions/Options\"\n },\n \"remotes\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/Application\"\n },\n \"description\": \"Applications that only serve a subset of the microfrontend routes only need to reference the name of the primary application that owns the full microfrontends configuration.\"\n },\n \"provider\": {\n \"$ref\": \"#/definitions/Provider\"\n },\n \"applications\": {\n \"$ref\": \"#/definitions/ApplicationRouting\",\n \"description\": \"Mapping of application names to the routes that they host. Only needs to be defined in the application that owns the primary microfrontend domain\"\n }\n },\n \"required\": [\"applications\", \"provider\", \"version\"]\n },\n \"Options\": {\n \"type\": \"object\",\n \"properties\": {\n \"vercel\": {\n \"$ref\": \"#/definitions/VercelOptions\",\n \"description\": \"Micro-Frontends wide options for Vercel.\"\n },\n \"localProxy\": {\n \"$ref\": \"#/definitions/LocalProxyOptions\",\n \"description\": \"Options for local proxy.\"\n }\n }\n },\n \"VercelOptions\": {\n \"type\": \"object\",\n \"properties\": {\n \"previewDeploymentSuffix\": {\n \"type\": \"string\",\n \"description\": \"If your team uses a custom Preview Deployment Suffix, please specify it here. See https://vercel.com/docs/deployments/preview-deployment-suffix. The default is `vercel.app`.\"\n },\n \"teamSlug\": {\n \"type\": \"string\",\n \"description\": \"Team slug for the Vercel team\"\n },\n \"disableOverrides\": {\n \"type\": \"boolean\",\n \"description\": \"If you want to disable the overrides for the site. For example, if you are managing rewrites between applications externally, you may wish to disable the overrides on the toolbar as they will have no effect.\"\n }\n }\n },\n \"LocalProxyOptions\": {\n \"type\": \"object\",\n \"properties\": {\n \"port\": {\n \"type\": \"number\",\n \"description\": \"The port number used by the local proxy server.\\n\\nThe default is `3024`.\"\n }\n }\n },\n \"Application\": {\n \"anyOf\": [\n {\n \"$ref\": \"#/definitions/DefaultApplication\"\n },\n {\n \"$ref\": \"#/definitions/ChildApplication\"\n }\n ]\n },\n \"DefaultApplication\": {\n \"type\": \"object\",\n \"properties\": {\n \"vercel\": {\n \"$ref\": \"#/definitions/Vercel\"\n },\n \"development\": {\n \"$ref\": \"#/definitions/Development\"\n },\n \"production\": {\n \"$ref\": \"#/definitions/HostConfig\"\n }\n },\n \"required\": [\"production\"]\n },\n \"Vercel\": {\n \"type\": \"object\",\n \"properties\": {\n \"projectId\": {\n \"type\": \"string\",\n \"description\": \"Vercel project ID\"\n },\n \"routeSpeedInsightsToDefaultZone\": {\n \"type\": \"boolean\"\n }\n },\n \"required\": [\"projectId\"]\n },\n \"Development\": {\n \"type\": \"object\",\n \"properties\": {\n \"local\": {\n \"$ref\": \"#/definitions/LocalHostConfig\"\n },\n \"fallback\": {\n \"$ref\": \"#/definitions/HostConfig\",\n \"description\": \"Fallback for local development, could be a host config that points to any environment. If this is not provided, or the application is not running - requests to the application in local development will error.\"\n },\n \"task\": {\n \"type\": \"string\",\n \"description\": \"Optional task to run when starting the development server. Should reference a script in the package.json of the application.\"\n }\n }\n },\n \"LocalHostConfig\": {\n \"type\": \"object\",\n \"properties\": {\n \"host\": {\n \"type\": \"string\",\n \"description\": \"The hostname or IP address of the server. This can be a domain name (e.g., `example.com`) or an IP address (e.g., `192.168.1.1`).\"\n },\n \"protocol\": {\n \"type\": \"string\",\n \"enum\": [\"http\", \"https\"],\n \"description\": \"The protocol to be used for the connection.\\n- `http`: Hypertext Transfer Protocol (HTTP).\\n- `https`: Secure Hypertext Transfer Protocol (HTTPS).\\n\\n* @defaultValue \\\"http\\\" for local development, \\\"https\\\" for otherwise\"\n },\n \"port\": {\n \"type\": \"number\",\n \"description\": \"The port number to be used for the connection. Common values include `80` for HTTP and `443` for HTTPS.\"\n }\n }\n },\n \"HostConfig\": {\n \"type\": \"object\",\n \"properties\": {\n \"protocol\": {\n \"type\": \"string\",\n \"enum\": [\"http\", \"https\"],\n \"description\": \"The protocol to be used for the connection.\\n- `http`: Hypertext Transfer Protocol (HTTP).\\n- `https`: Secure Hypertext Transfer Protocol (HTTPS).\\n\\n* @defaultValue \\\"http\\\" for local development, \\\"https\\\" for otherwise\"\n },\n \"host\": {\n \"type\": \"string\",\n \"description\": \"The hostname or IP address of the server. This can be a domain name (e.g., `example.com`) or an IP address (e.g., `192.168.1.1`).\"\n },\n \"port\": {\n \"type\": \"number\",\n \"description\": \"The port number to be used for the connection. Common values include `80` for HTTP and `443` for HTTPS.\"\n }\n },\n \"required\": [\"host\"]\n },\n \"ChildApplication\": {\n \"type\": \"object\",\n \"properties\": {\n \"vercel\": {\n \"$ref\": \"#/definitions/Vercel\"\n },\n \"development\": {\n \"$ref\": \"#/definitions/Development\"\n },\n \"routing\": {\n \"$ref\": \"#/definitions/Routing\",\n \"description\": \"Groups of path expressions that are routed to this application.\"\n },\n \"production\": {\n \"$ref\": \"#/definitions/HostConfig\"\n }\n },\n \"required\": [\"routing\"]\n },\n \"Routing\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/definitions/PathGroup\"\n }\n },\n \"PathGroup\": {\n \"type\": \"object\",\n \"properties\": {\n \"group\": {\n \"type\": \"string\",\n \"description\": \"Optional group name for the paths\"\n },\n \"flag\": {\n \"type\": \"string\",\n \"description\": \"flag name that can be used to enable/disable all paths in the group\"\n },\n \"routeToDefaultApplication\": {\n \"type\": \"boolean\",\n \"description\": \"True to route the request to the default application for this micro-frontends set-up. This must be `true` when using `flag` or when you want to use custom logic to make the routing decision for this group of paths.\"\n },\n \"paths\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n },\n \"required\": [\"paths\"]\n },\n \"Provider\": {\n \"type\": \"string\",\n \"enum\": [\"vercel\", \"other\"]\n },\n \"ApplicationRouting\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/Application\"\n }\n },\n \"ChildConfig\": {\n \"type\": \"object\",\n \"properties\": {\n \"$schema\": {\n \"type\": \"string\"\n },\n \"version\": {\n \"type\": \"string\",\n \"const\": \"2\"\n },\n \"options\": {\n \"$ref\": \"#/definitions/Options\"\n },\n \"remotes\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/Application\"\n },\n \"description\": \"Applications that only serve a subset of the microfrontend routes only need to reference the name of the primary application that owns the full microfrontends configuration.\"\n },\n \"partOf\": {\n \"type\": \"string\",\n \"description\": \"Applications that only serve a subset of the microfrontend routes only need to reference the name of the primary application that owns the full microfrontends configuration.\"\n }\n },\n \"required\": [\"partOf\", \"version\"]\n }\n }\n}\n","import type { JSONSchema7 } from 'json-schema';\nimport jsonSchema from '../../../../schema/schema-v2.json';\n\nexport const SCHEMA = jsonSchema as JSONSchema7;\n","import { parse } from 'jsonc-parser';\nimport { pathToRegexp, parse as parsePathRegexp } from 'path-to-regexp';\nimport { Ajv } from 'ajv';\nimport type {\n Config,\n ApplicationId,\n PathGroup,\n ApplicationConfigsById,\n Options,\n} from './schema';\nimport { isDefaultApplicationConfig } from './types';\nimport { MicroFrontendError } from './errors';\nimport { SCHEMA } from './utils/load-schema';\n\nexport const validateSchema = (configString: string): Config => {\n const parsedConfig = parse(configString) as Config;\n const ajv = new Ajv();\n const validate = ajv.compile(SCHEMA);\n const isValid = validate(parsedConfig);\n if (!isValid) {\n throw new MicroFrontendError(\n `Invalid config: ${ajv.errorsText(validate.errors)}`,\n { type: 'config', subtype: 'does_not_match_schema' },\n );\n }\n return parsedConfig;\n};\n\nconst SUPPORTED_VERSIONS = ['1'];\n\nexport const validateVersion = (version: string): void => {\n if (!SUPPORTED_VERSIONS.includes(version)) {\n throw new MicroFrontendError(\n `Unsupported version: ${version}. Supported versions are: ${SUPPORTED_VERSIONS.join(\n ', ',\n )}`,\n { type: 'config', subtype: 'unsupported_version' },\n );\n }\n};\n\nexport function validateMainPath(\n applicationConfigsById: ApplicationConfigsById,\n): void {\n for (const [id, app] of Object.entries(applicationConfigsById)) {\n const { defaultRoute } = app.vercel ?? {};\n if (!defaultRoute) {\n continue;\n }\n\n if (isDefaultApplicationConfig(app)) {\n // the defaultRoute for the default application can't match any other applications routes\n const pathsWithApp = [];\n for (const [otherId, otherApp] of Object.entries(\n applicationConfigsById,\n )) {\n if (isDefaultApplicationConfig(otherApp)) {\n continue;\n }\n pathsWithApp.push({\n id: otherId,\n paths: otherApp.routing.matches.flatMap((match) => match.paths),\n });\n }\n\n for (const { id: otherId, paths } of pathsWithApp) {\n const isValid = paths.every((path) => {\n const matcher = pathToRegexp(path);\n return !matcher.test(defaultRoute);\n });\n\n if (!isValid) {\n throw new MicroFrontendError(\n `default route \"${defaultRoute}\" cannot be used for \"${id}\" because it is matched by \"${otherId}\"`,\n { type: 'config', subtype: 'invalid_main_path' },\n );\n }\n }\n // the defaultRoute for a non-default application has to match one of its own paths\n } else {\n const allPaths = app.routing.matches.flatMap((match) => match.paths);\n const isValid = allPaths.some((path) => {\n const matcher = pathToRegexp(path);\n return matcher.test(defaultRoute);\n });\n\n if (!isValid) {\n throw new MicroFrontendError(\n `default route \"${defaultRoute}\" is not included by the routing config for application \"${id}\"`,\n { type: 'config', subtype: 'invalid_main_path' },\n );\n }\n }\n }\n}\n\nexport const validatePaths = (\n applicationConfigsById: ApplicationConfigsById,\n): void => {\n const pathsByApplicationId = new Map<\n PathGroup['paths'][number],\n {\n applications: ApplicationId[];\n matcher: RegExp;\n applicationId?: ApplicationId;\n }\n >();\n const errors: string[] = [];\n\n for (const [id, app] of Object.entries(applicationConfigsById)) {\n if (isDefaultApplicationConfig(app)) {\n // default applications do not have routing\n continue;\n }\n\n for (const pathMatch of app.routing.matches) {\n for (const path of pathMatch.paths) {\n const maybeError = validatePathExpression(path);\n if (maybeError) {\n errors.push(maybeError);\n }\n\n const existing = pathsByApplicationId.get(path);\n if (existing) {\n existing.applications.push(id);\n } else {\n pathsByApplicationId.set(path, {\n applications: [id],\n matcher: pathToRegexp(path),\n applicationId: id,\n });\n }\n }\n }\n }\n const entries = Array.from(pathsByApplicationId.entries());\n\n entries.forEach(([path, { applications: ids, matcher, applicationId }]) => {\n if (ids.length > 1) {\n errors.push(\n `Duplicate path \"${path}\" for applications \"${ids.join(', ')}\"`,\n );\n }\n\n entries.forEach(\n ([\n matchPath,\n { applications: matchIds, applicationId: matchApplicationId },\n ]) => {\n if (path === matchPath) {\n // we're comparing to ourselves, so skip\n return;\n }\n\n if (applicationId === matchApplicationId) {\n // we're comparing to paths within our own application, which are allowed to overlap, so skip\n return;\n }\n\n if (matcher.test(matchPath)) {\n const source = `\"${path}\" of application${ids.length > 0 ? 's' : ''} ${ids.join(', ')}`;\n const destination = `\"${matchPath}\" of application${matchIds.length > 0 ? 's' : ''} ${matchIds.join(', ')}`;\n\n errors.push(\n `Overlapping path detected between ${source} and ${destination}`,\n );\n }\n },\n );\n });\n\n if (errors.length) {\n throw new MicroFrontendError(`Invalid paths: ${errors.join(', ')}`, {\n type: 'config',\n subtype: 'conflicting_paths',\n });\n }\n};\n\n// From https://github.com/pillarjs/path-to-regexp/blob/b0778f5e8e6c6e9ee4e2f5b34e877cc5229f8036/src/index.ts#L143\nconst PATH_DEFAULT_PATTERN = '[^\\\\/#\\\\?]+?';\n\n// This is a copy of https://github.com/vercel/api/blob/main/scripts/build-container/src/utils/upload-micro-frontend-configuration.ts\n// and should be kept in sync.\nfunction validatePathExpression(path: string): string | undefined {\n const tokens = parsePathRegexp(path);\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i];\n if (token === undefined) {\n return `token ${i} in ${path} is undefined, this shouldn't happen`;\n }\n if (typeof token !== 'string') {\n if (token.pattern !== PATH_DEFAULT_PATTERN) {\n return `Path ${path} cannot use a regular expression wildcard`;\n }\n if (token.prefix !== '/') {\n return `Wildcard :${token.name} must be immediately after a / in ${path}`;\n }\n if (token.suffix) {\n return `Wildcard suffix on :${token.name} is not allowed. Suffixes are not supported`;\n }\n if (token.modifier && i !== tokens.length - 1) {\n return `Modifier ${token.modifier} is not allowed on wildcard :${token.name} in ${path}. Modifiers are only allowed in the last path component`;\n }\n }\n }\n return undefined;\n}\n\n/** make sure there is exactly one default `Application` */\nexport const validateDefaults = (\n applicationConfigsById: ApplicationConfigsById,\n): void => {\n const defaultApplicationIds = Object.entries(applicationConfigsById).reduce<\n string[]\n // biome-ignore lint/performance/noAccumulatingSpread: Ignored using `--suppress`\n >((acc, [id, app]) => (app.default ? [...acc, id] : acc), []);\n\n if (defaultApplicationIds.length === 0) {\n throw new MicroFrontendError(\n `No default application found. At least one application must be marked as default.`,\n { type: 'config', subtype: 'no_default_application' },\n );\n }\n\n if (defaultApplicationIds.length > 1) {\n throw new MicroFrontendError(\n `Only one default application is allowed. Found ${defaultApplicationIds.join(', ')}.`,\n { type: 'config', subtype: 'multiple_default_applications' },\n );\n }\n};\n\nexport const validateOptions = (options?: Options): void => {\n if (options?.vercel?.previewDeploymentSuffix) {\n if (\n !/^[a-zA-Z]{2,}\\.[a-zA-Z]{2,}$/.test(\n options.vercel.previewDeploymentSuffix,\n )\n ) {\n throw new MicroFrontendError(\n `Invalid preview deployment suffix: ${options.vercel.previewDeploymentSuffix}. Should have be formatted like \"vercel.app\".`,\n { type: 'config', subtype: 'invalid_preview_deployment_suffix' },\n );\n }\n }\n};\n","{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$ref\": \"#/definitions/Config\",\n \"definitions\": {\n \"Config\": {\n \"type\": \"object\",\n \"properties\": {\n \"version\": {\n \"type\": \"string\"\n },\n \"$schema\": {\n \"type\": \"string\"\n },\n \"name\": {\n \"type\": \"string\",\n \"description\": \"Name for the micro-frontend site (eg. \\\"vercel.com\\\", \\\"vercel-site\\\" etc.).\"\n },\n \"applications\": {\n \"$ref\": \"#/definitions/ApplicationConfigsById\"\n },\n \"options\": {\n \"$ref\": \"#/definitions/Options\",\n \"description\": \"Optional configuration for the entire micro-frontends setup.\"\n }\n },\n \"required\": [\"version\", \"applications\"],\n \"description\": \"Configuration for micro-frontend applications\\n\\nTODO: Add proxy configuration\"\n },\n \"ApplicationConfigsById\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/ApplicationConfig\"\n }\n },\n \"ApplicationConfig\": {\n \"anyOf\": [\n {\n \"$ref\": \"#/definitions/DefaultApplicationConfig\"\n },\n {\n \"$ref\": \"#/definitions/CommonApplicationConfig\"\n }\n ],\n \"description\": \"A Micro-Frontend Deployment Target\"\n },\n \"DefaultApplicationConfig\": {\n \"type\": \"object\",\n \"properties\": {\n \"default\": {\n \"type\": \"boolean\",\n \"const\": true,\n \"description\": \"The default application is used no other application is matched via the routing config\"\n },\n \"routing\": {\n \"$ref\": \"#/definitions/Routing\"\n },\n \"development\": {\n \"type\": \"object\",\n \"properties\": {\n \"local\": {\n \"$ref\": \"#/definitions/HostConfig\"\n },\n \"fallback\": {\n \"$ref\": \"#/definitions/HostConfig\",\n \"description\": \"Fallback for local development, could be a host config that points to any environment. If this is not provided, or the application is not running - requests to the application in local development will error.\"\n },\n \"task\": {\n \"type\": \"string\",\n \"description\": \"Optional task to run when starting the development server. Should reference a script in the package.json of the application.\"\n }\n },\n \"required\": [\"local\"]\n },\n \"production\": {\n \"$ref\": \"#/definitions/HostConfig\"\n },\n \"metadata\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"type\": \"string\"\n }\n },\n \"federation\": {\n \"type\": \"object\",\n \"properties\": {\n \"exposes\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\n \"type\": \"string\",\n \"description\": \"The name of the module - should be used when importing the module from another application\"\n },\n \"path\": {\n \"type\": \"string\",\n \"description\": \"Relative path to the module within its `application`\"\n }\n },\n \"required\": [\"name\", \"path\"]\n },\n \"description\": \"Modules that are exposed by this application\"\n },\n \"uses\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"description\": \"Modules that are used by this application. Only the name of the module is required.\"\n }\n }\n },\n \"vercel\": {\n \"$ref\": \"#/definitions/Vercel\"\n }\n },\n \"required\": [\"default\", \"development\", \"production\"]\n },\n \"Routing\": {\n \"type\": \"object\",\n \"properties\": {\n \"assetPrefix\": {\n \"type\": \"string\",\n \"description\": \"[assetPrefix] for the application\"\n },\n \"matches\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/definitions/PathGroup\"\n },\n \"description\": \"Path expressions that are routed to this application.\"\n }\n },\n \"required\": [\"matches\"]\n },\n \"PathGroup\": {\n \"type\": \"object\",\n \"properties\": {\n \"group\": {\n \"type\": \"string\",\n \"description\": \"Optional group name for the paths\"\n },\n \"options\": {\n \"type\": \"object\",\n \"properties\": {\n \"flag\": {\n \"type\": \"string\",\n \"description\": \"flag name that can be used to enable/disable all paths in the group\"\n },\n \"routeToDefaultApplication\": {\n \"type\": \"boolean\",\n \"description\": \"True to route the request to the default application for this micro-frontends set-up. This must be `true` when using `flag` or when you want to use custom logic to make the routing decision for this group of paths.\"\n }\n }\n },\n \"paths\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n },\n \"required\": [\"paths\"]\n },\n \"HostConfig\": {\n \"type\": \"object\",\n \"properties\": {\n \"protocol\": {\n \"type\": \"string\",\n \"enum\": [\"http\", \"https\"],\n \"description\": \"The protocol to be used for the connection.\\n- `http`: Hypertext Transfer Protocol (HTTP).\\n- `https`: Secure Hypertext Transfer Protocol (HTTPS).\\n\\n* @defaultValue \\\"https\\\"\"\n },\n \"host\": {\n \"type\": \"string\",\n \"description\": \"The hostname or IP address of the server. This can be a domain name (e.g., `example.com`) or an IP address (e.g., `192.168.1.1`).\"\n },\n \"port\": {\n \"type\": \"number\",\n \"description\": \"The port number to be used for the connection. Common values include `80` for HTTP and `443` for HTTPS.\\n\\nThis field is optional and can be omitted if the default ports for the specified protocol are used\"\n }\n },\n \"required\": [\"host\"]\n },\n \"Vercel\": {\n \"type\": \"object\",\n \"properties\": {\n \"projectId\": {\n \"type\": \"string\",\n \"description\": \"Vercel project ID\"\n },\n \"projectName\": {\n \"type\": \"string\",\n \"description\": \"Vercel project name (temporary until we can use project ID)\"\n },\n \"defaultRoute\": {\n \"type\": \"string\",\n \"description\": \"The default route for the application. Used to render screenshots, favicons, and provide direct zone links\"\n },\n \"routeSpeedInsightsToDefaultZone\": {\n \"type\": \"boolean\",\n \"description\": \"Whether to route Speed Insights to the default zone or each individual microfrontend.\"\n }\n },\n \"required\": [\"projectId\"]\n },\n \"CommonApplicationConfig\": {\n \"type\": \"object\",\n \"properties\": {\n \"default\": {\n \"type\": \"boolean\",\n \"const\": false,\n \"description\": \"The default application is used no other application is matched via the routing config\"\n },\n \"routing\": {\n \"$ref\": \"#/definitions/Routing\"\n },\n \"development\": {\n \"type\": \"object\",\n \"properties\": {\n \"local\": {\n \"$ref\": \"#/definitions/HostConfig\"\n },\n \"fallback\": {\n \"$ref\": \"#/definitions/HostConfig\",\n \"description\": \"Fallback for local development, could be a host config that points to any environment. If this is not provided, or the application is not running - requests to the application in local development will error.\"\n },\n \"task\": {\n \"type\": \"string\",\n \"description\": \"Optional task to run when starting the development server. Should reference a script in the package.json of the application.\"\n }\n },\n \"required\": [\"local\"]\n },\n \"production\": {\n \"$ref\": \"#/definitions/HostConfig\"\n },\n \"metadata\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"type\": \"string\"\n }\n },\n \"federation\": {\n \"type\": \"object\",\n \"properties\": {\n \"exposes\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\n \"type\": \"string\",\n \"description\": \"The name of the module - should be used when importing the module from another application\"\n },\n \"path\": {\n \"type\": \"string\",\n \"description\": \"Relative path to the module within its `application`\"\n }\n },\n \"required\": [\"name\", \"path\"]\n },\n \"description\": \"Modules that are exposed by this application\"\n },\n \"uses\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"description\": \"Modules that are used by this application. Only the name of the module is required.\"\n }\n }\n },\n \"vercel\": {\n \"$ref\": \"#/definitions/Vercel\"\n }\n },\n \"required\": [\"default\", \"development\", \"production\", \"routing\"]\n },\n \"Options\": {\n \"type\": \"object\",\n \"properties\": {\n \"vercel\": {\n \"$ref\": \"#/definitions/VercelOptions\",\n \"description\": \"Micro-Frontends wide options for Vercel.\"\n },\n \"localProxy\": {\n \"$ref\": \"#/definitions/LocalProxyOptions\",\n \"description\": \"Options for local proxy.\"\n }\n }\n },\n \"VercelOptions\": {\n \"type\": \"object\",\n \"properties\": {\n \"previewDeploymentSuffix\": {\n \"type\": \"string\",\n \"description\": \"If your team uses a custom Preview Deployment Suffix, please specify it here. See https://vercel.com/docs/deployments/preview-deployment-suffix. The default is `vercel.app`.\"\n },\n \"teamSlug\": {\n \"type\": \"string\",\n \"description\": \"Team slug for the Vercel team\"\n },\n \"disableOverrides\": {\n \"type\": \"boolean\",\n \"description\": \"If you want to disable the overrides for the site. For example, if you are managing rewrites between applications externally, you may wish to disable the overrides on the toolbar as they will have no effect.\"\n }\n }\n },\n \"LocalProxyOptions\": {\n \"type\": \"object\",\n \"properties\": {\n \"port\": {\n \"type\": \"number\",\n \"description\": \"The port number used by the local proxy server.\\n\\nThe default is `3024`.\"\n }\n }\n }\n }\n}\n","import type { JSONSchema7 } from 'json-schema';\nimport jsonSchema from '../../../schema/schema.json';\n\nexport const SCHEMA = jsonSchema as JSONSchema7;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAAA;AAAA,EAAA;AAAA;AAAA;;;ACAA,0BAAsB;AACtB,iBAAoB;;;ACwEb,IAAM,qBAAN,cAEG,MAAM;AAAA,EAKd,YAAY,SAAiB,MAAqC;AAChE,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,UAAS,6BAAM,WAAU;AAC9B,SAAK,QAAO,6BAAM,SAAS;AAC3B,SAAK,UAAU,6BAAM;AACrB,UAAM,kBAAkB,MAAM,kBAAkB;AAAA,EAClD;AAAA,EAEA,UAAmB;AACjB,WAAO,KAAK,SAAS;AAAA,EACvB;AAAA,EAEA,YAAqB;AACnB,WAAO,CAAC,KAAK,QAAQ;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,QACL,UACA,MAC4C;AAC5C,QAAI,6BAAM,UAAU;AAClB,YAAM,MAAM,mBAAmB,eAAe,UAAU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ACR,YAAc;AAAA,QACZ,MAAQ;AAAA,UACN,MAAQ;AAAA,UACR,aAAe;AAAA,QACjB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;AC3TO,IAAMC,UAAS;;;AFWf,IAAMC,kBAAiB,CAAC,iBAAiC;AAC9D,QAAM,mBAAe,4BAAM,YAAY;AACvC,QAAM,MAAM,IAAI,gBAAI;AACpB,QAAM,WAAW,IAAI,QAAQC,OAAM;AACnC,QAAM,UAAU,SAAS,YAAY;AACrC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI;AAAA,MACR,mBAAmB,IAAI,WAAW,SAAS,MAAM;AAAA,MACjD,EAAE,MAAM,UAAU,SAAS,wBAAwB;AAAA,IACrD;AAAA,EACF;AACA,SAAO;AACT;","names":["validateSchema","import_jsonc_parser","import_ajv","SCHEMA","validateSchema","SCHEMA"]}
1
+ {"version":3,"sources":["../src/schema/validation.ts","../src/config-v2/microfrontends/server/validation.ts","../src/config/errors.ts","../schema/schema-v2.json","../src/config-v2/schema/utils/load.ts","../src/config/validation.ts","../schema/schema.json","../src/config/utils/load-schema.ts"],"sourcesContent":["export { validateSchema as validateV2Schema } from '../config-v2/microfrontends/server/validation';\nexport { validateSchema as validateV1Schema } from '../config/validation';\n","import { parse } from 'jsonc-parser';\nimport { Ajv } from 'ajv';\nimport type { Config } from '../../schema/types';\nimport { MicrofrontendError } from '../../../config/errors';\nimport { SCHEMA } from '../../schema/utils/load';\n\nexport function validateSchema(configString: string): Config {\n const parsedConfig = parse(configString) as Config;\n const ajv = new Ajv();\n const validate = ajv.compile(SCHEMA);\n const isValid = validate(parsedConfig);\n if (!isValid) {\n throw new MicrofrontendError(\n `Invalid config: ${ajv.errorsText(validate.errors)}`,\n { type: 'config', subtype: 'does_not_match_schema' },\n );\n }\n return parsedConfig;\n}\n","export type MicrofrontendErrorType =\n | 'config'\n | 'packageJson'\n | 'vercelJson'\n | 'zone'\n | 'unknown';\n\nexport type MicrofrontendErrorSubtype =\n | 'not_found'\n | 'not_found_in_env'\n | 'invalid_asset_prefix'\n | 'invalid_main_path'\n | 'does_not_match_schema'\n | 'unable_to_read_file'\n | 'unsupported_validation_env'\n | 'unsupported_version'\n | 'invalid_path'\n | 'invalid_permissions'\n | 'invalid_syntax'\n | 'missing_microfrontend_config_path'\n | 'unsupported_operation';\n\n// A mapping of error types to their subtypes.\ninterface TypeToSubtype {\n zone:\n | 'invalid_asset_prefix'\n | 'invalid_path'\n | 'multiple_package_managers'\n | 'not_found';\n config:\n | 'conflicting_paths'\n | 'does_not_match_schema'\n | 'invalid_main_path'\n | 'invalid_preview_deployment_suffix'\n | 'multiple_default_applications'\n | 'no_default_application'\n | 'not_found_in_env'\n | 'not_found'\n | 'unable_to_read_file'\n | 'invalid_syntax'\n | 'invalid_permissions'\n | 'unsupported_operation'\n | 'unsupported_validation_env'\n | 'unsupported_version';\n packageJson:\n | 'missing_field_name'\n | 'unable_to_read_file'\n | 'invalid_permissions'\n | 'invalid_syntax';\n vercelJson:\n | 'missing_field_microFrontend_config_path'\n | 'unable_to_read_file'\n | 'invalid_permissions'\n | 'invalid_syntax';\n unknown: never;\n}\n\nexport type MicrofrontendErrorSource =\n | '@vercel/microfrontends'\n | '@vercel/microfrontends/next'\n | 'fs'\n | 'ajv';\n\nexport interface MicrofrontendErrorOptions<T extends MicrofrontendErrorType> {\n source?: MicrofrontendErrorSource;\n type?: T;\n subtype?: TypeToSubtype[T];\n}\n\ninterface HandleOptions {\n fileName?: string;\n}\n\nexport class MicrofrontendError<\n T extends MicrofrontendErrorType = 'unknown',\n> extends Error {\n public source: MicrofrontendErrorSource;\n public type: T;\n public subtype?: TypeToSubtype[T];\n\n constructor(message: string, opts?: MicrofrontendErrorOptions<T>) {\n super(message);\n this.name = 'MicrofrontendsError';\n this.source = opts?.source ?? '@vercel/microfrontends';\n this.type = opts?.type ?? ('unknown' as T);\n this.subtype = opts?.subtype;\n Error.captureStackTrace(this, MicrofrontendError);\n }\n\n isKnown(): boolean {\n return this.type !== 'unknown';\n }\n\n isUnknown(): boolean {\n return !this.isKnown();\n }\n\n /**\n * Converts an error to a MicrofrontendsError.\n * @param original - The original error to convert.\n * @returns The converted MicrofrontendsError.\n */\n static convert(\n original: Error,\n opts?: HandleOptions,\n ): MicrofrontendError<MicrofrontendErrorType> {\n if (opts?.fileName) {\n const err = MicrofrontendError.convertFSError(original, opts.fileName);\n if (err) {\n return err;\n }\n }\n\n if (\n original.message.includes(\n 'Code generation from strings disallowed for this context',\n )\n ) {\n return new MicrofrontendError(original.message, {\n type: 'config',\n subtype: 'unsupported_validation_env',\n source: 'ajv',\n });\n }\n\n // unknown catch-all\n return new MicrofrontendError(original.message);\n }\n\n static convertFSError(\n original: Error,\n fileName: string,\n ): MicrofrontendError<MicrofrontendErrorType> | null {\n if (original instanceof Error && 'code' in original) {\n if (original.code === 'ENOENT') {\n return new MicrofrontendError(`Could not find \"${fileName}\"`, {\n type: 'config',\n subtype: 'unable_to_read_file',\n source: 'fs',\n });\n }\n if (original.code === 'EACCES') {\n return new MicrofrontendError(\n `Permission denied while accessing \"${fileName}\"`,\n {\n type: 'config',\n subtype: 'invalid_permissions',\n source: 'fs',\n },\n );\n }\n }\n\n if (original instanceof SyntaxError) {\n return new MicrofrontendError(\n `Failed to parse \"${fileName}\": Invalid JSON format.`,\n {\n type: 'config',\n subtype: 'invalid_syntax',\n source: 'fs',\n },\n );\n }\n\n return null;\n }\n\n /**\n * Handles an unknown error and returns a MicrofrontendsError instance.\n * @param err - The error to handle.\n * @returns A MicrofrontendsError instance.\n */\n static handle(\n err: unknown,\n opts?: HandleOptions,\n ): MicrofrontendError<MicrofrontendErrorType> {\n if (err instanceof MicrofrontendError) {\n return err as MicrofrontendError<MicrofrontendErrorType>;\n }\n\n // handle Error instances\n if (err instanceof Error) {\n return MicrofrontendError.convert(err, opts);\n }\n\n // handle object errors\n if (typeof err === 'object' && err !== null) {\n if ('message' in err && typeof err.message === 'string') {\n return MicrofrontendError.convert(new Error(err.message), opts);\n }\n }\n\n return new MicrofrontendError('An unknown error occurred');\n }\n}\n","{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$ref\": \"#/definitions/Config\",\n \"definitions\": {\n \"Config\": {\n \"anyOf\": [\n {\n \"$ref\": \"#/definitions/MainConfig\"\n },\n {\n \"$ref\": \"#/definitions/ChildConfig\"\n }\n ]\n },\n \"MainConfig\": {\n \"type\": \"object\",\n \"properties\": {\n \"$schema\": {\n \"type\": \"string\"\n },\n \"version\": {\n \"type\": \"string\",\n \"const\": \"2\"\n },\n \"options\": {\n \"$ref\": \"#/definitions/Options\"\n },\n \"remotes\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/Application\"\n },\n \"description\": \"Applications that only serve a subset of the microfrontend routes only need to reference the name of the primary application that owns the full microfrontends configuration.\"\n },\n \"provider\": {\n \"$ref\": \"#/definitions/Provider\"\n },\n \"applications\": {\n \"$ref\": \"#/definitions/ApplicationRouting\",\n \"description\": \"Mapping of application names to the routes that they host. Only needs to be defined in the application that owns the primary microfrontend domain\"\n }\n },\n \"required\": [\"applications\", \"provider\", \"version\"]\n },\n \"Options\": {\n \"type\": \"object\",\n \"properties\": {\n \"vercel\": {\n \"$ref\": \"#/definitions/VercelOptions\",\n \"description\": \"Micro-Frontends wide options for Vercel.\"\n },\n \"localProxy\": {\n \"$ref\": \"#/definitions/LocalProxyOptions\",\n \"description\": \"Options for local proxy.\"\n }\n }\n },\n \"VercelOptions\": {\n \"type\": \"object\",\n \"properties\": {\n \"previewDeploymentSuffix\": {\n \"type\": \"string\",\n \"description\": \"If your team uses a custom Preview Deployment Suffix, please specify it here. See https://vercel.com/docs/deployments/preview-deployment-suffix. The default is `vercel.app`.\"\n },\n \"teamSlug\": {\n \"type\": \"string\",\n \"description\": \"Team slug for the Vercel team\"\n },\n \"disableOverrides\": {\n \"type\": \"boolean\",\n \"description\": \"If you want to disable the overrides for the site. For example, if you are managing rewrites between applications externally, you may wish to disable the overrides on the toolbar as they will have no effect.\"\n }\n }\n },\n \"LocalProxyOptions\": {\n \"type\": \"object\",\n \"properties\": {\n \"port\": {\n \"type\": \"number\",\n \"description\": \"The port number used by the local proxy server.\\n\\nThe default is `3024`.\"\n }\n }\n },\n \"Application\": {\n \"anyOf\": [\n {\n \"$ref\": \"#/definitions/DefaultApplication\"\n },\n {\n \"$ref\": \"#/definitions/ChildApplication\"\n }\n ]\n },\n \"DefaultApplication\": {\n \"type\": \"object\",\n \"properties\": {\n \"vercel\": {\n \"$ref\": \"#/definitions/Vercel\"\n },\n \"development\": {\n \"$ref\": \"#/definitions/Development\"\n },\n \"production\": {\n \"$ref\": \"#/definitions/HostConfig\"\n }\n },\n \"required\": [\"production\"]\n },\n \"Vercel\": {\n \"type\": \"object\",\n \"properties\": {\n \"projectId\": {\n \"type\": \"string\",\n \"description\": \"Vercel project ID\"\n },\n \"routeSpeedInsightsToDefaultZone\": {\n \"type\": \"boolean\"\n }\n },\n \"required\": [\"projectId\"]\n },\n \"Development\": {\n \"type\": \"object\",\n \"properties\": {\n \"local\": {\n \"$ref\": \"#/definitions/LocalHostConfig\"\n },\n \"fallback\": {\n \"$ref\": \"#/definitions/HostConfig\",\n \"description\": \"Fallback for local development, could be a host config that points to any environment. If this is not provided, or the application is not running - requests to the application in local development will error.\"\n },\n \"task\": {\n \"type\": \"string\",\n \"description\": \"Optional task to run when starting the development server. Should reference a script in the package.json of the application.\"\n }\n }\n },\n \"LocalHostConfig\": {\n \"type\": \"object\",\n \"properties\": {\n \"host\": {\n \"type\": \"string\",\n \"description\": \"The hostname or IP address of the server. This can be a domain name (e.g., `example.com`) or an IP address (e.g., `192.168.1.1`).\"\n },\n \"protocol\": {\n \"type\": \"string\",\n \"enum\": [\"http\", \"https\"],\n \"description\": \"The protocol to be used for the connection.\\n- `http`: Hypertext Transfer Protocol (HTTP).\\n- `https`: Secure Hypertext Transfer Protocol (HTTPS).\\n\\n* @defaultValue \\\"http\\\" for local development, \\\"https\\\" for otherwise\"\n },\n \"port\": {\n \"type\": \"number\",\n \"description\": \"The port number to be used for the connection. Common values include `80` for HTTP and `443` for HTTPS.\"\n }\n }\n },\n \"HostConfig\": {\n \"type\": \"object\",\n \"properties\": {\n \"protocol\": {\n \"type\": \"string\",\n \"enum\": [\"http\", \"https\"],\n \"description\": \"The protocol to be used for the connection.\\n- `http`: Hypertext Transfer Protocol (HTTP).\\n- `https`: Secure Hypertext Transfer Protocol (HTTPS).\\n\\n* @defaultValue \\\"http\\\" for local development, \\\"https\\\" for otherwise\"\n },\n \"host\": {\n \"type\": \"string\",\n \"description\": \"The hostname or IP address of the server. This can be a domain name (e.g., `example.com`) or an IP address (e.g., `192.168.1.1`).\"\n },\n \"port\": {\n \"type\": \"number\",\n \"description\": \"The port number to be used for the connection. Common values include `80` for HTTP and `443` for HTTPS.\"\n }\n },\n \"required\": [\"host\"]\n },\n \"ChildApplication\": {\n \"type\": \"object\",\n \"properties\": {\n \"vercel\": {\n \"$ref\": \"#/definitions/Vercel\"\n },\n \"development\": {\n \"$ref\": \"#/definitions/Development\"\n },\n \"routing\": {\n \"$ref\": \"#/definitions/Routing\",\n \"description\": \"Groups of path expressions that are routed to this application.\"\n },\n \"production\": {\n \"$ref\": \"#/definitions/HostConfig\"\n }\n },\n \"required\": [\"routing\"]\n },\n \"Routing\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/definitions/PathGroup\"\n }\n },\n \"PathGroup\": {\n \"type\": \"object\",\n \"properties\": {\n \"group\": {\n \"type\": \"string\",\n \"description\": \"Optional group name for the paths\"\n },\n \"flag\": {\n \"type\": \"string\",\n \"description\": \"flag name that can be used to enable/disable all paths in the group\"\n },\n \"routeToDefaultApplication\": {\n \"type\": \"boolean\",\n \"description\": \"True to route the request to the default application for this micro-frontends set-up. This must be `true` when using `flag` or when you want to use custom logic to make the routing decision for this group of paths.\"\n },\n \"paths\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n },\n \"required\": [\"paths\"]\n },\n \"Provider\": {\n \"type\": \"string\",\n \"enum\": [\"vercel\", \"other\"]\n },\n \"ApplicationRouting\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/Application\"\n }\n },\n \"ChildConfig\": {\n \"type\": \"object\",\n \"properties\": {\n \"$schema\": {\n \"type\": \"string\"\n },\n \"version\": {\n \"type\": \"string\",\n \"const\": \"2\"\n },\n \"options\": {\n \"$ref\": \"#/definitions/Options\"\n },\n \"remotes\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/Application\"\n },\n \"description\": \"Applications that only serve a subset of the microfrontend routes only need to reference the name of the primary application that owns the full microfrontends configuration.\"\n },\n \"partOf\": {\n \"type\": \"string\",\n \"description\": \"Applications that only serve a subset of the microfrontend routes only need to reference the name of the primary application that owns the full microfrontends configuration.\"\n }\n },\n \"required\": [\"partOf\", \"version\"]\n }\n }\n}\n","import type { JSONSchema7 } from 'json-schema';\nimport jsonSchema from '../../../../schema/schema-v2.json';\n\nexport const SCHEMA = jsonSchema as JSONSchema7;\n","import { parse } from 'jsonc-parser';\nimport { pathToRegexp, parse as parsePathRegexp } from 'path-to-regexp';\nimport { Ajv } from 'ajv';\nimport type {\n Config,\n ApplicationId,\n PathGroup,\n ApplicationConfigsById,\n Options,\n} from './schema';\nimport { isDefaultApplicationConfig } from './types';\nimport { MicrofrontendError } from './errors';\nimport { SCHEMA } from './utils/load-schema';\n\nexport const validateSchema = (configString: string): Config => {\n const parsedConfig = parse(configString) as Config;\n const ajv = new Ajv();\n const validate = ajv.compile(SCHEMA);\n const isValid = validate(parsedConfig);\n if (!isValid) {\n throw new MicrofrontendError(\n `Invalid config: ${ajv.errorsText(validate.errors)}`,\n { type: 'config', subtype: 'does_not_match_schema' },\n );\n }\n return parsedConfig;\n};\n\nconst SUPPORTED_VERSIONS = ['1'];\n\nexport const validateVersion = (version: string): void => {\n if (!SUPPORTED_VERSIONS.includes(version)) {\n throw new MicrofrontendError(\n `Unsupported version: ${version}. Supported versions are: ${SUPPORTED_VERSIONS.join(\n ', ',\n )}`,\n { type: 'config', subtype: 'unsupported_version' },\n );\n }\n};\n\nexport function validateMainPath(\n applicationConfigsById: ApplicationConfigsById,\n): void {\n for (const [id, app] of Object.entries(applicationConfigsById)) {\n const { defaultRoute } = app.vercel ?? {};\n if (!defaultRoute) {\n continue;\n }\n\n if (isDefaultApplicationConfig(app)) {\n // the defaultRoute for the default application can't match any other applications routes\n const pathsWithApp = [];\n for (const [otherId, otherApp] of Object.entries(\n applicationConfigsById,\n )) {\n if (isDefaultApplicationConfig(otherApp)) {\n continue;\n }\n pathsWithApp.push({\n id: otherId,\n paths: otherApp.routing.matches.flatMap((match) => match.paths),\n });\n }\n\n for (const { id: otherId, paths } of pathsWithApp) {\n const isValid = paths.every((path) => {\n const matcher = pathToRegexp(path);\n return !matcher.test(defaultRoute);\n });\n\n if (!isValid) {\n throw new MicrofrontendError(\n `default route \"${defaultRoute}\" cannot be used for \"${id}\" because it is matched by \"${otherId}\"`,\n { type: 'config', subtype: 'invalid_main_path' },\n );\n }\n }\n // the defaultRoute for a non-default application has to match one of its own paths\n } else {\n const allPaths = app.routing.matches.flatMap((match) => match.paths);\n const isValid = allPaths.some((path) => {\n const matcher = pathToRegexp(path);\n return matcher.test(defaultRoute);\n });\n\n if (!isValid) {\n throw new MicrofrontendError(\n `default route \"${defaultRoute}\" is not included by the routing config for application \"${id}\"`,\n { type: 'config', subtype: 'invalid_main_path' },\n );\n }\n }\n }\n}\n\nexport const validatePaths = (\n applicationConfigsById: ApplicationConfigsById,\n): void => {\n const pathsByApplicationId = new Map<\n PathGroup['paths'][number],\n {\n applications: ApplicationId[];\n matcher: RegExp;\n applicationId?: ApplicationId;\n }\n >();\n const errors: string[] = [];\n\n for (const [id, app] of Object.entries(applicationConfigsById)) {\n if (isDefaultApplicationConfig(app)) {\n // default applications do not have routing\n continue;\n }\n\n for (const pathMatch of app.routing.matches) {\n for (const path of pathMatch.paths) {\n const maybeError = validatePathExpression(path);\n if (maybeError) {\n errors.push(maybeError);\n }\n\n const existing = pathsByApplicationId.get(path);\n if (existing) {\n existing.applications.push(id);\n } else {\n pathsByApplicationId.set(path, {\n applications: [id],\n matcher: pathToRegexp(path),\n applicationId: id,\n });\n }\n }\n }\n }\n const entries = Array.from(pathsByApplicationId.entries());\n\n entries.forEach(([path, { applications: ids, matcher, applicationId }]) => {\n if (ids.length > 1) {\n errors.push(\n `Duplicate path \"${path}\" for applications \"${ids.join(', ')}\"`,\n );\n }\n\n entries.forEach(\n ([\n matchPath,\n { applications: matchIds, applicationId: matchApplicationId },\n ]) => {\n if (path === matchPath) {\n // we're comparing to ourselves, so skip\n return;\n }\n\n if (applicationId === matchApplicationId) {\n // we're comparing to paths within our own application, which are allowed to overlap, so skip\n return;\n }\n\n if (matcher.test(matchPath)) {\n const source = `\"${path}\" of application${ids.length > 0 ? 's' : ''} ${ids.join(', ')}`;\n const destination = `\"${matchPath}\" of application${matchIds.length > 0 ? 's' : ''} ${matchIds.join(', ')}`;\n\n errors.push(\n `Overlapping path detected between ${source} and ${destination}`,\n );\n }\n },\n );\n });\n\n if (errors.length) {\n throw new MicrofrontendError(`Invalid paths: ${errors.join(', ')}`, {\n type: 'config',\n subtype: 'conflicting_paths',\n });\n }\n};\n\n// From https://github.com/pillarjs/path-to-regexp/blob/b0778f5e8e6c6e9ee4e2f5b34e877cc5229f8036/src/index.ts#L143\nconst PATH_DEFAULT_PATTERN = '[^\\\\/#\\\\?]+?';\n\n// This is a copy of https://github.com/vercel/api/blob/main/scripts/build-container/src/utils/upload-micro-frontend-configuration.ts\n// and should be kept in sync.\nfunction validatePathExpression(path: string): string | undefined {\n const tokens = parsePathRegexp(path);\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i];\n if (token === undefined) {\n return `token ${i} in ${path} is undefined, this shouldn't happen`;\n }\n if (typeof token !== 'string') {\n if (token.pattern !== PATH_DEFAULT_PATTERN) {\n return `Path ${path} cannot use a regular expression wildcard`;\n }\n if (token.prefix !== '/') {\n return `Wildcard :${token.name} must be immediately after a / in ${path}`;\n }\n if (token.suffix) {\n return `Wildcard suffix on :${token.name} is not allowed. Suffixes are not supported`;\n }\n if (token.modifier && i !== tokens.length - 1) {\n return `Modifier ${token.modifier} is not allowed on wildcard :${token.name} in ${path}. Modifiers are only allowed in the last path component`;\n }\n }\n }\n return undefined;\n}\n\n/** make sure there is exactly one default `Application` */\nexport const validateDefaults = (\n applicationConfigsById: ApplicationConfigsById,\n): void => {\n const defaultApplicationIds = Object.entries(applicationConfigsById).reduce<\n string[]\n // biome-ignore lint/performance/noAccumulatingSpread: Ignored using `--suppress`\n >((acc, [id, app]) => (app.default ? [...acc, id] : acc), []);\n\n if (defaultApplicationIds.length === 0) {\n throw new MicrofrontendError(\n `No default application found. At least one application must be marked as default.`,\n { type: 'config', subtype: 'no_default_application' },\n );\n }\n\n if (defaultApplicationIds.length > 1) {\n throw new MicrofrontendError(\n `Only one default application is allowed. Found ${defaultApplicationIds.join(', ')}.`,\n { type: 'config', subtype: 'multiple_default_applications' },\n );\n }\n};\n\nexport const validateOptions = (options?: Options): void => {\n if (options?.vercel?.previewDeploymentSuffix) {\n if (\n !/^[a-zA-Z]{2,}\\.[a-zA-Z]{2,}$/.test(\n options.vercel.previewDeploymentSuffix,\n )\n ) {\n throw new MicrofrontendError(\n `Invalid preview deployment suffix: ${options.vercel.previewDeploymentSuffix}. Should have be formatted like \"vercel.app\".`,\n { type: 'config', subtype: 'invalid_preview_deployment_suffix' },\n );\n }\n }\n};\n","{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$ref\": \"#/definitions/Config\",\n \"definitions\": {\n \"Config\": {\n \"type\": \"object\",\n \"properties\": {\n \"version\": {\n \"type\": \"string\"\n },\n \"$schema\": {\n \"type\": \"string\"\n },\n \"name\": {\n \"type\": \"string\",\n \"description\": \"Name for the micro-frontend site (eg. \\\"vercel.com\\\", \\\"vercel-site\\\" etc.).\"\n },\n \"applications\": {\n \"$ref\": \"#/definitions/ApplicationConfigsById\"\n },\n \"options\": {\n \"$ref\": \"#/definitions/Options\",\n \"description\": \"Optional configuration for the entire micro-frontends setup.\"\n }\n },\n \"required\": [\"version\", \"applications\"],\n \"description\": \"Configuration for micro-frontend applications\\n\\nTODO: Add proxy configuration\"\n },\n \"ApplicationConfigsById\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/ApplicationConfig\"\n }\n },\n \"ApplicationConfig\": {\n \"anyOf\": [\n {\n \"$ref\": \"#/definitions/DefaultApplicationConfig\"\n },\n {\n \"$ref\": \"#/definitions/CommonApplicationConfig\"\n }\n ],\n \"description\": \"A Micro-Frontend Deployment Target\"\n },\n \"DefaultApplicationConfig\": {\n \"type\": \"object\",\n \"properties\": {\n \"default\": {\n \"type\": \"boolean\",\n \"const\": true,\n \"description\": \"The default application is used no other application is matched via the routing config\"\n },\n \"routing\": {\n \"$ref\": \"#/definitions/Routing\"\n },\n \"development\": {\n \"type\": \"object\",\n \"properties\": {\n \"local\": {\n \"$ref\": \"#/definitions/HostConfig\"\n },\n \"fallback\": {\n \"$ref\": \"#/definitions/HostConfig\",\n \"description\": \"Fallback for local development, could be a host config that points to any environment. If this is not provided, or the application is not running - requests to the application in local development will error.\"\n },\n \"task\": {\n \"type\": \"string\",\n \"description\": \"Optional task to run when starting the development server. Should reference a script in the package.json of the application.\"\n }\n },\n \"required\": [\"local\"]\n },\n \"production\": {\n \"$ref\": \"#/definitions/HostConfig\"\n },\n \"metadata\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"type\": \"string\"\n }\n },\n \"federation\": {\n \"type\": \"object\",\n \"properties\": {\n \"exposes\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\n \"type\": \"string\",\n \"description\": \"The name of the module - should be used when importing the module from another application\"\n },\n \"path\": {\n \"type\": \"string\",\n \"description\": \"Relative path to the module within its `application`\"\n }\n },\n \"required\": [\"name\", \"path\"]\n },\n \"description\": \"Modules that are exposed by this application\"\n },\n \"uses\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"description\": \"Modules that are used by this application. Only the name of the module is required.\"\n }\n }\n },\n \"vercel\": {\n \"$ref\": \"#/definitions/Vercel\"\n }\n },\n \"required\": [\"default\", \"development\", \"production\"]\n },\n \"Routing\": {\n \"type\": \"object\",\n \"properties\": {\n \"assetPrefix\": {\n \"type\": \"string\",\n \"description\": \"[assetPrefix] for the application\"\n },\n \"matches\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/definitions/PathGroup\"\n },\n \"description\": \"Path expressions that are routed to this application.\"\n }\n },\n \"required\": [\"matches\"]\n },\n \"PathGroup\": {\n \"type\": \"object\",\n \"properties\": {\n \"group\": {\n \"type\": \"string\",\n \"description\": \"Optional group name for the paths\"\n },\n \"options\": {\n \"type\": \"object\",\n \"properties\": {\n \"flag\": {\n \"type\": \"string\",\n \"description\": \"flag name that can be used to enable/disable all paths in the group\"\n },\n \"routeToDefaultApplication\": {\n \"type\": \"boolean\",\n \"description\": \"True to route the request to the default application for this micro-frontends set-up. This must be `true` when using `flag` or when you want to use custom logic to make the routing decision for this group of paths.\"\n }\n }\n },\n \"paths\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n },\n \"required\": [\"paths\"]\n },\n \"HostConfig\": {\n \"type\": \"object\",\n \"properties\": {\n \"protocol\": {\n \"type\": \"string\",\n \"enum\": [\"http\", \"https\"],\n \"description\": \"The protocol to be used for the connection.\\n- `http`: Hypertext Transfer Protocol (HTTP).\\n- `https`: Secure Hypertext Transfer Protocol (HTTPS).\\n\\n* @defaultValue \\\"https\\\"\"\n },\n \"host\": {\n \"type\": \"string\",\n \"description\": \"The hostname or IP address of the server. This can be a domain name (e.g., `example.com`) or an IP address (e.g., `192.168.1.1`).\"\n },\n \"port\": {\n \"type\": \"number\",\n \"description\": \"The port number to be used for the connection. Common values include `80` for HTTP and `443` for HTTPS.\\n\\nThis field is optional and can be omitted if the default ports for the specified protocol are used\"\n }\n },\n \"required\": [\"host\"]\n },\n \"Vercel\": {\n \"type\": \"object\",\n \"properties\": {\n \"projectId\": {\n \"type\": \"string\",\n \"description\": \"Vercel project ID\"\n },\n \"projectName\": {\n \"type\": \"string\",\n \"description\": \"Vercel project name (temporary until we can use project ID)\"\n },\n \"defaultRoute\": {\n \"type\": \"string\",\n \"description\": \"The default route for the application. Used to render screenshots, favicons, and provide direct zone links\"\n },\n \"routeSpeedInsightsToDefaultZone\": {\n \"type\": \"boolean\",\n \"description\": \"Whether to route Speed Insights to the default zone or each individual microfrontend.\"\n }\n },\n \"required\": [\"projectId\"]\n },\n \"CommonApplicationConfig\": {\n \"type\": \"object\",\n \"properties\": {\n \"default\": {\n \"type\": \"boolean\",\n \"const\": false,\n \"description\": \"The default application is used no other application is matched via the routing config\"\n },\n \"routing\": {\n \"$ref\": \"#/definitions/Routing\"\n },\n \"development\": {\n \"type\": \"object\",\n \"properties\": {\n \"local\": {\n \"$ref\": \"#/definitions/HostConfig\"\n },\n \"fallback\": {\n \"$ref\": \"#/definitions/HostConfig\",\n \"description\": \"Fallback for local development, could be a host config that points to any environment. If this is not provided, or the application is not running - requests to the application in local development will error.\"\n },\n \"task\": {\n \"type\": \"string\",\n \"description\": \"Optional task to run when starting the development server. Should reference a script in the package.json of the application.\"\n }\n },\n \"required\": [\"local\"]\n },\n \"production\": {\n \"$ref\": \"#/definitions/HostConfig\"\n },\n \"metadata\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"type\": \"string\"\n }\n },\n \"federation\": {\n \"type\": \"object\",\n \"properties\": {\n \"exposes\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\n \"type\": \"string\",\n \"description\": \"The name of the module - should be used when importing the module from another application\"\n },\n \"path\": {\n \"type\": \"string\",\n \"description\": \"Relative path to the module within its `application`\"\n }\n },\n \"required\": [\"name\", \"path\"]\n },\n \"description\": \"Modules that are exposed by this application\"\n },\n \"uses\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"description\": \"Modules that are used by this application. Only the name of the module is required.\"\n }\n }\n },\n \"vercel\": {\n \"$ref\": \"#/definitions/Vercel\"\n }\n },\n \"required\": [\"default\", \"development\", \"production\", \"routing\"]\n },\n \"Options\": {\n \"type\": \"object\",\n \"properties\": {\n \"vercel\": {\n \"$ref\": \"#/definitions/VercelOptions\",\n \"description\": \"Micro-Frontends wide options for Vercel.\"\n },\n \"localProxy\": {\n \"$ref\": \"#/definitions/LocalProxyOptions\",\n \"description\": \"Options for local proxy.\"\n }\n }\n },\n \"VercelOptions\": {\n \"type\": \"object\",\n \"properties\": {\n \"previewDeploymentSuffix\": {\n \"type\": \"string\",\n \"description\": \"If your team uses a custom Preview Deployment Suffix, please specify it here. See https://vercel.com/docs/deployments/preview-deployment-suffix. The default is `vercel.app`.\"\n },\n \"teamSlug\": {\n \"type\": \"string\",\n \"description\": \"Team slug for the Vercel team\"\n },\n \"disableOverrides\": {\n \"type\": \"boolean\",\n \"description\": \"If you want to disable the overrides for the site. For example, if you are managing rewrites between applications externally, you may wish to disable the overrides on the toolbar as they will have no effect.\"\n }\n }\n },\n \"LocalProxyOptions\": {\n \"type\": \"object\",\n \"properties\": {\n \"port\": {\n \"type\": \"number\",\n \"description\": \"The port number used by the local proxy server.\\n\\nThe default is `3024`.\"\n }\n }\n }\n }\n}\n","import type { JSONSchema7 } from 'json-schema';\nimport jsonSchema from '../../../schema/schema.json';\n\nexport const SCHEMA = jsonSchema as JSONSchema7;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAAA;AAAA,EAAA;AAAA;AAAA;;;ACAA,0BAAsB;AACtB,iBAAoB;;;ACwEb,IAAM,qBAAN,cAEG,MAAM;AAAA,EAKd,YAAY,SAAiB,MAAqC;AAChE,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,UAAS,6BAAM,WAA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;AAAA,QACjB;AAAA,MACF;AAAA,IACF;AAAA,IACA,eAAiB;AAAA,MACf,MAAQ;AAAA,MACR,YAAc;AAAA,QACZ,yBAA2B;AAAA,UACzB,MAAQ;AAAA,UACR,aAAe;AAAA,QACjB;AAAA,QACA,UAAY;AAAA,UACV,MAAQ;AAAA,UACR,aAAe;AAAA,QACjB;AAAA,QACA,kBAAoB;AAAA,UAClB,MAAQ;AAAA,UACR,aAAe;AAAA,QACjB;AAAA,MACF;AAAA,IACF;AAAA,IACA,mBAAqB;AAAA,MACnB,MAAQ;AAAA,MACR,YAAc;AAAA,QACZ,MAAQ;AAAA,UACN,MAAQ;AAAA,UACR,aAAe;AAAA,QACjB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;AC3TO,IAAMC,UAAS;;;AFWf,IAAMC,kBAAiB,CAAC,iBAAiC;AAC9D,QAAM,mBAAe,4BAAM,YAAY;AACvC,QAAM,MAAM,IAAI,gBAAI;AACpB,QAAM,WAAW,IAAI,QAAQC,OAAM;AACnC,QAAM,UAAU,SAAS,YAAY;AACrC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI;AAAA,MACR,mBAAmB,IAAI,WAAW,SAAS,MAAM;AAAA,MACjD,EAAE,MAAM,UAAU,SAAS,wBAAwB;AAAA,IACrD;AAAA,EACF;AACA,SAAO;AACT;","names":["validateSchema","import_jsonc_parser","import_ajv","SCHEMA","validateSchema","SCHEMA"]}
@@ -3,14 +3,14 @@ import { parse } from "jsonc-parser";
3
3
  import { Ajv } from "ajv";
4
4
 
5
5
  // src/config/errors.ts
6
- var MicroFrontendError = class extends Error {
6
+ var MicrofrontendError = class extends Error {
7
7
  constructor(message, opts) {
8
8
  super(message);
9
- this.name = "MicroFrontendsError";
10
- this.source = (opts == null ? void 0 : opts.source) ?? "@vercel/micro-frontends";
9
+ this.name = "MicrofrontendsError";
10
+ this.source = (opts == null ? void 0 : opts.source) ?? "@vercel/microfrontends";
11
11
  this.type = (opts == null ? void 0 : opts.type) ?? "unknown";
12
12
  this.subtype = opts == null ? void 0 : opts.subtype;
13
- Error.captureStackTrace(this, MicroFrontendError);
13
+ Error.captureStackTrace(this, MicrofrontendError);
14
14
  }
15
15
  isKnown() {
16
16
  return this.type !== "unknown";
@@ -19,13 +19,13 @@ var MicroFrontendError = class extends Error {
19
19
  return !this.isKnown();
20
20
  }
21
21
  /**
22
- * Converts an error to a MicroFrontendsError.
22
+ * Converts an error to a MicrofrontendsError.
23
23
  * @param original - The original error to convert.
24
- * @returns The converted MicroFrontendsError.
24
+ * @returns The converted MicrofrontendsError.
25
25
  */
26
26
  static convert(original, opts) {
27
27
  if (opts == null ? void 0 : opts.fileName) {
28
- const err = MicroFrontendError.convertFSError(original, opts.fileName);
28
+ const err = MicrofrontendError.convertFSError(original, opts.fileName);
29
29
  if (err) {
30
30
  return err;
31
31
  }
@@ -33,25 +33,25 @@ var MicroFrontendError = class extends Error {
33
33
  if (original.message.includes(
34
34
  "Code generation from strings disallowed for this context"
35
35
  )) {
36
- return new MicroFrontendError(original.message, {
36
+ return new MicrofrontendError(original.message, {
37
37
  type: "config",
38
38
  subtype: "unsupported_validation_env",
39
39
  source: "ajv"
40
40
  });
41
41
  }
42
- return new MicroFrontendError(original.message);
42
+ return new MicrofrontendError(original.message);
43
43
  }
44
44
  static convertFSError(original, fileName) {
45
45
  if (original instanceof Error && "code" in original) {
46
46
  if (original.code === "ENOENT") {
47
- return new MicroFrontendError(`Could not find "${fileName}"`, {
47
+ return new MicrofrontendError(`Could not find "${fileName}"`, {
48
48
  type: "config",
49
49
  subtype: "unable_to_read_file",
50
50
  source: "fs"
51
51
  });
52
52
  }
53
53
  if (original.code === "EACCES") {
54
- return new MicroFrontendError(
54
+ return new MicrofrontendError(
55
55
  `Permission denied while accessing "${fileName}"`,
56
56
  {
57
57
  type: "config",
@@ -62,7 +62,7 @@ var MicroFrontendError = class extends Error {
62
62
  }
63
63
  }
64
64
  if (original instanceof SyntaxError) {
65
- return new MicroFrontendError(
65
+ return new MicrofrontendError(
66
66
  `Failed to parse "${fileName}": Invalid JSON format.`,
67
67
  {
68
68
  type: "config",
@@ -74,23 +74,23 @@ var MicroFrontendError = class extends Error {
74
74
  return null;
75
75
  }
76
76
  /**
77
- * Handles an unknown error and returns a MicroFrontendsError instance.
77
+ * Handles an unknown error and returns a MicrofrontendsError instance.
78
78
  * @param err - The error to handle.
79
- * @returns A MicroFrontendsError instance.
79
+ * @returns A MicrofrontendsError instance.
80
80
  */
81
81
  static handle(err, opts) {
82
- if (err instanceof MicroFrontendError) {
82
+ if (err instanceof MicrofrontendError) {
83
83
  return err;
84
84
  }
85
85
  if (err instanceof Error) {
86
- return MicroFrontendError.convert(err, opts);
86
+ return MicrofrontendError.convert(err, opts);
87
87
  }
88
88
  if (typeof err === "object" && err !== null) {
89
89
  if ("message" in err && typeof err.message === "string") {
90
- return MicroFrontendError.convert(new Error(err.message), opts);
90
+ return MicrofrontendError.convert(new Error(err.message), opts);
91
91
  }
92
92
  }
93
- return new MicroFrontendError("An unknown error occurred");
93
+ return new MicrofrontendError("An unknown error occurred");
94
94
  }
95
95
  };
96
96
 
@@ -368,7 +368,7 @@ function validateSchema(configString) {
368
368
  const validate = ajv.compile(SCHEMA);
369
369
  const isValid = validate(parsedConfig);
370
370
  if (!isValid) {
371
- throw new MicroFrontendError(
371
+ throw new MicrofrontendError(
372
372
  `Invalid config: ${ajv.errorsText(validate.errors)}`,
373
373
  { type: "config", subtype: "does_not_match_schema" }
374
374
  );
@@ -712,7 +712,7 @@ var validateSchema2 = (configString) => {
712
712
  const validate = ajv.compile(SCHEMA2);
713
713
  const isValid = validate(parsedConfig);
714
714
  if (!isValid) {
715
- throw new MicroFrontendError(
715
+ throw new MicrofrontendError(
716
716
  `Invalid config: ${ajv.errorsText(validate.errors)}`,
717
717
  { type: "config", subtype: "does_not_match_schema" }
718
718
  );