import { ModuleFederationOptions } from "@module-federation/vite"; import type { PluginOption } from "vite"; declare interface AppFederationPluginOptions extends FederationPluginOptionsBase { isApp: true; /** * Relative path to the App entry from the runtime directory, e.g. * `../../src/App.tsx`. Omit it for a dock-only app (US5) that declares no * `entry`: no `./App` is exposed and the remote serves only its views. */ appEntry?: string; studioConfigPath?: never; } /** * @public */ export declare const federation: ( options: FederationPluginOptions, ) => PluginOption; /** * @public */ export declare interface FederationOptions extends Pick< ModuleFederationOptions, "exposes" > { /** * namespace of the federation build, used as the global variable name for the exposed modules * e.g "@acme/studio" would then allow you to import modules like `import ("@acme/studio/Button")` * defaults to your package.json name if not provided. */ name: string; } /** * Plugin options for `@sanity/federation/vite`. * * Discriminated on `isApp`: * - `isApp: true` → requires `appEntry` * - `isApp: false` (default) → requires `studioConfigPath` * * @public */ export declare type FederationPluginOptions = | AppFederationPluginOptions | StudioFederationPluginOptions; declare interface FederationPluginOptionsBase extends Omit< Partial, "exposes" > { exposes?: Record; /** * Views the app declares. Each component of a view is built into a * render-contract artifact and exposed as `./views//` so the * workbench host can load each as its own island. */ views?: readonly InterfaceArtifact[]; /** * Background services the app declares. Each is built into a self-contained * worker bundle plus a loader module exposed as `./services/`, so the * workbench host can fetch the worker URL and run it. */ services?: readonly ServiceArtifact[]; pkgJson?: PackageJson; /** * Current working directory to read package.json from, defaults to process.cwd() */ workDir?: string; } /** * An interface to generate render artifacts for. The `src` file default-exports * an `unstable_defineView(...)` result; the build emits one render-contract * artifact per component the interface type exposes. * @public */ export declare interface InterfaceArtifact { /** Interface type — selects which components the build expands. */ type: InterfaceType; /** Interface name, unique within the app. */ name: string; /** Path to the interface `src` file, relative to the app root (or absolute). */ src: string; } /** * Every supported interface type — the first argument to `unstable_defineView`. * @public */ declare type InterfaceType = keyof typeof VIEW_COMPONENTS; /** * Comprehensive representation of a package.json file. * Feel free to add properties to this, * đŸŸ â„šī¸ BUT ENSURE OPTIONAL STUFF IS ACTUALLY OPTIONAL â„šī¸đŸŸ  * đŸŸ â„šī¸ SINCE THIS IS USED IN A NUMBER OF LOCATIONS WHERE â„šī¸đŸŸ  * đŸŸ â„šī¸ WE CANNOT ENFORCE/GUARANTEE ANY PARTICULAR PROPS â„šī¸đŸŸ  * * @public */ declare type PackageJson = { name: string; version: string; dependencies?: Record; devDependencies?: Record; peerDependencies?: Record; exports?: Record; main?: string; types?: string; author?: string; description?: string; engines?: Record; license?: string; private?: boolean; repository?: { type: string; url: string; }; scripts?: Record; type?: "module" | "commonjs"; [key: string]: unknown; }; /** * A service to generate a worker artifact for. The `src` file default-exports * an `unstable_defineService(...)` result; the build emits a self-contained Web * Worker bundle plus a loader module that hands the host its URL. * @public */ export declare interface ServiceArtifact { /** Service type, e.g. `"worker"`. */ type: string; /** Service name, unique within the app. */ name: string; /** Path to the service `src` file, relative to the app root (or absolute). */ src: string; } declare interface StudioFederationPluginOptions extends FederationPluginOptionsBase { /** @defaultValue false */ isApp?: false; /** relative path to the Studio config file from the runtime directory (e.g. `../../sanity.config.ts`). */ studioConfigPath: string; appEntry?: never; } /** * Component slots each interface type exposes, in render order — source of * truth for the build (one render artifact per component) and for * {@link InterfaceType}. Add a type by adding its module and registering it here. * @internal */ declare const VIEW_COMPONENTS: { readonly panel: readonly ["title", "panel"]; }; export {};