@vercel/microfrontends 2.2.1 → 2.2.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 (59) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/cli/index.cjs +0 -1
  3. package/dist/bin/cli.cjs +483 -394
  4. package/dist/config.cjs +191 -169
  5. package/dist/config.cjs.map +1 -1
  6. package/dist/config.d.ts +3 -2
  7. package/dist/config.js +192 -170
  8. package/dist/config.js.map +1 -1
  9. package/dist/experimental/sveltekit.cjs +583 -511
  10. package/dist/experimental/sveltekit.cjs.map +1 -1
  11. package/dist/experimental/sveltekit.js +589 -517
  12. package/dist/experimental/sveltekit.js.map +1 -1
  13. package/dist/experimental/vite.cjs +605 -533
  14. package/dist/experimental/vite.cjs.map +1 -1
  15. package/dist/experimental/vite.js +614 -542
  16. package/dist/experimental/vite.js.map +1 -1
  17. package/dist/microfrontends/server.cjs +601 -529
  18. package/dist/microfrontends/server.cjs.map +1 -1
  19. package/dist/microfrontends/server.d.ts +2 -2
  20. package/dist/microfrontends/server.js +607 -535
  21. package/dist/microfrontends/server.js.map +1 -1
  22. package/dist/microfrontends/utils.cjs +101 -50
  23. package/dist/microfrontends/utils.cjs.map +1 -1
  24. package/dist/microfrontends/utils.d.ts +4 -4
  25. package/dist/microfrontends/utils.js +102 -51
  26. package/dist/microfrontends/utils.js.map +1 -1
  27. package/dist/next/client.cjs +1 -1
  28. package/dist/next/client.cjs.map +1 -1
  29. package/dist/next/client.d.ts +8 -8
  30. package/dist/next/client.js +1 -1
  31. package/dist/next/client.js.map +1 -1
  32. package/dist/next/config.cjs +723 -647
  33. package/dist/next/config.cjs.map +1 -1
  34. package/dist/next/config.js +720 -644
  35. package/dist/next/config.js.map +1 -1
  36. package/dist/next/middleware.cjs +244 -222
  37. package/dist/next/middleware.cjs.map +1 -1
  38. package/dist/next/middleware.js +245 -223
  39. package/dist/next/middleware.js.map +1 -1
  40. package/dist/next/testing.cjs +192 -170
  41. package/dist/next/testing.cjs.map +1 -1
  42. package/dist/next/testing.d.ts +1 -1
  43. package/dist/next/testing.js +193 -171
  44. package/dist/next/testing.js.map +1 -1
  45. package/dist/overrides.cjs +5 -5
  46. package/dist/overrides.cjs.map +1 -1
  47. package/dist/overrides.d.ts +9 -9
  48. package/dist/overrides.js +5 -5
  49. package/dist/overrides.js.map +1 -1
  50. package/dist/utils/mfe-port.cjs +620 -533
  51. package/dist/utils/mfe-port.cjs.map +1 -1
  52. package/dist/utils/mfe-port.d.ts +9 -1
  53. package/dist/utils/mfe-port.js +632 -546
  54. package/dist/utils/mfe-port.js.map +1 -1
  55. package/dist/validation.cjs +8 -24
  56. package/dist/validation.cjs.map +1 -1
  57. package/dist/validation.js +8 -24
  58. package/dist/validation.js.map +1 -1
  59. package/package.json +4 -6
@@ -25,8 +25,8 @@ __export(validation_exports, {
25
25
  module.exports = __toCommonJS(validation_exports);
26
26
 
27
27
  // src/config/microfrontends/server/validation.ts
28
- var import_jsonc_parser = require("jsonc-parser");
29
28
  var import_ajv = require("ajv");
29
+ var import_jsonc_parser = require("jsonc-parser");
30
30
 
31
31
  // src/config/errors.ts
32
32
  var MicrofrontendError = class extends Error {
@@ -146,9 +146,7 @@ var schema_default = {
146
146
  description: "Optional configuration options for the microfrontend."
147
147
  }
148
148
  },
149
- required: [
150
- "applications"
151
- ],
149
+ required: ["applications"],
152
150
  additionalProperties: false,
153
151
  description: "The microfrontends configuration schema. See https://vercel.com/docs/microfrontends/configuration."
154
152
  },
@@ -185,19 +183,14 @@ var schema_default = {
185
183
  description: "Development configuration for the default application."
186
184
  }
187
185
  },
188
- required: [
189
- "development"
190
- ],
186
+ required: ["development"],
191
187
  additionalProperties: false
192
188
  },
193
189
  DefaultDevelopment: {
194
190
  type: "object",
195
191
  properties: {
196
192
  local: {
197
- type: [
198
- "number",
199
- "string"
200
- ],
193
+ type: ["number", "string"],
201
194
  description: "A local port number or host that this application runs on when it is running locally. If passing a string, include the protocol (optional), host (required) and port (optional).\n\nExamples of valid values: 8080, my.localhost.me, my.localhost.me:8080, https://my.localhost.me, https://my.localhost.me:8080.\n\nThe default value is http://localhost:<port> where port is a stable, unique port number (based on the application name).\n\nSee https://vercel.com/docs/microfrontends/local-development."
202
195
  },
203
196
  task: {
@@ -209,9 +202,7 @@ var schema_default = {
209
202
  description: "Fallback for local development, could point to any environment. This is required for the default app. This value is used as the fallback for child apps as well if they do not have a fallback.\n\nIf passing a string, include the protocol (optional), host (required) and port (optional). For example: `https://this.ismyhost:8080`. If omitted, the protocol defaults to HTTPS. If omitted, the port defaults to `80` for HTTP and `443` for HTTPS.\n\nSee https://vercel.com/docs/microfrontends/local-development."
210
203
  }
211
204
  },
212
- required: [
213
- "fallback"
214
- ],
205
+ required: ["fallback"],
215
206
  additionalProperties: false
216
207
  },
217
208
  ChildApplication: {
@@ -234,19 +225,14 @@ var schema_default = {
234
225
  description: "The name of the asset prefix to use instead of the auto-generated name.\n\nThe asset prefix is used to prefix all paths to static assets, such as JS, CSS, or images that are served by a specific application. It is necessary to ensure there are no conflicts with other applications on the same domain.\n\nAn auto-generated asset prefix of the form `vc-ap-<hash>` is used when this field is not provided.\n\nWhen this field is provided, `/${assetPrefix}/:path*` must also be added to the list of paths in the `routing` field. Changing the asset prefix after a microfrontend application has already been deployed is not a forwards and backwards compatible change, and the asset prefix should be added to the `routing` field and deployed before setting the `assetPrefix` field.\n\nThe default value is the auto-generated asset prefix of the form `vc-ap-<hash>`.\n\nSee https://vercel.com/docs/microfrontends/path-routing#asset-prefix."
235
226
  }
236
227
  },
237
- required: [
238
- "routing"
239
- ],
228
+ required: ["routing"],
240
229
  additionalProperties: false
241
230
  },
242
231
  ChildDevelopment: {
243
232
  type: "object",
244
233
  properties: {
245
234
  local: {
246
- type: [
247
- "number",
248
- "string"
249
- ],
235
+ type: ["number", "string"],
250
236
  description: "A local port number or host that this application runs on when it is running locally. If passing a string, include the protocol (optional), host (required) and port (optional).\n\nExamples of valid values: 8080, my.localhost.me, my.localhost.me:8080, https://my.localhost.me, https://my.localhost.me:8080.\n\nThe default value is http://localhost:<port> where port is a stable, unique port number (based on the application name).\n\nSee https://vercel.com/docs/microfrontends/local-development."
251
237
  },
252
238
  task: {
@@ -286,9 +272,7 @@ var schema_default = {
286
272
  description: "A list of path expressions that are routed to this application. See https://vercel.com/docs/microfrontends/path-routing#supported-path-expressions."
287
273
  }
288
274
  },
289
- required: [
290
- "paths"
291
- ],
275
+ required: ["paths"],
292
276
  additionalProperties: false,
293
277
  description: "A group of paths that is routed to this application."
294
278
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/schema/validation.ts","../src/config/microfrontends/server/validation.ts","../src/config/errors.ts","../schema/schema.json","../src/config/schema/utils/load.ts"],"sourcesContent":["export { validateSchema } from '../config/microfrontends/server/validation';\n","import { parse } from 'jsonc-parser';\nimport { Ajv, type ErrorObject } from 'ajv';\nimport type { Config } from '../../schema/types';\nimport { MicrofrontendError } from '../../errors';\nimport { SCHEMA } from '../../schema/utils/load';\n\nconst LIST_FORMATTER = new Intl.ListFormat('en', {\n style: 'long',\n type: 'disjunction',\n});\n\nfunction formatAjvErrors(errors: ErrorObject[] | null | undefined): string[] {\n if (!errors) {\n return [];\n }\n const errorMessages: string[] = [];\n for (const error of errors) {\n // Ignore root errors that arise because AJV can't infer whether the config is a main config or a child config.\n // These errors are confusing for the user.\n if (\n error.instancePath === '' &&\n (error.keyword === 'anyOf' ||\n (error.keyword === 'required' &&\n error.params.missingProperty === 'partOf'))\n ) {\n continue;\n }\n\n // Ignore the first leading slash in the instance path to make the path more readable.\n const instancePath = error.instancePath.slice(1);\n const formattedInstancePath =\n instancePath === '' ? 'at the root' : `in field ${instancePath}`;\n\n // AJV errors are really cryptic, so this logic transforms them to nicer ones.\n // It is based on heuristics from introducing errors and observing what AJV produces.\n if (\n error.keyword === 'required' &&\n error.params.missingProperty === 'routing' &&\n instancePath.split('/').length === 2\n ) {\n errorMessages.push(\n `Unable to infer if ${instancePath} is the default app or a child app. This usually means that there is another error in the configuration.`,\n );\n } else if (\n error.keyword === 'anyOf' &&\n instancePath.split('/').length > 2\n ) {\n const anyOfErrors = errors.filter(\n (e) => e.instancePath === error.instancePath && e.keyword !== 'anyOf',\n );\n if (anyOfErrors.every((e) => e.keyword === 'type')) {\n const allowedTypes = LIST_FORMATTER.format(\n anyOfErrors.map((e) => {\n return e.keyword === 'type' ? String(e.params.type) : 'unknown';\n }),\n );\n errorMessages.push(\n `Incorrect type for ${instancePath}. Must be one of ${allowedTypes}`,\n );\n } else {\n errorMessages.push(\n `Invalid field for ${instancePath}. Possible error messages are ${LIST_FORMATTER.format(anyOfErrors.map((e) => e.message ?? ''))}`,\n );\n }\n } else if (\n error.keyword === 'additionalProperties' &&\n !(\n error.params.additionalProperty === 'routing' &&\n instancePath.split('/').length === 2\n )\n ) {\n errorMessages.push(\n `Property '${error.params.additionalProperty}' is not allowed ${formattedInstancePath}`,\n );\n } else if (error.keyword === 'required') {\n errorMessages.push(\n `Property '${error.params.missingProperty}' is required ${formattedInstancePath}`,\n );\n }\n }\n return errorMessages;\n}\n\nexport function validateSchema(configString: string): Config {\n const parsedConfig = parse(configString) as Config;\n\n const ajv = new Ajv({ allowUnionTypes: true });\n const validate = ajv.compile(SCHEMA);\n const isValid = validate(parsedConfig);\n if (!isValid) {\n throw new MicrofrontendError(\n `Invalid microfrontends config:${formatAjvErrors(validate.errors)\n .map((error) => `\\n - ${error}`)\n .join(\n '',\n )}\\n\\nSee https://openapi.vercel.sh/microfrontends.json for the schema.`,\n { type: 'config', subtype: 'does_not_match_schema' },\n );\n }\n\n return parsedConfig;\n}\n","export type MicrofrontendErrorType =\n | 'config'\n | 'packageJson'\n | 'vercelJson'\n | 'application'\n | 'unknown';\n\nexport type MicrofrontendErrorSubtype =\n | 'not_found'\n | 'inference_failed'\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 application:\n | 'invalid_asset_prefix'\n | 'invalid_path'\n | 'multiple_package_managers'\n | 'not_found';\n config:\n | 'conflicting_paths'\n | 'depcrecated_field'\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 | 'inference_failed'\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 cause?: unknown;\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, { cause: opts?.cause });\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 \"type\": \"object\",\n \"properties\": {\n \"$schema\": {\n \"type\": \"string\",\n \"description\": \"See https://openapi.vercel.sh/microfrontends.json.\"\n },\n \"version\": {\n \"type\": \"string\",\n \"const\": \"1\",\n \"description\": \"The version of the microfrontends config schema.\"\n },\n \"applications\": {\n \"$ref\": \"#/definitions/ApplicationRouting\",\n \"description\": \"Mapping of Vercel project names to their microfrontend configurations.\"\n },\n \"options\": {\n \"$ref\": \"#/definitions/Options\",\n \"description\": \"Optional configuration options for the microfrontend.\"\n }\n },\n \"required\": [\n \"applications\"\n ],\n \"additionalProperties\": false,\n \"description\": \"The microfrontends configuration schema. See https://vercel.com/docs/microfrontends/configuration.\"\n },\n \"ApplicationRouting\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/Application\"\n },\n \"propertyNames\": {\n \"description\": \"The Vercel project name of the microfrontend application.\\n\\nNote: If this name does not also match the name `name` from the `package.json`, set `packageName` with the name used in `package.json`.\\n\\nSee https://vercel.com/docs/microfrontends/configuration#application-naming.\"\n },\n \"description\": \"Mapping of Vercel project names to their microfrontend configurations.\"\n },\n \"Application\": {\n \"anyOf\": [\n {\n \"$ref\": \"#/definitions/DefaultApplication\"\n },\n {\n \"$ref\": \"#/definitions/ChildApplication\"\n }\n ],\n \"description\": \"The configuration for a microfrontend application. There must always be one default application.\"\n },\n \"DefaultApplication\": {\n \"type\": \"object\",\n \"properties\": {\n \"packageName\": {\n \"type\": \"string\",\n \"description\": \"The name used to run the application, e.g. the `name` field in the `package.json`.\\n\\nThis is used by the local proxy to map the application config to the locally running app.\\n\\nThis is only necessary when the application name does not match the `name` used in `package.json`.\\n\\nSee https://vercel.com/docs/microfrontends/configuration#application-naming.\"\n },\n \"development\": {\n \"$ref\": \"#/definitions/DefaultDevelopment\",\n \"description\": \"Development configuration for the default application.\"\n }\n },\n \"required\": [\n \"development\"\n ],\n \"additionalProperties\": false\n },\n \"DefaultDevelopment\": {\n \"type\": \"object\",\n \"properties\": {\n \"local\": {\n \"type\": [\n \"number\",\n \"string\"\n ],\n \"description\": \"A local port number or host that this application runs on when it is running locally. If passing a string, include the protocol (optional), host (required) and port (optional).\\n\\nExamples of valid values: 8080, my.localhost.me, my.localhost.me:8080, https://my.localhost.me, https://my.localhost.me:8080.\\n\\nThe default value is http://localhost:<port> where port is a stable, unique port number (based on the application name).\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n },\n \"task\": {\n \"type\": \"string\",\n \"description\": \"The task to run when starting the development server. Should reference a script in the package.json of the application.\\n\\nThe default value is \\\"dev\\\".\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n },\n \"fallback\": {\n \"type\": \"string\",\n \"description\": \"Fallback for local development, could point to any environment. This is required for the default app. This value is used as the fallback for child apps as well if they do not have a fallback.\\n\\nIf passing a string, include the protocol (optional), host (required) and port (optional). For example: `https://this.ismyhost:8080`. If omitted, the protocol defaults to HTTPS. If omitted, the port defaults to `80` for HTTP and `443` for HTTPS.\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n }\n },\n \"required\": [\n \"fallback\"\n ],\n \"additionalProperties\": false\n },\n \"ChildApplication\": {\n \"type\": \"object\",\n \"properties\": {\n \"packageName\": {\n \"type\": \"string\",\n \"description\": \"The name used to run the application, e.g. the `name` field in the `package.json`.\\n\\nThis is used by the local proxy to map the application config to the locally running app.\\n\\nThis is only necessary when the application name does not match the `name` used in `package.json`.\\n\\nSee https://vercel.com/docs/microfrontends/configuration#application-naming.\"\n },\n \"development\": {\n \"$ref\": \"#/definitions/ChildDevelopment\",\n \"description\": \"Development configuration for the child application.\"\n },\n \"routing\": {\n \"$ref\": \"#/definitions/Routing\",\n \"description\": \"Groups of path expressions that are routed to this application.\\n\\nSee https://vercel.com/docs/microfrontends/path-routing.\"\n },\n \"assetPrefix\": {\n \"type\": \"string\",\n \"description\": \"The name of the asset prefix to use instead of the auto-generated name.\\n\\nThe asset prefix is used to prefix all paths to static assets, such as JS, CSS, or images that are served by a specific application. It is necessary to ensure there are no conflicts with other applications on the same domain.\\n\\nAn auto-generated asset prefix of the form `vc-ap-<hash>` is used when this field is not provided.\\n\\nWhen this field is provided, `/${assetPrefix}/:path*` must also be added to the list of paths in the `routing` field. Changing the asset prefix after a microfrontend application has already been deployed is not a forwards and backwards compatible change, and the asset prefix should be added to the `routing` field and deployed before setting the `assetPrefix` field.\\n\\nThe default value is the auto-generated asset prefix of the form `vc-ap-<hash>`.\\n\\nSee https://vercel.com/docs/microfrontends/path-routing#asset-prefix.\"\n }\n },\n \"required\": [\n \"routing\"\n ],\n \"additionalProperties\": false\n },\n \"ChildDevelopment\": {\n \"type\": \"object\",\n \"properties\": {\n \"local\": {\n \"type\": [\n \"number\",\n \"string\"\n ],\n \"description\": \"A local port number or host that this application runs on when it is running locally. If passing a string, include the protocol (optional), host (required) and port (optional).\\n\\nExamples of valid values: 8080, my.localhost.me, my.localhost.me:8080, https://my.localhost.me, https://my.localhost.me:8080.\\n\\nThe default value is http://localhost:<port> where port is a stable, unique port number (based on the application name).\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n },\n \"task\": {\n \"type\": \"string\",\n \"description\": \"The task to run when starting the development server. Should reference a script in the package.json of the application.\\n\\nThe default value is \\\"dev\\\".\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n },\n \"fallback\": {\n \"type\": \"string\",\n \"description\": \"Fallback for local development, could point to any environment. If not provided for child apps, the fallback of the default app will be used.\\n\\nIf passing a string, include the protocol (optional), host (required) and port (optional). For example: `https://this.ismyhost:8080`. If omitted, the protocol defaults to HTTPS. If omitted, the port defaults to `80` for HTTP and `443` for HTTPS.\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n }\n },\n \"additionalProperties\": false\n },\n \"Routing\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/definitions/PathGroup\"\n },\n \"description\": \"A list of path groups that are routed to this application.\"\n },\n \"PathGroup\": {\n \"type\": \"object\",\n \"properties\": {\n \"group\": {\n \"type\": \"string\",\n \"description\": \"Group name for the paths.\"\n },\n \"flag\": {\n \"type\": \"string\",\n \"description\": \"The name of the feature flag that controls routing for this group of paths. See https://vercel.com/docs/microfrontends/path-routing#routing-changes-safely-with-flags.\"\n },\n \"paths\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"description\": \"A list of path expressions that are routed to this application. See https://vercel.com/docs/microfrontends/path-routing#supported-path-expressions.\"\n }\n },\n \"required\": [\n \"paths\"\n ],\n \"additionalProperties\": false,\n \"description\": \"A group of paths that is routed to this application.\"\n },\n \"Options\": {\n \"type\": \"object\",\n \"properties\": {\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\\nSee https://vercel.com/docs/microfrontends/managing-microfrontends/vercel-toolbar#routing-overrides.\"\n },\n \"localProxyPort\": {\n \"type\": \"number\",\n \"description\": \"The port number used by the local proxy server.\\n\\nThe default value is 3024.\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n }\n },\n \"additionalProperties\": false\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;AAAA;AAAA;;;ACAA,0BAAsB;AACtB,iBAAsC;;;AC4E/B,IAAM,qBAAN,cAEG,MAAM;AAAA,EAKd,YAAY,SAAiB,MAAqC;AAChE,UAAM,SAAS,EAAE,OAAO,MAAM,MAAM,CAAC;AACrC,SAAK,OAAO;AACZ,SAAK,SAAS,MAAM,UAAU;AAC9B,SAAK,OAAO,MAAM,QAAS;AAC3B,SAAK,UAAU,MAAM;AACrB,UAAM,kBAAkB,MAAM,kBAAkB;AAAA,EAClD;AA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M,EAC7D,IAAI,CAAC,UAAU;AAAA,KAAQ,OAAO,EAC9B;AAAA,QACC;AAAA,MACF;AAAA;AAAA;AAAA,MACF,EAAE,MAAM,UAAU,SAAS,wBAAwB;AAAA,IACrD;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/schema/validation.ts","../src/config/microfrontends/server/validation.ts","../src/config/errors.ts","../schema/schema.json","../src/config/schema/utils/load.ts"],"sourcesContent":["export { validateSchema } from '../config/microfrontends/server/validation';\n","import { Ajv, type ErrorObject } from 'ajv';\nimport { parse } from 'jsonc-parser';\nimport { MicrofrontendError } from '../../errors';\nimport type { Config } from '../../schema/types';\nimport { SCHEMA } from '../../schema/utils/load';\n\nconst LIST_FORMATTER = new Intl.ListFormat('en', {\n style: 'long',\n type: 'disjunction',\n});\n\nfunction formatAjvErrors(errors: ErrorObject[] | null | undefined): string[] {\n if (!errors) {\n return [];\n }\n const errorMessages: string[] = [];\n for (const error of errors) {\n // Ignore root errors that arise because AJV can't infer whether the config is a main config or a child config.\n // These errors are confusing for the user.\n if (\n error.instancePath === '' &&\n (error.keyword === 'anyOf' ||\n (error.keyword === 'required' &&\n error.params.missingProperty === 'partOf'))\n ) {\n continue;\n }\n\n // Ignore the first leading slash in the instance path to make the path more readable.\n const instancePath = error.instancePath.slice(1);\n const formattedInstancePath =\n instancePath === '' ? 'at the root' : `in field ${instancePath}`;\n\n // AJV errors are really cryptic, so this logic transforms them to nicer ones.\n // It is based on heuristics from introducing errors and observing what AJV produces.\n if (\n error.keyword === 'required' &&\n error.params.missingProperty === 'routing' &&\n instancePath.split('/').length === 2\n ) {\n errorMessages.push(\n `Unable to infer if ${instancePath} is the default app or a child app. This usually means that there is another error in the configuration.`,\n );\n } else if (\n error.keyword === 'anyOf' &&\n instancePath.split('/').length > 2\n ) {\n const anyOfErrors = errors.filter(\n (e) => e.instancePath === error.instancePath && e.keyword !== 'anyOf',\n );\n if (anyOfErrors.every((e) => e.keyword === 'type')) {\n const allowedTypes = LIST_FORMATTER.format(\n anyOfErrors.map((e) => {\n return e.keyword === 'type' ? String(e.params.type) : 'unknown';\n }),\n );\n errorMessages.push(\n `Incorrect type for ${instancePath}. Must be one of ${allowedTypes}`,\n );\n } else {\n errorMessages.push(\n `Invalid field for ${instancePath}. Possible error messages are ${LIST_FORMATTER.format(anyOfErrors.map((e) => e.message ?? ''))}`,\n );\n }\n } else if (\n error.keyword === 'additionalProperties' &&\n !(\n error.params.additionalProperty === 'routing' &&\n instancePath.split('/').length === 2\n )\n ) {\n errorMessages.push(\n `Property '${error.params.additionalProperty}' is not allowed ${formattedInstancePath}`,\n );\n } else if (error.keyword === 'required') {\n errorMessages.push(\n `Property '${error.params.missingProperty}' is required ${formattedInstancePath}`,\n );\n }\n }\n return errorMessages;\n}\n\nexport function validateSchema(configString: string): Config {\n const parsedConfig = parse(configString) as Config;\n\n const ajv = new Ajv({ allowUnionTypes: true });\n const validate = ajv.compile(SCHEMA);\n const isValid = validate(parsedConfig);\n if (!isValid) {\n throw new MicrofrontendError(\n `Invalid microfrontends config:${formatAjvErrors(validate.errors)\n .map((error) => `\\n - ${error}`)\n .join(\n '',\n )}\\n\\nSee https://openapi.vercel.sh/microfrontends.json for the schema.`,\n { type: 'config', subtype: 'does_not_match_schema' },\n );\n }\n\n return parsedConfig;\n}\n","export type MicrofrontendErrorType =\n | 'config'\n | 'packageJson'\n | 'vercelJson'\n | 'application'\n | 'unknown';\n\nexport type MicrofrontendErrorSubtype =\n | 'not_found'\n | 'inference_failed'\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 application:\n | 'invalid_asset_prefix'\n | 'invalid_path'\n | 'multiple_package_managers'\n | 'not_found';\n config:\n | 'conflicting_paths'\n | 'depcrecated_field'\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 | 'inference_failed'\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 cause?: unknown;\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, { cause: opts?.cause });\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 \"type\": \"object\",\n \"properties\": {\n \"$schema\": {\n \"type\": \"string\",\n \"description\": \"See https://openapi.vercel.sh/microfrontends.json.\"\n },\n \"version\": {\n \"type\": \"string\",\n \"const\": \"1\",\n \"description\": \"The version of the microfrontends config schema.\"\n },\n \"applications\": {\n \"$ref\": \"#/definitions/ApplicationRouting\",\n \"description\": \"Mapping of Vercel project names to their microfrontend configurations.\"\n },\n \"options\": {\n \"$ref\": \"#/definitions/Options\",\n \"description\": \"Optional configuration options for the microfrontend.\"\n }\n },\n \"required\": [\"applications\"],\n \"additionalProperties\": false,\n \"description\": \"The microfrontends configuration schema. See https://vercel.com/docs/microfrontends/configuration.\"\n },\n \"ApplicationRouting\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/Application\"\n },\n \"propertyNames\": {\n \"description\": \"The Vercel project name of the microfrontend application.\\n\\nNote: If this name does not also match the name `name` from the `package.json`, set `packageName` with the name used in `package.json`.\\n\\nSee https://vercel.com/docs/microfrontends/configuration#application-naming.\"\n },\n \"description\": \"Mapping of Vercel project names to their microfrontend configurations.\"\n },\n \"Application\": {\n \"anyOf\": [\n {\n \"$ref\": \"#/definitions/DefaultApplication\"\n },\n {\n \"$ref\": \"#/definitions/ChildApplication\"\n }\n ],\n \"description\": \"The configuration for a microfrontend application. There must always be one default application.\"\n },\n \"DefaultApplication\": {\n \"type\": \"object\",\n \"properties\": {\n \"packageName\": {\n \"type\": \"string\",\n \"description\": \"The name used to run the application, e.g. the `name` field in the `package.json`.\\n\\nThis is used by the local proxy to map the application config to the locally running app.\\n\\nThis is only necessary when the application name does not match the `name` used in `package.json`.\\n\\nSee https://vercel.com/docs/microfrontends/configuration#application-naming.\"\n },\n \"development\": {\n \"$ref\": \"#/definitions/DefaultDevelopment\",\n \"description\": \"Development configuration for the default application.\"\n }\n },\n \"required\": [\"development\"],\n \"additionalProperties\": false\n },\n \"DefaultDevelopment\": {\n \"type\": \"object\",\n \"properties\": {\n \"local\": {\n \"type\": [\"number\", \"string\"],\n \"description\": \"A local port number or host that this application runs on when it is running locally. If passing a string, include the protocol (optional), host (required) and port (optional).\\n\\nExamples of valid values: 8080, my.localhost.me, my.localhost.me:8080, https://my.localhost.me, https://my.localhost.me:8080.\\n\\nThe default value is http://localhost:<port> where port is a stable, unique port number (based on the application name).\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n },\n \"task\": {\n \"type\": \"string\",\n \"description\": \"The task to run when starting the development server. Should reference a script in the package.json of the application.\\n\\nThe default value is \\\"dev\\\".\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n },\n \"fallback\": {\n \"type\": \"string\",\n \"description\": \"Fallback for local development, could point to any environment. This is required for the default app. This value is used as the fallback for child apps as well if they do not have a fallback.\\n\\nIf passing a string, include the protocol (optional), host (required) and port (optional). For example: `https://this.ismyhost:8080`. If omitted, the protocol defaults to HTTPS. If omitted, the port defaults to `80` for HTTP and `443` for HTTPS.\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n }\n },\n \"required\": [\"fallback\"],\n \"additionalProperties\": false\n },\n \"ChildApplication\": {\n \"type\": \"object\",\n \"properties\": {\n \"packageName\": {\n \"type\": \"string\",\n \"description\": \"The name used to run the application, e.g. the `name` field in the `package.json`.\\n\\nThis is used by the local proxy to map the application config to the locally running app.\\n\\nThis is only necessary when the application name does not match the `name` used in `package.json`.\\n\\nSee https://vercel.com/docs/microfrontends/configuration#application-naming.\"\n },\n \"development\": {\n \"$ref\": \"#/definitions/ChildDevelopment\",\n \"description\": \"Development configuration for the child application.\"\n },\n \"routing\": {\n \"$ref\": \"#/definitions/Routing\",\n \"description\": \"Groups of path expressions that are routed to this application.\\n\\nSee https://vercel.com/docs/microfrontends/path-routing.\"\n },\n \"assetPrefix\": {\n \"type\": \"string\",\n \"description\": \"The name of the asset prefix to use instead of the auto-generated name.\\n\\nThe asset prefix is used to prefix all paths to static assets, such as JS, CSS, or images that are served by a specific application. It is necessary to ensure there are no conflicts with other applications on the same domain.\\n\\nAn auto-generated asset prefix of the form `vc-ap-<hash>` is used when this field is not provided.\\n\\nWhen this field is provided, `/${assetPrefix}/:path*` must also be added to the list of paths in the `routing` field. Changing the asset prefix after a microfrontend application has already been deployed is not a forwards and backwards compatible change, and the asset prefix should be added to the `routing` field and deployed before setting the `assetPrefix` field.\\n\\nThe default value is the auto-generated asset prefix of the form `vc-ap-<hash>`.\\n\\nSee https://vercel.com/docs/microfrontends/path-routing#asset-prefix.\"\n }\n },\n \"required\": [\"routing\"],\n \"additionalProperties\": false\n },\n \"ChildDevelopment\": {\n \"type\": \"object\",\n \"properties\": {\n \"local\": {\n \"type\": [\"number\", \"string\"],\n \"description\": \"A local port number or host that this application runs on when it is running locally. If passing a string, include the protocol (optional), host (required) and port (optional).\\n\\nExamples of valid values: 8080, my.localhost.me, my.localhost.me:8080, https://my.localhost.me, https://my.localhost.me:8080.\\n\\nThe default value is http://localhost:<port> where port is a stable, unique port number (based on the application name).\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n },\n \"task\": {\n \"type\": \"string\",\n \"description\": \"The task to run when starting the development server. Should reference a script in the package.json of the application.\\n\\nThe default value is \\\"dev\\\".\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n },\n \"fallback\": {\n \"type\": \"string\",\n \"description\": \"Fallback for local development, could point to any environment. If not provided for child apps, the fallback of the default app will be used.\\n\\nIf passing a string, include the protocol (optional), host (required) and port (optional). For example: `https://this.ismyhost:8080`. If omitted, the protocol defaults to HTTPS. If omitted, the port defaults to `80` for HTTP and `443` for HTTPS.\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n }\n },\n \"additionalProperties\": false\n },\n \"Routing\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/definitions/PathGroup\"\n },\n \"description\": \"A list of path groups that are routed to this application.\"\n },\n \"PathGroup\": {\n \"type\": \"object\",\n \"properties\": {\n \"group\": {\n \"type\": \"string\",\n \"description\": \"Group name for the paths.\"\n },\n \"flag\": {\n \"type\": \"string\",\n \"description\": \"The name of the feature flag that controls routing for this group of paths. See https://vercel.com/docs/microfrontends/path-routing#routing-changes-safely-with-flags.\"\n },\n \"paths\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"description\": \"A list of path expressions that are routed to this application. See https://vercel.com/docs/microfrontends/path-routing#supported-path-expressions.\"\n }\n },\n \"required\": [\"paths\"],\n \"additionalProperties\": false,\n \"description\": \"A group of paths that is routed to this application.\"\n },\n \"Options\": {\n \"type\": \"object\",\n \"properties\": {\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\\nSee https://vercel.com/docs/microfrontends/managing-microfrontends/vercel-toolbar#routing-overrides.\"\n },\n \"localProxyPort\": {\n \"type\": \"number\",\n \"description\": \"The port number used by the local proxy server.\\n\\nThe default value is 3024.\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n }\n },\n \"additionalProperties\": false\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;AAAA;AAAA;;;ACAA,iBAAsC;AACtC,0BAAsB;;;AC4Ef,IAAM,qBAAN,cAEG,MAAM;AAAA,EAKd,YAAY,SAAiB,MAAqC;AAChE,UAAM,SAAS,EAAE,OAAO,MAAM,MAAM,CAAC;AACrC,SAAK,OAAO;AACZ,SAAK,SAAS,MAAM,UAAU;AAC9B,SAAK,OAAO,MAAM,QAAS;AAC3B,SAAK,UAAU,MAAM;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,MAAM,UAAU;AAClB,YAAM,MAAM,m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AAC,MAAM,EAAE,YAAY,MAAM,GAAG;AAClD,cAAM,eAAe,eAAe;AAAA,UAClC,YAAY,IAAI,CAAC,MAAM;AACrB,mBAAO,EAAE,YAAY,SAAS,OAAO,EAAE,OAAO,IAAI,IAAI;AAAA,UACxD,CAAC;AAAA,QACH;AACA,sBAAc;AAAA,UACZ,sBAAsB,gCAAgC;AAAA,QACxD;AAAA,MACF,OAAO;AACL,sBAAc;AAAA,UACZ,qBAAqB,6CAA6C,eAAe,OAAO,YAAY,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC;AAAA,QACjI;AAAA,MACF;AAAA,IACF,WACE,MAAM,YAAY,0BAClB,EACE,MAAM,OAAO,uBAAuB,aACpC,aAAa,MAAM,GAAG,EAAE,WAAW,IAErC;AACA,oBAAc;AAAA,QACZ,aAAa,MAAM,OAAO,sCAAsC;AAAA,MAClE;AAAA,IACF,WAAW,MAAM,YAAY,YAAY;AACvC,oBAAc;AAAA,QACZ,aAAa,MAAM,OAAO,gCAAgC;AAAA,MAC5D;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAEO,SAAS,eAAe,cAA8B;AAC3D,QAAM,mBAAe,2BAAM,YAAY;AAEvC,QAAM,MAAM,IAAI,eAAI,EAAE,iBAAiB,KAAK,CAAC;AAC7C,QAAM,WAAW,IAAI,QAAQ,MAAM;AACnC,QAAM,UAAU,SAAS,YAAY;AACrC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI;AAAA,MACR,iCAAiC,gBAAgB,SAAS,MAAM,EAC7D,IAAI,CAAC,UAAU;AAAA,KAAQ,OAAO,EAC9B;AAAA,QACC;AAAA,MACF;AAAA;AAAA;AAAA,MACF,EAAE,MAAM,UAAU,SAAS,wBAAwB;AAAA,IACrD;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -1,6 +1,6 @@
1
1
  // src/config/microfrontends/server/validation.ts
2
- import { parse } from "jsonc-parser";
3
2
  import { Ajv } from "ajv";
3
+ import { parse } from "jsonc-parser";
4
4
 
5
5
  // src/config/errors.ts
6
6
  var MicrofrontendError = class extends Error {
@@ -120,9 +120,7 @@ var schema_default = {
120
120
  description: "Optional configuration options for the microfrontend."
121
121
  }
122
122
  },
123
- required: [
124
- "applications"
125
- ],
123
+ required: ["applications"],
126
124
  additionalProperties: false,
127
125
  description: "The microfrontends configuration schema. See https://vercel.com/docs/microfrontends/configuration."
128
126
  },
@@ -159,19 +157,14 @@ var schema_default = {
159
157
  description: "Development configuration for the default application."
160
158
  }
161
159
  },
162
- required: [
163
- "development"
164
- ],
160
+ required: ["development"],
165
161
  additionalProperties: false
166
162
  },
167
163
  DefaultDevelopment: {
168
164
  type: "object",
169
165
  properties: {
170
166
  local: {
171
- type: [
172
- "number",
173
- "string"
174
- ],
167
+ type: ["number", "string"],
175
168
  description: "A local port number or host that this application runs on when it is running locally. If passing a string, include the protocol (optional), host (required) and port (optional).\n\nExamples of valid values: 8080, my.localhost.me, my.localhost.me:8080, https://my.localhost.me, https://my.localhost.me:8080.\n\nThe default value is http://localhost:<port> where port is a stable, unique port number (based on the application name).\n\nSee https://vercel.com/docs/microfrontends/local-development."
176
169
  },
177
170
  task: {
@@ -183,9 +176,7 @@ var schema_default = {
183
176
  description: "Fallback for local development, could point to any environment. This is required for the default app. This value is used as the fallback for child apps as well if they do not have a fallback.\n\nIf passing a string, include the protocol (optional), host (required) and port (optional). For example: `https://this.ismyhost:8080`. If omitted, the protocol defaults to HTTPS. If omitted, the port defaults to `80` for HTTP and `443` for HTTPS.\n\nSee https://vercel.com/docs/microfrontends/local-development."
184
177
  }
185
178
  },
186
- required: [
187
- "fallback"
188
- ],
179
+ required: ["fallback"],
189
180
  additionalProperties: false
190
181
  },
191
182
  ChildApplication: {
@@ -208,19 +199,14 @@ var schema_default = {
208
199
  description: "The name of the asset prefix to use instead of the auto-generated name.\n\nThe asset prefix is used to prefix all paths to static assets, such as JS, CSS, or images that are served by a specific application. It is necessary to ensure there are no conflicts with other applications on the same domain.\n\nAn auto-generated asset prefix of the form `vc-ap-<hash>` is used when this field is not provided.\n\nWhen this field is provided, `/${assetPrefix}/:path*` must also be added to the list of paths in the `routing` field. Changing the asset prefix after a microfrontend application has already been deployed is not a forwards and backwards compatible change, and the asset prefix should be added to the `routing` field and deployed before setting the `assetPrefix` field.\n\nThe default value is the auto-generated asset prefix of the form `vc-ap-<hash>`.\n\nSee https://vercel.com/docs/microfrontends/path-routing#asset-prefix."
209
200
  }
210
201
  },
211
- required: [
212
- "routing"
213
- ],
202
+ required: ["routing"],
214
203
  additionalProperties: false
215
204
  },
216
205
  ChildDevelopment: {
217
206
  type: "object",
218
207
  properties: {
219
208
  local: {
220
- type: [
221
- "number",
222
- "string"
223
- ],
209
+ type: ["number", "string"],
224
210
  description: "A local port number or host that this application runs on when it is running locally. If passing a string, include the protocol (optional), host (required) and port (optional).\n\nExamples of valid values: 8080, my.localhost.me, my.localhost.me:8080, https://my.localhost.me, https://my.localhost.me:8080.\n\nThe default value is http://localhost:<port> where port is a stable, unique port number (based on the application name).\n\nSee https://vercel.com/docs/microfrontends/local-development."
225
211
  },
226
212
  task: {
@@ -260,9 +246,7 @@ var schema_default = {
260
246
  description: "A list of path expressions that are routed to this application. See https://vercel.com/docs/microfrontends/path-routing#supported-path-expressions."
261
247
  }
262
248
  },
263
- required: [
264
- "paths"
265
- ],
249
+ required: ["paths"],
266
250
  additionalProperties: false,
267
251
  description: "A group of paths that is routed to this application."
268
252
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/config/microfrontends/server/validation.ts","../src/config/errors.ts","../schema/schema.json","../src/config/schema/utils/load.ts"],"sourcesContent":["import { parse } from 'jsonc-parser';\nimport { Ajv, type ErrorObject } from 'ajv';\nimport type { Config } from '../../schema/types';\nimport { MicrofrontendError } from '../../errors';\nimport { SCHEMA } from '../../schema/utils/load';\n\nconst LIST_FORMATTER = new Intl.ListFormat('en', {\n style: 'long',\n type: 'disjunction',\n});\n\nfunction formatAjvErrors(errors: ErrorObject[] | null | undefined): string[] {\n if (!errors) {\n return [];\n }\n const errorMessages: string[] = [];\n for (const error of errors) {\n // Ignore root errors that arise because AJV can't infer whether the config is a main config or a child config.\n // These errors are confusing for the user.\n if (\n error.instancePath === '' &&\n (error.keyword === 'anyOf' ||\n (error.keyword === 'required' &&\n error.params.missingProperty === 'partOf'))\n ) {\n continue;\n }\n\n // Ignore the first leading slash in the instance path to make the path more readable.\n const instancePath = error.instancePath.slice(1);\n const formattedInstancePath =\n instancePath === '' ? 'at the root' : `in field ${instancePath}`;\n\n // AJV errors are really cryptic, so this logic transforms them to nicer ones.\n // It is based on heuristics from introducing errors and observing what AJV produces.\n if (\n error.keyword === 'required' &&\n error.params.missingProperty === 'routing' &&\n instancePath.split('/').length === 2\n ) {\n errorMessages.push(\n `Unable to infer if ${instancePath} is the default app or a child app. This usually means that there is another error in the configuration.`,\n );\n } else if (\n error.keyword === 'anyOf' &&\n instancePath.split('/').length > 2\n ) {\n const anyOfErrors = errors.filter(\n (e) => e.instancePath === error.instancePath && e.keyword !== 'anyOf',\n );\n if (anyOfErrors.every((e) => e.keyword === 'type')) {\n const allowedTypes = LIST_FORMATTER.format(\n anyOfErrors.map((e) => {\n return e.keyword === 'type' ? String(e.params.type) : 'unknown';\n }),\n );\n errorMessages.push(\n `Incorrect type for ${instancePath}. Must be one of ${allowedTypes}`,\n );\n } else {\n errorMessages.push(\n `Invalid field for ${instancePath}. Possible error messages are ${LIST_FORMATTER.format(anyOfErrors.map((e) => e.message ?? ''))}`,\n );\n }\n } else if (\n error.keyword === 'additionalProperties' &&\n !(\n error.params.additionalProperty === 'routing' &&\n instancePath.split('/').length === 2\n )\n ) {\n errorMessages.push(\n `Property '${error.params.additionalProperty}' is not allowed ${formattedInstancePath}`,\n );\n } else if (error.keyword === 'required') {\n errorMessages.push(\n `Property '${error.params.missingProperty}' is required ${formattedInstancePath}`,\n );\n }\n }\n return errorMessages;\n}\n\nexport function validateSchema(configString: string): Config {\n const parsedConfig = parse(configString) as Config;\n\n const ajv = new Ajv({ allowUnionTypes: true });\n const validate = ajv.compile(SCHEMA);\n const isValid = validate(parsedConfig);\n if (!isValid) {\n throw new MicrofrontendError(\n `Invalid microfrontends config:${formatAjvErrors(validate.errors)\n .map((error) => `\\n - ${error}`)\n .join(\n '',\n )}\\n\\nSee https://openapi.vercel.sh/microfrontends.json for the schema.`,\n { type: 'config', subtype: 'does_not_match_schema' },\n );\n }\n\n return parsedConfig;\n}\n","export type MicrofrontendErrorType =\n | 'config'\n | 'packageJson'\n | 'vercelJson'\n | 'application'\n | 'unknown';\n\nexport type MicrofrontendErrorSubtype =\n | 'not_found'\n | 'inference_failed'\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 application:\n | 'invalid_asset_prefix'\n | 'invalid_path'\n | 'multiple_package_managers'\n | 'not_found';\n config:\n | 'conflicting_paths'\n | 'depcrecated_field'\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 | 'inference_failed'\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 cause?: unknown;\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, { cause: opts?.cause });\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 \"type\": \"object\",\n \"properties\": {\n \"$schema\": {\n \"type\": \"string\",\n \"description\": \"See https://openapi.vercel.sh/microfrontends.json.\"\n },\n \"version\": {\n \"type\": \"string\",\n \"const\": \"1\",\n \"description\": \"The version of the microfrontends config schema.\"\n },\n \"applications\": {\n \"$ref\": \"#/definitions/ApplicationRouting\",\n \"description\": \"Mapping of Vercel project names to their microfrontend configurations.\"\n },\n \"options\": {\n \"$ref\": \"#/definitions/Options\",\n \"description\": \"Optional configuration options for the microfrontend.\"\n }\n },\n \"required\": [\n \"applications\"\n ],\n \"additionalProperties\": false,\n \"description\": \"The microfrontends configuration schema. See https://vercel.com/docs/microfrontends/configuration.\"\n },\n \"ApplicationRouting\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/Application\"\n },\n \"propertyNames\": {\n \"description\": \"The Vercel project name of the microfrontend application.\\n\\nNote: If this name does not also match the name `name` from the `package.json`, set `packageName` with the name used in `package.json`.\\n\\nSee https://vercel.com/docs/microfrontends/configuration#application-naming.\"\n },\n \"description\": \"Mapping of Vercel project names to their microfrontend configurations.\"\n },\n \"Application\": {\n \"anyOf\": [\n {\n \"$ref\": \"#/definitions/DefaultApplication\"\n },\n {\n \"$ref\": \"#/definitions/ChildApplication\"\n }\n ],\n \"description\": \"The configuration for a microfrontend application. There must always be one default application.\"\n },\n \"DefaultApplication\": {\n \"type\": \"object\",\n \"properties\": {\n \"packageName\": {\n \"type\": \"string\",\n \"description\": \"The name used to run the application, e.g. the `name` field in the `package.json`.\\n\\nThis is used by the local proxy to map the application config to the locally running app.\\n\\nThis is only necessary when the application name does not match the `name` used in `package.json`.\\n\\nSee https://vercel.com/docs/microfrontends/configuration#application-naming.\"\n },\n \"development\": {\n \"$ref\": \"#/definitions/DefaultDevelopment\",\n \"description\": \"Development configuration for the default application.\"\n }\n },\n \"required\": [\n \"development\"\n ],\n \"additionalProperties\": false\n },\n \"DefaultDevelopment\": {\n \"type\": \"object\",\n \"properties\": {\n \"local\": {\n \"type\": [\n \"number\",\n \"string\"\n ],\n \"description\": \"A local port number or host that this application runs on when it is running locally. If passing a string, include the protocol (optional), host (required) and port (optional).\\n\\nExamples of valid values: 8080, my.localhost.me, my.localhost.me:8080, https://my.localhost.me, https://my.localhost.me:8080.\\n\\nThe default value is http://localhost:<port> where port is a stable, unique port number (based on the application name).\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n },\n \"task\": {\n \"type\": \"string\",\n \"description\": \"The task to run when starting the development server. Should reference a script in the package.json of the application.\\n\\nThe default value is \\\"dev\\\".\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n },\n \"fallback\": {\n \"type\": \"string\",\n \"description\": \"Fallback for local development, could point to any environment. This is required for the default app. This value is used as the fallback for child apps as well if they do not have a fallback.\\n\\nIf passing a string, include the protocol (optional), host (required) and port (optional). For example: `https://this.ismyhost:8080`. If omitted, the protocol defaults to HTTPS. If omitted, the port defaults to `80` for HTTP and `443` for HTTPS.\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n }\n },\n \"required\": [\n \"fallback\"\n ],\n \"additionalProperties\": false\n },\n \"ChildApplication\": {\n \"type\": \"object\",\n \"properties\": {\n \"packageName\": {\n \"type\": \"string\",\n \"description\": \"The name used to run the application, e.g. the `name` field in the `package.json`.\\n\\nThis is used by the local proxy to map the application config to the locally running app.\\n\\nThis is only necessary when the application name does not match the `name` used in `package.json`.\\n\\nSee https://vercel.com/docs/microfrontends/configuration#application-naming.\"\n },\n \"development\": {\n \"$ref\": \"#/definitions/ChildDevelopment\",\n \"description\": \"Development configuration for the child application.\"\n },\n \"routing\": {\n \"$ref\": \"#/definitions/Routing\",\n \"description\": \"Groups of path expressions that are routed to this application.\\n\\nSee https://vercel.com/docs/microfrontends/path-routing.\"\n },\n \"assetPrefix\": {\n \"type\": \"string\",\n \"description\": \"The name of the asset prefix to use instead of the auto-generated name.\\n\\nThe asset prefix is used to prefix all paths to static assets, such as JS, CSS, or images that are served by a specific application. It is necessary to ensure there are no conflicts with other applications on the same domain.\\n\\nAn auto-generated asset prefix of the form `vc-ap-<hash>` is used when this field is not provided.\\n\\nWhen this field is provided, `/${assetPrefix}/:path*` must also be added to the list of paths in the `routing` field. Changing the asset prefix after a microfrontend application has already been deployed is not a forwards and backwards compatible change, and the asset prefix should be added to the `routing` field and deployed before setting the `assetPrefix` field.\\n\\nThe default value is the auto-generated asset prefix of the form `vc-ap-<hash>`.\\n\\nSee https://vercel.com/docs/microfrontends/path-routing#asset-prefix.\"\n }\n },\n \"required\": [\n \"routing\"\n ],\n \"additionalProperties\": false\n },\n \"ChildDevelopment\": {\n \"type\": \"object\",\n \"properties\": {\n \"local\": {\n \"type\": [\n \"number\",\n \"string\"\n ],\n \"description\": \"A local port number or host that this application runs on when it is running locally. If passing a string, include the protocol (optional), host (required) and port (optional).\\n\\nExamples of valid values: 8080, my.localhost.me, my.localhost.me:8080, https://my.localhost.me, https://my.localhost.me:8080.\\n\\nThe default value is http://localhost:<port> where port is a stable, unique port number (based on the application name).\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n },\n \"task\": {\n \"type\": \"string\",\n \"description\": \"The task to run when starting the development server. Should reference a script in the package.json of the application.\\n\\nThe default value is \\\"dev\\\".\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n },\n \"fallback\": {\n \"type\": \"string\",\n \"description\": \"Fallback for local development, could point to any environment. If not provided for child apps, the fallback of the default app will be used.\\n\\nIf passing a string, include the protocol (optional), host (required) and port (optional). For example: `https://this.ismyhost:8080`. If omitted, the protocol defaults to HTTPS. If omitted, the port defaults to `80` for HTTP and `443` for HTTPS.\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n }\n },\n \"additionalProperties\": false\n },\n \"Routing\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/definitions/PathGroup\"\n },\n \"description\": \"A list of path groups that are routed to this application.\"\n },\n \"PathGroup\": {\n \"type\": \"object\",\n \"properties\": {\n \"group\": {\n \"type\": \"string\",\n \"description\": \"Group name for the paths.\"\n },\n \"flag\": {\n \"type\": \"string\",\n \"description\": \"The name of the feature flag that controls routing for this group of paths. See https://vercel.com/docs/microfrontends/path-routing#routing-changes-safely-with-flags.\"\n },\n \"paths\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"description\": \"A list of path expressions that are routed to this application. See https://vercel.com/docs/microfrontends/path-routing#supported-path-expressions.\"\n }\n },\n \"required\": [\n \"paths\"\n ],\n \"additionalProperties\": false,\n \"description\": \"A group of paths that is routed to this application.\"\n },\n \"Options\": {\n \"type\": \"object\",\n \"properties\": {\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\\nSee https://vercel.com/docs/microfrontends/managing-microfrontends/vercel-toolbar#routing-overrides.\"\n },\n \"localProxyPort\": {\n \"type\": \"number\",\n \"description\": \"The port number used by the local proxy server.\\n\\nThe default value is 3024.\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n }\n },\n \"additionalProperties\": false\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,SAAS,aAAa;AACtB,SAAS,WAA6B;;;AC4E/B,IAAM,qBAAN,cAEG,MAAM;AAAA,EAKd,YAAY,SAAiB,MAAqC;AAChE,UAAM,SAAS,EAAE,OAAO,MAAM,MAAM,CAAC;AACrC,SAAK,OAAO;AACZ,SAAK,SAAS,MAAM,UAAU;AAC9B,SAAK,OAAO,MAAM,QAAS;AAC3B,SAAK,UAAU,MAAM;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,MAAM,UAAU;AAClB,YAAM,MAAM,mBAAmB,eAAe,UAAU,KAAK,QAAQ;AACrE,UAAI,KAAK;AACP,eAAO;AAAA,MACT;AAAA,IACF;AAEA,QACE,SAAS,QAAQ;AAAA,MACf;AAAA,IACF,GACA;AACA,aAAO,IAAI,mBAAmB,SAAS,SAAS;AAAA,QAC9C,MAAM;AAAA,QACN,SAAS;AAAA,QACT,QAAQ;AAAA,MACV,CAAC;AAAA,IACH;AAGA,WAAO,IAAI,mBAAmB,SAAS,OAAO;AAAA,EAChD;AAAA,EAEA,OAAO,eACL,UACA,UACmD;AACnD,QAAI,oBAAoB,SAAS,UAAU,UAAU;AACnD,UAAI,SAAS,SAAS,UAAU;AAC9B,eAAO,IAAI,mBAAmB,mBAAmB,aAAa;AAAA,UAC5D,MAAM;AAAA,UACN,SAAS;AAAA,UACT,QAAQ;AAAA,QACV,CAAC;AAAA,MACH;AACA,UAAI,SAAS,SAAS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Ac;AAAA,QACZ,aAAa,MAAM,OAAO,sCAAsC;AAAA,MAClE;AAAA,IACF,WAAW,MAAM,YAAY,YAAY;AACvC,oBAAc;AAAA,QACZ,aAAa,MAAM,OAAO,gCAAgC;AAAA,MAC5D;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAEO,SAAS,eAAe,cAA8B;AAC3D,QAAM,eAAe,MAAM,YAAY;AAEvC,QAAM,MAAM,IAAI,IAAI,EAAE,iBAAiB,KAAK,CAAC;AAC7C,QAAM,WAAW,IAAI,QAAQ,MAAM;AACnC,QAAM,UAAU,SAAS,YAAY;AACrC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI;AAAA,MACR,iCAAiC,gBAAgB,SAAS,MAAM,EAC7D,IAAI,CAAC,UAAU;AAAA,KAAQ,OAAO,EAC9B;AAAA,QACC;AAAA,MACF;AAAA;AAAA;AAAA,MACF,EAAE,MAAM,UAAU,SAAS,wBAAwB;AAAA,IACrD;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/config/microfrontends/server/validation.ts","../src/config/errors.ts","../schema/schema.json","../src/config/schema/utils/load.ts"],"sourcesContent":["import { Ajv, type ErrorObject } from 'ajv';\nimport { parse } from 'jsonc-parser';\nimport { MicrofrontendError } from '../../errors';\nimport type { Config } from '../../schema/types';\nimport { SCHEMA } from '../../schema/utils/load';\n\nconst LIST_FORMATTER = new Intl.ListFormat('en', {\n style: 'long',\n type: 'disjunction',\n});\n\nfunction formatAjvErrors(errors: ErrorObject[] | null | undefined): string[] {\n if (!errors) {\n return [];\n }\n const errorMessages: string[] = [];\n for (const error of errors) {\n // Ignore root errors that arise because AJV can't infer whether the config is a main config or a child config.\n // These errors are confusing for the user.\n if (\n error.instancePath === '' &&\n (error.keyword === 'anyOf' ||\n (error.keyword === 'required' &&\n error.params.missingProperty === 'partOf'))\n ) {\n continue;\n }\n\n // Ignore the first leading slash in the instance path to make the path more readable.\n const instancePath = error.instancePath.slice(1);\n const formattedInstancePath =\n instancePath === '' ? 'at the root' : `in field ${instancePath}`;\n\n // AJV errors are really cryptic, so this logic transforms them to nicer ones.\n // It is based on heuristics from introducing errors and observing what AJV produces.\n if (\n error.keyword === 'required' &&\n error.params.missingProperty === 'routing' &&\n instancePath.split('/').length === 2\n ) {\n errorMessages.push(\n `Unable to infer if ${instancePath} is the default app or a child app. This usually means that there is another error in the configuration.`,\n );\n } else if (\n error.keyword === 'anyOf' &&\n instancePath.split('/').length > 2\n ) {\n const anyOfErrors = errors.filter(\n (e) => e.instancePath === error.instancePath && e.keyword !== 'anyOf',\n );\n if (anyOfErrors.every((e) => e.keyword === 'type')) {\n const allowedTypes = LIST_FORMATTER.format(\n anyOfErrors.map((e) => {\n return e.keyword === 'type' ? String(e.params.type) : 'unknown';\n }),\n );\n errorMessages.push(\n `Incorrect type for ${instancePath}. Must be one of ${allowedTypes}`,\n );\n } else {\n errorMessages.push(\n `Invalid field for ${instancePath}. Possible error messages are ${LIST_FORMATTER.format(anyOfErrors.map((e) => e.message ?? ''))}`,\n );\n }\n } else if (\n error.keyword === 'additionalProperties' &&\n !(\n error.params.additionalProperty === 'routing' &&\n instancePath.split('/').length === 2\n )\n ) {\n errorMessages.push(\n `Property '${error.params.additionalProperty}' is not allowed ${formattedInstancePath}`,\n );\n } else if (error.keyword === 'required') {\n errorMessages.push(\n `Property '${error.params.missingProperty}' is required ${formattedInstancePath}`,\n );\n }\n }\n return errorMessages;\n}\n\nexport function validateSchema(configString: string): Config {\n const parsedConfig = parse(configString) as Config;\n\n const ajv = new Ajv({ allowUnionTypes: true });\n const validate = ajv.compile(SCHEMA);\n const isValid = validate(parsedConfig);\n if (!isValid) {\n throw new MicrofrontendError(\n `Invalid microfrontends config:${formatAjvErrors(validate.errors)\n .map((error) => `\\n - ${error}`)\n .join(\n '',\n )}\\n\\nSee https://openapi.vercel.sh/microfrontends.json for the schema.`,\n { type: 'config', subtype: 'does_not_match_schema' },\n );\n }\n\n return parsedConfig;\n}\n","export type MicrofrontendErrorType =\n | 'config'\n | 'packageJson'\n | 'vercelJson'\n | 'application'\n | 'unknown';\n\nexport type MicrofrontendErrorSubtype =\n | 'not_found'\n | 'inference_failed'\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 application:\n | 'invalid_asset_prefix'\n | 'invalid_path'\n | 'multiple_package_managers'\n | 'not_found';\n config:\n | 'conflicting_paths'\n | 'depcrecated_field'\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 | 'inference_failed'\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 cause?: unknown;\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, { cause: opts?.cause });\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 \"type\": \"object\",\n \"properties\": {\n \"$schema\": {\n \"type\": \"string\",\n \"description\": \"See https://openapi.vercel.sh/microfrontends.json.\"\n },\n \"version\": {\n \"type\": \"string\",\n \"const\": \"1\",\n \"description\": \"The version of the microfrontends config schema.\"\n },\n \"applications\": {\n \"$ref\": \"#/definitions/ApplicationRouting\",\n \"description\": \"Mapping of Vercel project names to their microfrontend configurations.\"\n },\n \"options\": {\n \"$ref\": \"#/definitions/Options\",\n \"description\": \"Optional configuration options for the microfrontend.\"\n }\n },\n \"required\": [\"applications\"],\n \"additionalProperties\": false,\n \"description\": \"The microfrontends configuration schema. See https://vercel.com/docs/microfrontends/configuration.\"\n },\n \"ApplicationRouting\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/definitions/Application\"\n },\n \"propertyNames\": {\n \"description\": \"The Vercel project name of the microfrontend application.\\n\\nNote: If this name does not also match the name `name` from the `package.json`, set `packageName` with the name used in `package.json`.\\n\\nSee https://vercel.com/docs/microfrontends/configuration#application-naming.\"\n },\n \"description\": \"Mapping of Vercel project names to their microfrontend configurations.\"\n },\n \"Application\": {\n \"anyOf\": [\n {\n \"$ref\": \"#/definitions/DefaultApplication\"\n },\n {\n \"$ref\": \"#/definitions/ChildApplication\"\n }\n ],\n \"description\": \"The configuration for a microfrontend application. There must always be one default application.\"\n },\n \"DefaultApplication\": {\n \"type\": \"object\",\n \"properties\": {\n \"packageName\": {\n \"type\": \"string\",\n \"description\": \"The name used to run the application, e.g. the `name` field in the `package.json`.\\n\\nThis is used by the local proxy to map the application config to the locally running app.\\n\\nThis is only necessary when the application name does not match the `name` used in `package.json`.\\n\\nSee https://vercel.com/docs/microfrontends/configuration#application-naming.\"\n },\n \"development\": {\n \"$ref\": \"#/definitions/DefaultDevelopment\",\n \"description\": \"Development configuration for the default application.\"\n }\n },\n \"required\": [\"development\"],\n \"additionalProperties\": false\n },\n \"DefaultDevelopment\": {\n \"type\": \"object\",\n \"properties\": {\n \"local\": {\n \"type\": [\"number\", \"string\"],\n \"description\": \"A local port number or host that this application runs on when it is running locally. If passing a string, include the protocol (optional), host (required) and port (optional).\\n\\nExamples of valid values: 8080, my.localhost.me, my.localhost.me:8080, https://my.localhost.me, https://my.localhost.me:8080.\\n\\nThe default value is http://localhost:<port> where port is a stable, unique port number (based on the application name).\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n },\n \"task\": {\n \"type\": \"string\",\n \"description\": \"The task to run when starting the development server. Should reference a script in the package.json of the application.\\n\\nThe default value is \\\"dev\\\".\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n },\n \"fallback\": {\n \"type\": \"string\",\n \"description\": \"Fallback for local development, could point to any environment. This is required for the default app. This value is used as the fallback for child apps as well if they do not have a fallback.\\n\\nIf passing a string, include the protocol (optional), host (required) and port (optional). For example: `https://this.ismyhost:8080`. If omitted, the protocol defaults to HTTPS. If omitted, the port defaults to `80` for HTTP and `443` for HTTPS.\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n }\n },\n \"required\": [\"fallback\"],\n \"additionalProperties\": false\n },\n \"ChildApplication\": {\n \"type\": \"object\",\n \"properties\": {\n \"packageName\": {\n \"type\": \"string\",\n \"description\": \"The name used to run the application, e.g. the `name` field in the `package.json`.\\n\\nThis is used by the local proxy to map the application config to the locally running app.\\n\\nThis is only necessary when the application name does not match the `name` used in `package.json`.\\n\\nSee https://vercel.com/docs/microfrontends/configuration#application-naming.\"\n },\n \"development\": {\n \"$ref\": \"#/definitions/ChildDevelopment\",\n \"description\": \"Development configuration for the child application.\"\n },\n \"routing\": {\n \"$ref\": \"#/definitions/Routing\",\n \"description\": \"Groups of path expressions that are routed to this application.\\n\\nSee https://vercel.com/docs/microfrontends/path-routing.\"\n },\n \"assetPrefix\": {\n \"type\": \"string\",\n \"description\": \"The name of the asset prefix to use instead of the auto-generated name.\\n\\nThe asset prefix is used to prefix all paths to static assets, such as JS, CSS, or images that are served by a specific application. It is necessary to ensure there are no conflicts with other applications on the same domain.\\n\\nAn auto-generated asset prefix of the form `vc-ap-<hash>` is used when this field is not provided.\\n\\nWhen this field is provided, `/${assetPrefix}/:path*` must also be added to the list of paths in the `routing` field. Changing the asset prefix after a microfrontend application has already been deployed is not a forwards and backwards compatible change, and the asset prefix should be added to the `routing` field and deployed before setting the `assetPrefix` field.\\n\\nThe default value is the auto-generated asset prefix of the form `vc-ap-<hash>`.\\n\\nSee https://vercel.com/docs/microfrontends/path-routing#asset-prefix.\"\n }\n },\n \"required\": [\"routing\"],\n \"additionalProperties\": false\n },\n \"ChildDevelopment\": {\n \"type\": \"object\",\n \"properties\": {\n \"local\": {\n \"type\": [\"number\", \"string\"],\n \"description\": \"A local port number or host that this application runs on when it is running locally. If passing a string, include the protocol (optional), host (required) and port (optional).\\n\\nExamples of valid values: 8080, my.localhost.me, my.localhost.me:8080, https://my.localhost.me, https://my.localhost.me:8080.\\n\\nThe default value is http://localhost:<port> where port is a stable, unique port number (based on the application name).\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n },\n \"task\": {\n \"type\": \"string\",\n \"description\": \"The task to run when starting the development server. Should reference a script in the package.json of the application.\\n\\nThe default value is \\\"dev\\\".\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n },\n \"fallback\": {\n \"type\": \"string\",\n \"description\": \"Fallback for local development, could point to any environment. If not provided for child apps, the fallback of the default app will be used.\\n\\nIf passing a string, include the protocol (optional), host (required) and port (optional). For example: `https://this.ismyhost:8080`. If omitted, the protocol defaults to HTTPS. If omitted, the port defaults to `80` for HTTP and `443` for HTTPS.\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n }\n },\n \"additionalProperties\": false\n },\n \"Routing\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/definitions/PathGroup\"\n },\n \"description\": \"A list of path groups that are routed to this application.\"\n },\n \"PathGroup\": {\n \"type\": \"object\",\n \"properties\": {\n \"group\": {\n \"type\": \"string\",\n \"description\": \"Group name for the paths.\"\n },\n \"flag\": {\n \"type\": \"string\",\n \"description\": \"The name of the feature flag that controls routing for this group of paths. See https://vercel.com/docs/microfrontends/path-routing#routing-changes-safely-with-flags.\"\n },\n \"paths\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"description\": \"A list of path expressions that are routed to this application. See https://vercel.com/docs/microfrontends/path-routing#supported-path-expressions.\"\n }\n },\n \"required\": [\"paths\"],\n \"additionalProperties\": false,\n \"description\": \"A group of paths that is routed to this application.\"\n },\n \"Options\": {\n \"type\": \"object\",\n \"properties\": {\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\\nSee https://vercel.com/docs/microfrontends/managing-microfrontends/vercel-toolbar#routing-overrides.\"\n },\n \"localProxyPort\": {\n \"type\": \"number\",\n \"description\": \"The port number used by the local proxy server.\\n\\nThe default value is 3024.\\n\\nSee https://vercel.com/docs/microfrontends/local-development.\"\n }\n },\n \"additionalProperties\": false\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,SAAS,WAA6B;AACtC,SAAS,aAAa;;;AC4Ef,IAAM,qBAAN,cAEG,MAAM;AAAA,EAKd,YAAY,SAAiB,MAAqC;AAChE,UAAM,SAAS,EAAE,OAAO,MAAM,MAAM,CAAC;AACrC,SAAK,OAAO;A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AI,CAAC,SAAS;AACZ,UAAM,IAAI;AAAA,MACR,iCAAiC,gBAAgB,SAAS,MAAM,EAC7D,IAAI,CAAC,UAAU;AAAA,KAAQ,OAAO,EAC9B;AAAA,QACC;AAAA,MACF;AAAA;AAAA;AAAA,MACF,EAAE,MAAM,UAAU,SAAS,wBAAwB;AAAA,IACrD;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/microfrontends",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "private": false,
5
5
  "description": "Defines configuration and utilities for microfrontends development",
6
6
  "keywords": [
@@ -127,7 +127,7 @@
127
127
  "CHANGELOG.md"
128
128
  ],
129
129
  "dependencies": {
130
- "@next/env": "15.5.4",
130
+ "@next/env": "16.0.10",
131
131
  "@types/md5": "^2.3.5",
132
132
  "ajv": "^8.17.1",
133
133
  "commander": "^12.1.0",
@@ -155,7 +155,7 @@
155
155
  "@types/semver": "^7.7.0",
156
156
  "jest": "^29.7.0",
157
157
  "jest-environment-jsdom": "29.2.2",
158
- "next": "15.5.4",
158
+ "next": "16.0.10",
159
159
  "react": "19.0.0",
160
160
  "react-dom": "19.0.0",
161
161
  "ts-json-schema-generator": "^1.1.2",
@@ -165,7 +165,6 @@
165
165
  "typescript": "5.7.3",
166
166
  "vite": "5.4.11",
167
167
  "webpack": "5",
168
- "eslint-config-custom": "0.0.0",
169
168
  "ts-config": "1.0.0"
170
169
  },
171
170
  "peerDependencies": {
@@ -205,8 +204,7 @@
205
204
  "postbuild": "pnpm generate:exports",
206
205
  "generate:exports": "tsx scripts/generate-exports/index.ts",
207
206
  "generate:schema": "tsx scripts/generate-json-schema.ts",
208
- "lint": "eslint .",
209
- "lint-fix": "eslint . --fix",
207
+ "lint": "biome check",
210
208
  "proxy": "tsx src/proxy/index.ts",
211
209
  "test": "cross-env TZ=UTC jest",
212
210
  "typecheck": "tsc --noEmit"