everything-dev
Version:
A consolidated product package for building Module Federation apps with oRPC APIs.
105 lines • 3.34 kB
text/typescript
import { BosConfig, BosConfigInput, RuntimeConfig } from "../types.cjs";
import { BosEnv } from "../merge.cjs";
import "../config.cjs";
//#region src/resolution/session.d.ts
interface ResolutionRequest {
cwd?: string;
path?: string;
bosUrl?: string;
account?: string;
gateway?: string;
registry?: string;
sourceDir?: string;
env?: BosEnv;
remotePlugins?: string[];
collectCatalogs?: boolean;
}
interface ResolutionIo {
fetchBosConfig?: (bosUrl: string, registry?: string) => Promise<unknown>;
readFileOrNull?: (path: string) => Promise<string | null>;
importModule?: (path: string) => Promise<Record<string, unknown>>;
}
interface RuntimeSources {
uiSource?: "local" | "remote";
apiSource?: "local" | "remote";
authSource?: "local" | "remote";
hostSource?: "local" | "remote";
env?: "development" | "production";
plugins?: Record<string, unknown>;
}
interface WalkLink {
ref: string;
config: BosConfigInput;
baseDir: string;
sourceDir?: string;
isLeaf: boolean;
}
interface SessionParts {
config: BosConfig;
runtime: RuntimeConfig;
root: string;
path: string | null;
chain: string[];
rawConfig: BosConfigInput | null;
catalog: Record<string, string> | null;
repository: string | undefined;
env: BosEnv;
warnings: string[];
}
declare class ResolutionSession {
#private;
readonly config: BosConfig | null;
readonly runtime: RuntimeConfig | null;
readonly root: string;
readonly path: string | null;
readonly chain: readonly string[];
readonly rawConfig: BosConfigInput | null;
readonly catalog: Record<string, string> | null;
readonly repository: string | undefined;
constructor(parts: SessionParts);
static fromParts(parts: {
config: BosConfig;
runtime: RuntimeConfig;
root: string;
source?: {
path?: string;
extended?: string[];
remote?: boolean;
};
warnings?: string[];
}): ResolutionSession;
get warnings(): readonly string[];
buildRuntime(sources?: RuntimeSources): Promise<RuntimeConfig>;
}
/**
* Opens a resolution session for the requested config source. In development,
* a local leaf's `bos.dev.ts` overlay (beside the discovered entry config) is
* merged child-wins over the extended input before parsing; overlays are never
* read for `bos://` entries or in production/staging.
*/
declare function openResolution(request?: ResolutionRequest, io?: ResolutionIo): Promise<ResolutionSession | null>;
declare function walkExtendsChain(entry: string, options: {
env?: BosEnv;
io?: ResolutionIo;
registry?: string;
collectCatalogs?: boolean;
visit: (link: WalkLink) => Promise<void>;
registerCleanup?: (fn: () => Promise<void>) => void;
}): Promise<{
chain: string[];
config: BosConfigInput;
}>;
/**
* @internal — resolves the fully merged (parent-merged, un-parsed)
* `BosConfigInput` for a config entry. Used by config.ts's
* `resolveComposableReference` for plugin-entry extends resolution.
*/
declare function resolveMergedConfigInput(entry: string, options?: {
baseDir?: string;
env?: BosEnv;
io?: ResolutionIo;
registry?: string;
}): Promise<BosConfigInput>;
//#endregion
export { ResolutionIo, ResolutionRequest, ResolutionSession, RuntimeSources, WalkLink, openResolution, resolveMergedConfigInput, walkExtendsChain };
//# sourceMappingURL=session.d.cts.map