import type { SourceMapConsumer, RawSourceMap } from 'source-map'; import { LoaderData, ResourceLoaderData } from './loader.js'; import { ResolverData } from './resolver.js'; import { PluginData } from './plugin.js'; import { BuilderStoreData, EMOStoreData } from './result.js'; import { ModuleGraphInstance, ToDataType } from './module.js'; import { RsdoctorManifestClientRoutes, RsdoctorManifestWithShardingFiles } from '../manifest.js'; import { RuntimeContext, RuntimeContextOptions } from './context.js'; import { Hooks } from './hooks.js'; import { ChunkGraphInstance } from './chunk.js'; import { RsdoctorServerInstance } from './server/index.js'; import { PlainObject } from '../common.js'; import { BriefModeOptions } from '../config.js'; import { EmoCheckData } from '../emo.js'; import { SummaryData } from './summary.js'; import { ConfigData } from './config.js'; export type WriteStoreOptionsType = {}; export declare enum IMode { brief = "brief", lite = "lite", normal = "normal" } export interface RsdoctorBuilderSDKInstance extends RsdoctorSDKInstance { readonly server: RsdoctorServerInstance; type: ToDataType; /** Report configuration information */ reportConfiguration(config: ConfigData[0]): void; /** Report error message */ reportError(errors: Error[]): void; /** Report error message */ reportLoader(data: LoaderData): void; /** Report loader message before or after some builtin loader */ reportLoaderStartOrEnd(data: ResourceLoaderData): void; /** Report path request information */ reportResolver(data: ResolverData): void; /** Report plugin information */ reportPlugin(data: PluginData): void; /** Report module chart data */ reportModuleGraph(data: ModuleGraphInstance): void; reportChunkGraph(data: ChunkGraphInstance): void; /** report the data of summary */ reportSummaryData(part: Partial): void; /** Report sourceMap data */ reportSourceMap(data: RawSourceMap): void; getClientRoutes(): RsdoctorManifestClientRoutes[]; addClientRoutes(routes: RsdoctorManifestClientRoutes[]): void; /** Application error modification */ applyErrorFix(id: number): Promise; /** Get build result data */ getStoreData(): BuilderStoreData; /** Get build resource entry file */ getManifestData(): RsdoctorManifestWithShardingFiles; /** Get rule context */ getRuleContext(options: RuntimeContextOptions): RuntimeContext; /** Get SourceMap from cache */ getSourceMap(file: string): Promise; /** clear cache */ clearSourceMapCache(): void; /** Clear all data */ clear(): void; /** Write store data to files */ writeStore(options?: WriteStoreOptionsType): Promise; } export interface RsdoctorEMOSDKInstance extends RsdoctorSDKInstance { reportEmoData(data: EmoCheckData): void; getStoreData(): EMOStoreData; } export interface RsdoctorSDKInstance { readonly name: string; readonly root: string; readonly extraConfig: SDKOptionsType | undefined; readonly hooks: Hooks; /** * folder of manifest * - used to save the manifest.json and sharding files. * @default ".rsdoctor" */ readonly outputDir: string; /** manifest local path */ diskManifestPath: string; /** start */ bootstrap(): Promise; dispose(): Promise; /** Change output path */ setOutputDir(outputDir: string): void; /** Change build name */ setName(name: string): void; setHash(hash: string): void; getHash(): string; /** * write the manifest to a folder * - use this.outputDir * @returns the absolute path of manifest.json. */ saveManifest(storeData: PlainObject, options: WriteStoreOptionsType): Promise; } export interface IPrintLog { serverUrls: boolean; } export type SDKOptionsType = { innerClientPath?: string; disableClientServer?: boolean; noServer?: boolean; printLog?: IPrintLog; mode?: keyof typeof IMode; brief?: BriefModeOptions; features?: { treeShaking?: boolean; }; };