import type { ImportDeclaration } from '@umijs/bundler-utils/compiled/@babel/types'; import type { BuildResult as ESBuildBuildResult, Plugin as ESBuildPlugin } from '@umijs/bundler-utils/compiled/esbuild'; import type { Express, IConfig, RequestHandler, webpack } from '@umijs/bundler-webpack'; import type WebpackChain from '@umijs/bundler-webpack/compiled/webpack-5-chain'; import { createWebSocketServer } from '@umijs/bundler-webpack/dist/server/ws'; import type { IAdd, IRoute as ICoreRoute, IEvent, IModify, IServicePluginAPI, PluginAPI } from '@umijs/core'; import { Env } from '@umijs/core'; import type { getMarkup } from '@umijs/server'; import type { CheerioAPI } from '@umijs/utils/compiled/cheerio'; import type { InlineConfig as ViteInlineConfig } from 'vite'; import type { getMarkupArgs } from './commands/dev/getMarkupArgs'; import type { IOnDemandInstallDep } from './features/depsOnDemand/depsOnDemand'; import type CodeFrameError from './features/transform/CodeFrameError'; export type { IUtoopackUserConfig } from '@umijs/bundler-utoopack'; export { UmiApiRequest, UmiApiResponse } from './features/apiRoute'; export { IConfig, webpack }; export type IScript = Partial<{ async: boolean; charset: string; content: string; crossOrigin: string | null; defer: boolean; src: string; type: string; }> | string; export type IStyle = Partial<{ content: string; src: string; type: string; }> | string; export type ILink = Partial<{ as: string; crossOrigin: string | null; disabled: boolean; href: string; hreflang: string; imageSizes: string; imageSrcset: string; integrity: string; media: string; referrerPolicy: string; rel: string; rev: string; target: string; type: string; }>; export type IMeta = Partial<{ content: string; 'http-equiv': string; name: string; scheme: string; }>; export type IApiMiddleware = { name: string; path: string; }; export type IEntryImport = { source: string; specifier?: string; }; export type IRoute = ICoreRoute; export type IFileInfo = Array<{ event: string; path: string; }>; export interface ITmpGenerateWatcher { path: string; events?: string[]; } export interface IOnGenerateFiles { files?: IFileInfo | null; isFirstTime?: boolean; } export interface IUIMenu { path: string; url: string; icon: string; name: string; } export interface IUIModule { name: string; menus?: IUIMenu[]; [key: string]: any; } export type GenerateFilesFn = (opts: IOnGenerateFiles) => Promise; export type OnConfigChangeFn = (opts: { generate: GenerateFilesFn; }) => void | Promise; export interface IUniBundlerInstance { dev: (opts: any) => Promise; build: (opts: any) => Promise; [key: string]: any; } export interface IBundlerOpts { config: IConfig; cwd: string; entry: Record; pkg: Record; rootDir: string; ip: string; port: number; host: string; [key: string]: any; } export type IApi = PluginAPI & IServicePluginAPI & { addApiMiddlewares: IAdd; addBeforeBabelPlugins: IAdd; addBeforeBabelPresets: IAdd; addBeforeMiddlewares: IAdd; addEntryCode: IAdd; addEntryCodeAhead: IAdd; addEntryImports: IAdd; addEntryImportsAhead: IAdd; addExtraBabelPlugins: IAdd; addExtraBabelPresets: IAdd; addHTMLHeadScripts: IAdd; addHTMLLinks: IAdd; addHTMLMetas: IAdd; addHTMLScripts: IAdd; addHTMLStyles: IAdd; addLayouts: IAdd; addMiddlewares: IAdd; addOnDemandDeps: IAdd; addPolyfillImports: IAdd; addPrepareBuildPlugins: IAdd; addRuntimePlugin: IAdd; addRuntimePluginKey: IAdd; addTmpGenerateWatcherPaths: IAdd; addUIModules: IAdd; chainWebpack: { (fn: { (memo: WebpackChain, args: { env: Env; ssr?: boolean; webpack: typeof webpack; }): void; }): void; }; modifyBabelPresetOpts: IModify; modifyEntry: IModify, null>; modifyExportHTMLFiles: IModify<{ content: string; path: string; }[], { getMarkup: typeof getMarkup; markupArgs: Awaited>; }>; modifyHTML: IModify; modifyHTMLFavicon: IModify; modifyRendererPath: IModify; modifyRoutes: IModify, {}>; modifyServerRendererPath: IModify; modifyTSConfig: IModify, {}>; modifyUniBundler: IModify; modifyUniBundlerOpts: IModify; modifyViteConfig: IModify; modifyWebpackConfig: IModify; onBeforeCompiler: IEvent<{ compiler: 'vite' | 'webpack'; opts: any; }>; onBeforeMiddleware: IEvent<{ app: Express; }>; onBuildComplete: IEvent<{ close?: webpack.Watching['close']; err?: Error; isFirstCompile: boolean; stats: webpack.Stats; time: number; }>; onBuildHtmlComplete: IEvent<{}>; onCheckCode: IEvent<{ cjsExports: string[]; code: string; CodeFrameError: typeof CodeFrameError; exports: any[]; file: string; imports: { default: string; kind: ImportDeclaration['importKind']; loc: any; namespace: string; source: string; specifiers: Record; }[]; isFromTmp: boolean; }>; onCheckConfig: IEvent<{ config: Record; userConfig: Record; }>; onCheckPkgJSON: IEvent<{ current: Record; origin?: Record; }>; onDevCompileDone: IEvent<{ isFirstCompile: boolean; stats: webpack.Stats; time: number; ws?: ReturnType; }>; onGenerateFiles: IEvent; onPatchRoute: IEvent<{ route: IRoute; }>; onPkgJSONChanged: IEvent<{ current: Record; origin: Record; }>; onPrepareBuildSuccess: IEvent<{ isWatch: boolean; result: ESBuildBuildResult; }>; restartServer: () => void; writeTmpFile: (opts: { content?: string; context?: Record; noPluginDir?: boolean; path: string; tpl?: string; tplPath?: string; }) => void; };