@vercel/microfrontends
Version: 
Defines configuration and utilities for microfrontends development
72 lines (69 loc) • 2.31 kB
TypeScript
import { C as Config } from '../types-e7523e61.js';
import { O as OverridesConfig } from '../types-88602303.js';
import { MicrofrontendConfigIsomorphic } from '../config.js';
export { g as getApplicationContext } from '../get-application-context-e8a5a0e2.js';
declare class MicrofrontendsServer {
    config: MicrofrontendConfigIsomorphic;
    constructor({ config, overrides, }: {
        config: Config;
        overrides?: OverridesConfig;
    });
    /**
     * Writes the configuration to a file.
     */
    writeConfig(opts?: {
        pretty?: boolean;
    }): void;
    /**
     * Generates a MicrofrontendsServer instance from an unknown object.
     */
    static fromUnknown({ config, cookies, }: {
        config: unknown;
        cookies?: {
            name: string;
            value: string;
        }[];
    }): MicrofrontendsServer;
    /**
     * Generates a MicrofrontendsServer instance from the environment.
     * Uses additional validation that is only available when in a node runtime
     */
    static fromEnv({ cookies, }: {
        cookies: {
            name: string;
            value: string;
        }[];
    }): MicrofrontendsServer;
    /**
     * Validates the configuration against the JSON schema
     */
    static validate(config: string | Config): Config;
    /**
     * Looks up the configuration by inferring the package root and looking for a microfrontends config file. If a file is not found,
     * it will look for a package in the repository with a microfrontends file that contains the current application
     * and use that configuration.
     *
     * This can return either a Child or Main configuration.
     */
    static infer({ appName, directory, filePath, cookies, }?: {
        appName?: string;
        directory?: string;
        filePath?: string;
        cookies?: {
            name: string;
            value: string;
        }[];
    }): MicrofrontendsServer;
    static fromFile({ filePath, cookies, }: {
        filePath: string;
        cookies?: {
            name: string;
            value: string;
        }[];
    }): MicrofrontendsServer;
    static fromMainConfigFile({ filePath, overrides, }: {
        filePath: string;
        overrides?: OverridesConfig;
    }): MicrofrontendsServer;
}
export { MicrofrontendsServer };