import type { Configuration as RsConfig, RspackOptions } from '@rspack/core'; import { rspack } from '@rspack/core'; import { deepAssign, getLanIp, vCompare } from '../helper/utils'; import { Chain } from './chain'; import { type EmpConfig } from './empConfig'; import { StoreServer } from './server'; import type { EmpOptions, InjectTagsType, StoreRootPaths } from '../types/config'; import type { CliActionType, CliOptionsType, EMPModeType } from '../types/env'; export declare class GlobalStore { rspack: typeof rspack; rspackVersion: string; isOldRspack: boolean; /** * EMP Version * @default package version */ empPkg: any; /** * 项目pkg信息 */ pkg: any; /** * 项目根目录绝对路径 * @default process.cwd() */ root: string; /** * emp 内部根路径 * @default empRoot */ empRoot: string; /** * emp 执行代码路径 */ empSource: string; /** * 获取项目 根目录绝对路径 * (*) relativePath 可以是绝对路径 * @param relativePath * @returns */ resolve: (relativePath: string) => string; /** * 获取项目 emp内部根目录绝对路径 * @param relativePath * @returns */ empResolve: (relativePath: string) => string; /** * 源码地址 绝对路径 */ appSrc: string; /** * 源码生成目录 绝对路径 */ outDir: string; /** * 静态文件目录 绝对路径 */ publicDir: string; /** * 静态资源 */ resource: { dir: string; key: string; cert: string; }; /** * chain 配置相关 */ chainName: { rule: { mjs: string; typescript: string; javascript: string; sourceMap: string; inline: string; raw: string; svg: string; image: string; font: string; svga: string; sass: string; less: string; css: string; }; use: { swc: string; sourceMap: string; sass: string; less: string; }; plugin: { tsCheckerRspackPlugin: string; circularCheckRspackPlugin: string; bundleAnalyzer: string; define: string; copy: string; progress: string; html: { prefix: string; }; rsdoctor: string; sourceMapDevTool: string; }; minimizer: { minJs: string; minCss: string; }; }; /** * server 配置相关 */ server: StoreServer; /** * 缓存目录 绝对路径 */ cacheDir: string; mode: EMPModeType; cliMode: 'dev' | 'prod'; isDev: boolean; /** * 项目配置 */ chain: Chain; rsConfig: RsConfig; empOptions: EmpOptions; empConfig: EmpConfig; entries: { [chunkName: string]: RspackOptions['entry']; }; debug: EmpConfig['debug']; cliAction: CliActionType; cliOptions: CliOptionsType; rootPaths: StoreRootPaths; beforeSetup?: () => Promise | void; afterSetup?: () => Promise | void; setup(cliAction?: CliActionType, cliOptions?: any): Promise; /** * 初始化 基础变量 * @param mode cli名称 * @param cliOptions cli配置 */ private initVars; /** * 初始化 基础路径 */ private initPaths; /** * 设置 日志等级 */ private loggerExtensionName; setLoggerExtensionName(name: string): void; setLogger(): void; merge(o: RspackOptions): void; /** * 同步 chain 配置到 rsConfig */ toConfig(): void; /** * 打印 config */ logConfig(): void; get browserslistOptions(): { default: string[]; h5: string[]; node: string[]; }; get uniqueName(): string; encodeVarName(name: string): string; vCompare: typeof vCompare; deepAssign: typeof deepAssign; getLanIp: typeof getLanIp; injectTags(o?: InjectTagsType, name?: string, chunk?: string): void; } declare const _default: GlobalStore; export default _default;