UNPKG

@vercel/microfrontends

Version:

Defines configuration and utilities for microfrontends development

174 lines 7.28 kB
{ "$schema": "http://json-schema.org/draft-07/schema#", "$ref": "#/definitions/Config", "definitions": { "Config": { "type": "object", "properties": { "$schema": { "type": "string" }, "version": { "type": "string", "const": "1" }, "options": { "$ref": "#/definitions/Options" }, "applications": { "$ref": "#/definitions/ApplicationRouting", "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" } }, "required": [ "applications" ], "additionalProperties": false }, "Options": { "type": "object", "properties": { "disableOverrides": { "type": "boolean", "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." }, "localProxyPort": { "type": "number", "description": "The port number used by the local proxy server.\n\nThe default is `3024`." } }, "additionalProperties": false }, "ApplicationRouting": { "type": "object", "additionalProperties": { "$ref": "#/definitions/Application" }, "propertyNames": { "description": "The unique identifier for a Microfrontend Application.\n\nMust match the Vercel project name.\n\nNote: If this name does not also match the name used to run the application, (e.g. the `name` from the `package.json`), then the `packageName` field should be set." } }, "Application": { "anyOf": [ { "$ref": "#/definitions/DefaultApplication" }, { "$ref": "#/definitions/ChildApplication" } ] }, "DefaultApplication": { "type": "object", "properties": { "packageName": { "type": "string", "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`." }, "development": { "$ref": "#/definitions/DefaultDevelopment", "description": "Development configuration for the default application." } }, "required": [ "development" ], "additionalProperties": false }, "DefaultDevelopment": { "type": "object", "properties": { "local": { "type": [ "number", "string" ], "description": "A local port number or host string that this application runs on when it is running locally. If passing a string, include the protocol (optional), host (required) and port (optional). For example: `https://this.ismyhost:8080`. If omitted, the protocol defaults to HTTP. If omitted, the port defaults to a unique, but stable (based on the application name) number.\n\nExamples of valid values:\n- 8080\n- my.localhost.me\n- my.localhost.me:8080\n- https://my.localhost.me\n- https://my.localhost.me:8080" }, "task": { "type": "string", "description": "Optional task to run when starting the development server. Should reference a script in the package.json of the application." }, "fallback": { "type": "string", "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." } }, "required": [ "fallback" ], "additionalProperties": false }, "ChildApplication": { "type": "object", "properties": { "packageName": { "type": "string", "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`." }, "development": { "$ref": "#/definitions/ChildDevelopment", "description": "Development configuration for the child application." }, "routing": { "$ref": "#/definitions/Routing", "description": "Groups of path expressions that are routed to this application." } }, "required": [ "routing" ], "additionalProperties": false }, "ChildDevelopment": { "type": "object", "properties": { "local": { "type": [ "number", "string" ], "description": "A local port number or host string that this application runs on when it is running locally. If passing a string, include the protocol (optional), host (required) and port (optional). For example: `https://this.ismyhost:8080`. If omitted, the protocol defaults to HTTP. If omitted, the port defaults to a unique, but stable (based on the application name) number.\n\nExamples of valid values:\n- 8080\n- my.localhost.me\n- my.localhost.me:8080\n- https://my.localhost.me\n- https://my.localhost.me:8080" }, "task": { "type": "string", "description": "Optional task to run when starting the development server. Should reference a script in the package.json of the application." }, "fallback": { "type": "string", "description": "Fallback for local development, could point to any environment. This is optional for child apps. If not provided, 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." } }, "additionalProperties": false }, "Routing": { "type": "array", "items": { "$ref": "#/definitions/PathGroup" } }, "PathGroup": { "type": "object", "properties": { "group": { "type": "string", "description": "Optional group name for the paths" }, "flag": { "type": "string", "description": "flag name that can be used to enable/disable all paths in the group" }, "paths": { "type": "array", "items": { "type": "string" } } }, "required": [ "paths" ], "additionalProperties": false } } }