/** * Build pipeline contracts and app-owned adapter wiring. * * @remarks * The build layer exposes three concentric shapes: * * - `BuildAdapter` — the low-level backend contract. Two implementations * exist: a bundler-backed adapter (the real backend) and * {@link ViteHostBuildAdapter} (a host-owned boundary marker that throws * on direct use, for host runtimes that own their own build pipeline). * - `BuildExecutor` — the runtime-facing facade stored on * `appConfig.runtime.buildRuntime` via profile-based accessors. * - App-owned helpers (`getAppBuildAdapter` and the `set*` counterparts) — * the supported way for runtime code to read and mutate the active adapter * per `EcoPagesAppConfig`. Profile executors live on * `appConfig.runtime.buildRuntime`. */ import type { EcoBuildPlugin } from './contracts/build-types.js'; import { type BuildAdapter, type BuildExecutor, type BuildOptions, type BuildOwnership, type BuildResult, type BuildTranspileOptions, type BuildTranspileProfile } from './contracts/build-contracts.js'; export type { BuildAdapter, BuildDependencyGraph, BuildExecutor, BuildLog, BuildOptions, BuildOutput, BuildOwnership, BuildResult, BuildTranspileOptions, BuildTranspileProfile, } from './contracts/build-contracts.js'; import { type AppBuildManifest } from './contracts/build-manifest.js'; import type { EcoPagesAppConfig } from '../types/internal-types.js'; /** * Boundary-marker adapter for Vite-host ownership. * * @remarks * This is not a real backend. It exists so `appConfig.runtime.buildAdapter` * can carry the `'vite-host'` ownership without falling back to a * framework-owned bundler path. Every method throws a * {@link createHostOwnedBuildError} so misrouted calls fail loudly * with a clear message instead of silently executing under a * different backend. * * The class stays in the public surface for host runtimes that own * their build pipeline (e.g. Nitro) and for app code that wants to * opt into host-owned ownership before its host wires up the build. */ export declare class ViteHostBuildAdapter implements BuildAdapter { readonly ownership: "vite-host"; build(_options: BuildOptions): Promise; resolve(_importPath: string, _rootDir: string): string; getTranspileOptions(_profile: BuildTranspileProfile): BuildTranspileOptions; } /** * Constructs a {@link ViteHostBuildAdapter}. Use only in code paths * that explicitly opt into the host-owned boundary. */ export declare function createViteHostBuildAdapter(): BuildAdapter; /** * Constructs a build adapter for the given ownership. * * @param options - When `options.ownership` is omitted, the default is * `'rolldown'`. The Vite-host path is opt-in. */ export declare function createBuildAdapter(options?: { ownership?: BuildOwnership; }): BuildAdapter; /** The shared default-bundler backend instance. Use {@link getAppBuildAdapter} in app-aware code. */ export declare const defaultRolldownBuildAdapter: BuildAdapter; /** The shared Vite-host boundary instance. Use {@link getAppBuildAdapter} in app-aware code. */ export declare const defaultViteHostBuildAdapter: BuildAdapter; /** * Global default build adapter. * * @remarks * Resolves to the bundled default-bundler adapter. New app-aware * code should prefer {@link getAppBuildAdapter}. */ export declare const defaultBuildAdapter: BuildAdapter; /** * Resolves the default build adapter for an ownership value. * * @param ownership - Defaults to `'rolldown'`. Returns the * {@link ViteHostBuildAdapter} only when the caller explicitly asks * for `'vite-host'`. */ export declare function getDefaultBuildAdapter(ownership?: BuildOwnership): BuildAdapter; /** * Reads the {@link BuildOwnership} declared on a {@link BuildAdapter}. * * @param buildAdapter - When `undefined`, defaults to `'rolldown'`. */ export declare function getBuildAdapterOwnership(buildAdapter: BuildAdapter | undefined): BuildOwnership; /** * Resolves the build ownership of an app config. * * @remarks * Resolution order: `appConfig.runtime.buildOwnership` (explicit), then * the ownership declared on `appConfig.runtime.buildAdapter`, then the * default `'rolldown'`. */ export declare function getAppBuildOwnership(appConfig: EcoPagesAppConfig): BuildOwnership; /** * Sets the explicit build ownership on an app config. * * @remarks * The `ConfigBuilder` uses this when the caller calls * `setBuildOwnership`. App code that needs a different ownership * should call this directly with a new value; passing the same * value is a no-op. */ export declare function setAppBuildOwnership(appConfig: EcoPagesAppConfig, buildOwnership: BuildOwnership): void; /** * Returns the adapter owned by an app/runtime instance. * * @remarks * Falls back through `appConfig.runtime.buildAdapter` → * {@link getDefaultBuildAdapter} on the resolved ownership. Throws * never; a missing adapter resolves to the global default. */ export declare function getAppBuildAdapter(appConfig: EcoPagesAppConfig): BuildAdapter; /** * Installs the adapter that should serve future builds for one app * instance, and aligns the ownership field to the new adapter's * declared ownership. */ export declare function setAppBuildAdapter(appConfig: EcoPagesAppConfig, buildAdapter: BuildAdapter): void; /** * Returns the build manifest owned by an app/runtime instance. * * @remarks * Falls back to a fresh manifest seeded from the config's loaders when * the app config has no manifest yet. This is the supported way to * read the manifest across the source-loading and asset-processing * services. */ export declare function getAppBuildManifest(appConfig: EcoPagesAppConfig): AppBuildManifest; /** Installs the build manifest that should be visible to one app instance. * * @remarks * Production apps are sealed via {@link updateAppBuildManifest} during * {@link ConfigBuilder.build}. Call `setAppBuildManifest` directly only in tests or * when replacing the entire manifest object; partial updates should use * {@link updateAppBuildManifest}. */ export declare function setAppBuildManifest(appConfig: EcoPagesAppConfig, buildManifest: AppBuildManifest): void; /** * Builds a fresh app manifest from the config's loaders plus optional * caller-supplied runtime/browser contributions. * * @remarks * Loader plugins are always taken from the config; runtime and * browser-bundle plugins are passed through from the caller when * supplied, otherwise left empty for later population by * {@link collectConfiguredAppBuildManifestContributions}. */ export declare function createConfiguredAppBuildManifest(appConfig: EcoPagesAppConfig, input?: Partial): AppBuildManifest; /** * Replaces the app-owned manifest using config-owned loaders and the * caller-supplied contribution input. * * @remarks * Primary production entry: `ConfigBuilder.build()` passes the return value of * {@link collectConfiguredAppBuildManifestContributions} here to seal * `appConfig.runtime.buildManifest` before startup. */ export declare function updateAppBuildManifest(appConfig: EcoPagesAppConfig, input?: Partial): void; export { collectConfiguredAppBuildManifestContributions, ensureIntegrationRuntimeReady, setupAppRuntimePlugins, } from './app-build-manifest-runtime.js'; /** * Returns the server-bundle plugin list for one app/runtime instance. * * @remarks * Reads from the app's sealed build manifest; the manifest itself is * the source of truth for which plugins participate in the server * bundle. */ export declare function getAppServerBuildPlugins(appConfig: EcoPagesAppConfig): EcoBuildPlugin[]; /** * Returns the browser-bundle plugin list for one app/runtime instance. * * @remarks * Reads from the app's sealed build manifest. The browser-bundle * manifest is the source of truth for which plugins participate in the * browser bundle. * * Plugins whose `name` matches a registered {@link EcoSourceTransform} are * excluded here because browser builds run those transforms via the Rolldown * bridge post-load pass instead of as competing `onLoad` handlers. */ export declare function getAppBrowserBuildPlugins(appConfig: EcoPagesAppConfig): EcoBuildPlugin[]; /** * Runs a build through the active pipeline. * * @remarks * `executor` defaults to the default-bundler adapter for non-app-aware * callsites. App-aware code should pass a profile executor from * {@link requireBuildRuntime} to honor the per-app pipeline. */ export declare function build(options: BuildOptions, executor?: BuildExecutor): Promise; /** * Default transpile-options helper for callsites without app runtime * context. * * @remarks * New app-aware code should prefer {@link getAppTranspileOptions}. */ export declare function getTranspileOptions(profile: BuildTranspileProfile): BuildTranspileOptions; /** * Resolves transpile options for one app/runtime instance by asking * the app's adapter. */ export declare function getAppTranspileOptions(appConfig: EcoPagesAppConfig, profile: BuildTranspileProfile): BuildTranspileOptions;