import { moduleFederationPlugin } from "@module-federation/sdk"; import ts from "typescript"; import { ChildProcess } from "child_process"; //#region \0rolldown/runtime.js //#endregion //#region src/core/interfaces/RemoteOptions.d.ts interface RemoteOptions extends moduleFederationPlugin.DtsRemoteOptions { moduleFederationConfig: moduleFederationPlugin.ModuleFederationPluginOptions; context?: string; implementation?: string; hostRemoteTypesFolder?: string; outputDir?: string; } //#endregion //#region src/core/interfaces/TsConfigJson.d.ts interface TsConfigJson { extends?: string; compilerOptions?: ts.CompilerOptions; exclude?: string[]; include?: string[]; files?: string[]; } //#endregion //#region src/core/configurations/remotePlugin.d.ts declare const retrieveRemoteConfig: (options: RemoteOptions) => { tsConfig: TsConfigJson; mapComponentsToExpose: Record; remoteOptions: Required; }; //#endregion //#region src/core/interfaces/HostOptions.d.ts interface HostOptions extends moduleFederationPlugin.DtsHostOptions { moduleFederationConfig: moduleFederationPlugin.ModuleFederationPluginOptions; context?: string; implementation?: string; runtimePkgs?: string[]; } interface RemoteInfo { name: string; url: string; alias: string; zipUrl?: string; apiTypeUrl?: string; } //#endregion //#region src/core/interfaces/DTSManagerOptions.d.ts interface DTSManagerOptions { remote?: RemoteOptions; host?: HostOptions; extraOptions?: Record; displayErrorInTerminal?: moduleFederationPlugin.PluginDtsOptions['displayErrorInTerminal']; } //#endregion //#region src/server/constant.d.ts declare const enum UpdateMode { POSITIVE = "POSITIVE", PASSIVE = "PASSIVE" } //#endregion //#region src/core/lib/DTSManager.d.ts interface UpdateTypesOptions { updateMode: UpdateMode; remoteName?: string; remoteTarPath?: string; remoteInfo?: RemoteInfo; once?: boolean; } declare class DTSManager { options: DTSManagerOptions; runtimePkgs: string[]; remoteAliasMap: Record>; loadedRemoteAPIAlias: Set; extraOptions: Record; updatedRemoteInfos: Record>; constructor(options: DTSManagerOptions); generateAPITypes(mapComponentsToExpose: Record): string; extractRemoteTypes(options: ReturnType): Promise; generateTypes(): Promise; requestRemoteManifest(remoteInfo: RemoteInfo, hostOptions: Required): Promise>; consumeTargetRemotes(hostOptions: Required, remoteInfo: Required): Promise<[string, string]>; downloadAPITypes(remoteInfo: Required, destinationPath: string, hostOptions: Required): Promise; consumeAPITypes(hostOptions: Required): void; consumeArchiveTypes(options: HostOptions): Promise<{ hostOptions: Required; downloadPromisesResult: PromiseSettledResult<[string, string]>[]; }>; consumeTypes(): Promise; updateTypes(options: UpdateTypesOptions): Promise; } //#endregion //#region src/core/rpc/expose-rpc.d.ts declare function exposeRpc(fn: (...args: any[]) => any): void; //#endregion //#region src/core/rpc/types.d.ts declare enum RpcGMCallTypes { CALL = "mf_call", RESOLVE = "mf_resolve", REJECT = "mf_reject", EXIT = "mf_exit" } interface RpcCallMessage { type: RpcGMCallTypes.CALL; id: string; args: unknown[]; } interface RpcResolveMessage { type: RpcGMCallTypes.RESOLVE; id: string; value: unknown; } interface RpcRejectMessage { type: RpcGMCallTypes.REJECT; id: string; error: unknown; } interface RpcExitMessage { type: RpcGMCallTypes.EXIT; id: string; } type RpcMessage = RpcCallMessage | RpcResolveMessage | RpcRejectMessage | RpcExitMessage; type RpcMethod = (...args: any[]) => any; type RpcRemoteMethod = T extends ((...args: infer A) => infer R) ? R extends Promise ? (...args: A) => R : (...args: A) => Promise : (...args: unknown[]) => Promise; //#endregion //#region src/core/rpc/wrap-rpc.d.ts interface WrapRpcOptions { id: string; once?: boolean; } declare function wrapRpc any>(childProcess: ChildProcess, options: WrapRpcOptions): RpcRemoteMethod; //#endregion //#region src/core/rpc/rpc-worker.d.ts interface RpcWorkerBase { connect(...args: unknown[]): any; terminate(): void; readonly connected: boolean; readonly id: string; readonly process: ChildProcess | undefined; } type RpcWorker = RpcWorkerBase & RpcRemoteMethod; declare function createRpcWorker(modulePath: string, data: unknown, memoryLimit?: number, once?: boolean): RpcWorker; declare function getRpcWorkerData(): unknown; //#endregion //#region src/core/rpc/rpc-error.d.ts declare class RpcExitError extends Error { readonly code?: string | number | null; readonly signal?: string | null; constructor(message: string, code?: string | number | null, signal?: string | null); } declare namespace index_d_exports { export { RpcCallMessage, RpcExitError, RpcGMCallTypes, RpcMessage, RpcMethod, RpcRejectMessage, RpcRemoteMethod, RpcResolveMessage, RpcWorker, createRpcWorker, exposeRpc, getRpcWorkerData, wrapRpc }; } //#endregion //#region src/core/lib/DtsWorker.d.ts type DtsWorkerOptions = DTSManagerOptions; declare class DtsWorker { rpcWorker: RpcWorker; private _options; private _res; constructor(options: DtsWorkerOptions); removeUnSerializationOptions(): void; get controlledPromise(): ReturnType; exit(): void; } //#endregion export { DTSManagerOptions as a, retrieveRemoteConfig as c, DTSManager as i, TsConfigJson as l, DtsWorkerOptions as n, HostOptions as o, index_d_exports as r, RemoteInfo as s, DtsWorker as t, RemoteOptions as u };