import { a as resolveWorkbenchApp, i as WorkbenchExposes, n as resolveWorkbenchConfig, r as ResolvedWorkbenchApp, t as ResolvedMediaLibraryConfig } from "./resolveWorkbenchConfig-KhXnVKZ6.js";
import { InlineConfig, PluginOption } from "vite";
/**
 * Resource bindings ride in a dedicated module in the app's bundle rather than an
 * index.html script tag, so both standalone studios and federated apps resolve
 * them the same way (a federated host pulls modules, not HTML).
 *
 * The module is emitted at a stable, unhashed path (`sanity-resource-bindings.js`)
 * at the bundle root and is statically imported first, so it is evaluated before
 * any app code. At deploy time Brett replaces the `__SANITY_RESOURCE_BINDINGS__`
 * token with the resolved bindings JSON. The token is invalid JSON on purpose: a
 * minifier can't constant-fold `JSON.parse` of it, so the call — and the token —
 * survive minification for Brett to rewrite.
 *
 * These constants are the single source of truth shared by the standalone studio
 * build (`@sanity/cli-build`) and the federated app build here. They must stay in
 * lockstep with Brett's replacement (see SDK-2413).
 */
/** Rolldown chunk name used to force the bindings module into its own chunk. */
declare const RESOURCE_BINDINGS_CHUNK_NAME = "sanity-resource-bindings";
/** Stable, unhashed file name Brett looks for at the bundle root. */
declare const RESOURCE_BINDINGS_FILENAME = "sanity-resource-bindings.js";
/** Token Brett replaces with the resolved bindings JSON at deploy. */
declare const RESOURCE_BINDINGS_TOKEN = "__SANITY_RESOURCE_BINDINGS__";
/**
 * Contents of the generated bindings module. The `JSON.parse` result is assigned
 * to a global so the module has an observable side effect and isn't tree-shaken
 * when nothing imports its export yet (the reader lands in SDK-2295). The
 * try/catch keeps a local, un-deployed build (e.g. `sanity preview`) working: an
 * unreplaced token throws, and we fall back to an empty array.
 */
declare const RESOURCE_BINDINGS_MODULE_SOURCE = "// This file is auto-generated on 'sanity build' / 'sanity dev'\n// Modifications to this file are automatically discarded\nlet resourceBindings = []\ntry {\n  resourceBindings = JSON.parse('__SANITY_RESOURCE_BINDINGS__')\n} catch {\n  // Built but not deployed through Brett (e.g. local preview): keep the default.\n}\nglobalThis.__SANITY_RESOURCE_BINDINGS__ = resourceBindings\nexport {resourceBindings}\n";
/** Side-effect import placed first in each entry so the module evaluates before app code. */
declare const RESOURCE_BINDINGS_ENTRY_IMPORT = "import './sanity-resource-bindings.js'";
/**
 * Rolldown `codeSplitting` group that isolates the bindings module into its own
 * chunk. `minSize`/`minModuleSize` of 0 are scoped to this group (not the
 * enclosing `codeSplitting` object) so they only affect the bindings module and
 * never the automatic chunking of everything else. They stop Rolldown folding
 * the tiny module back into its importer.
 */
declare const resourceBindingsCodeSplittingGroup: {
  minModuleSize: number;
  minSize: number;
  name: string;
  test: RegExp;
};
/**
 * `chunkFileNames` value for the bindings chunk (unhashed, at the bundle root),
 * or `undefined` for any other chunk so the caller can apply its own default.
 */
declare function resourceBindingsChunkFileName(chunkName: string): string | undefined;
declare function buildFederatedApp(config: InlineConfig, { reuseStandaloneBuild }?: {
  reuseStandaloneBuild?: boolean;
}): Promise<void>;
/**
 * Dep pre-bundling inputs for a workbench app's dev server.
 *
 * Vite's dep scanner crawls from the app's HTML entry, which reaches only the
 * app's `entry` (or a studio's config) — never the federation `exposes` (dock
 * views, web workers, media-library config fields), which the host loads
 * dynamically at runtime. So a dep imported only by an exposed module (e.g.
 * `sanity/workbench` in a service or view) escapes the startup scan; Vite
 * discovers it on first request, re-optimizes, and full-page reloads — which
 * flakes Playwright in e2e.
 *
 * Point `entries` at the source of every interface: the app `entry` (or, for a
 * studio, its config), plus each view, service, and installation-config source.
 * `entries` follows real import statements, so it covers whatever those sources
 * transitively use — correct subpaths and all — with no hand-maintained dep
 * list, and never crashes on an unresolvable name the way a bad `include` entry
 * does. Each source is resolved to its on-disk file so an extensionless path
 * (like the default `./src/App`) still matches `entries`' filesystem glob.
 *
 * @param cwd - Project root; `entries` are returned relative to it.
 * @param appSources - Absolute paths to the app's `entry` and/or studio config.
 * @param exposes - The app's declared views/web workers/config.
 * @internal
 */
declare function workbenchOptimizeDeps(options: {
  appSources: readonly string[];
  cwd: string;
  exposes?: WorkbenchExposes;
}): {
  entries: string[];
  include: string[];
};
interface WorkbenchViteOptions {
  /** Project root — read for the federation remote name, and the plugin workDir. */
  cwd: string;
  /**
   * Build entry paths relative to the federation runtime dir. `relativeEntry` is
   * the app's `entry` (null for a dock-only app with no app view);
   * `relativeConfigLocation` is the studio's `sanity.config.*` (null when absent).
   */
  entries: {
    relativeConfigLocation: string | null;
    relativeEntry: string | null;
  };
  /** The app's bus identity, stamped into its modules for `@sanity/runtime`. */
  appId?: string;
  exposes?: WorkbenchExposes;
  /** App (vs studio) build — selects the discriminated federation option shape. */
  isApp?: boolean;
  /** Blueprints build (via `@sanity/runtime-cli`) — emit the resource-bindings module. */
  isBlueprints?: boolean;
}
/** Build the Vite plugins for a workbench app's module-federation remote. */
declare function workbenchVitePlugins(options: WorkbenchViteOptions): Promise<PluginOption>;
/**
 * The `build`/`start` id — a hash of the app's declared shape (its identity, not
 * its code), so the bundle inlined by `sanity build` and the registry entry
 * advertised by `sanity start` resolve to the same id. `sanity deploy` resolves
 * its own id from the applications API.
 */
declare function buildAppId(app: ResolvedWorkbenchApp): Promise<string>;
export { RESOURCE_BINDINGS_CHUNK_NAME, RESOURCE_BINDINGS_ENTRY_IMPORT, RESOURCE_BINDINGS_FILENAME, RESOURCE_BINDINGS_MODULE_SOURCE, RESOURCE_BINDINGS_TOKEN, type ResolvedMediaLibraryConfig, type WorkbenchExposes, buildAppId, buildFederatedApp, resolveWorkbenchApp, resolveWorkbenchConfig, resourceBindingsChunkFileName, resourceBindingsCodeSplittingGroup, workbenchOptimizeDeps, workbenchVitePlugins };
//# sourceMappingURL=build.d.ts.map