import type { BuildResult } from '@winner-fed/bundler-utils/compiled/esbuild'; import { yParser } from '@winner-fed/utils'; import { Config } from '../config/config'; import { ApplyPluginsType, ConfigChangeType, EnableBy, Env, IEvent, IFrameworkType, IModify, ServiceStage } from '../types'; import { Command } from './command'; import { Generator } from './generator'; import { Hook } from './hook'; import { Plugin } from './plugin'; import { Telemetry } from './telemetry'; interface IOpts { cwd: string; env: Env; plugins?: string[]; presets?: string[]; frameworkName?: string; defaultConfigFiles?: string[]; } export declare class Service { private opts; appData: { deps?: Record; framework?: IFrameworkType; prepare?: { buildResult: BuildResult; fileImports?: Record; }; mpa?: { entry?: { [key: string]: string; }[]; }; bundler?: string; [key: string]: any; }; args: yParser.Arguments; commands: Record; generators: Record; config: Record; configSchemas: Record; configDefaults: Record; configOnChanges: Record; cwd: string; env: Env; hooks: Record; name: string; paths: { cwd?: string; absSrcPath?: string; absPagesPath?: string; absApiRoutesPath?: string; absTmpPath?: string; absNodeModulesPath?: string; absOutputPath?: string; }; plugins: Record; keyToPluginMap: Record; pluginMethods: Record; skipPluginIds: Set; stage: ServiceStage; userConfig: Record; configManager: Config | null; pkg: { name?: string; version?: string; dependencies?: Record; devDependencies?: Record; [key: string]: any; }; pkgPath: string; telemetry: Telemetry; constructor(opts: IOpts); applyPlugins(opts: { key: string; type?: ApplyPluginsType.event; initialValue?: any; args?: any; sync: true; }): typeof opts.initialValue | T; applyPlugins(opts: { key: string; type?: ApplyPluginsType; initialValue?: any; args?: any; }): Promise; run(opts: { name: string; args?: any; }): Promise; getPaths(): Promise<{ cwd: string; absSrcPath: string; absPagesPath: string; absApiRoutesPath: string; absTmpPath: string; absNodeModulesPath: string; absOutputPath: string; }>; resolveConfig(): Promise<{ config: any; defaultConfig: any; }>; _profilePlugins(): void; initPreset(opts: { preset: Plugin; presets: Plugin[]; plugins: Plugin[]; }): Promise; initPlugin(opts: { plugin: Plugin; presets?: Plugin[]; plugins: Plugin[]; }): Promise; isPluginEnable(hook: Hook | string): boolean; commandGuessHelper(commands: string[], currentCmd: string): void; get frameworkName(): string; } export interface IServicePluginAPI { appData: typeof Service.prototype.appData; applyPlugins: typeof Service.prototype.applyPlugins; args: typeof Service.prototype.args; config: typeof Service.prototype.config; cwd: typeof Service.prototype.cwd; generators: typeof Service.prototype.generators; pkg: typeof Service.prototype.pkg; pkgPath: typeof Service.prototype.pkgPath; name: typeof Service.prototype.name; paths: Required; userConfig: typeof Service.prototype.userConfig; env: typeof Service.prototype.env; isPluginEnable: typeof Service.prototype.isPluginEnable; onCheck: IEvent; onStart: IEvent; onExit: IEvent; modifyAppData: IModify; modifyConfig: IModify; }>; modifyDefaultConfig: IModify; modifyPaths: IModify; modifyTelemetryStorage: IModify; ApplyPluginsType: typeof ApplyPluginsType; ConfigChangeType: typeof ConfigChangeType; EnableBy: typeof EnableBy; ServiceStage: typeof ServiceStage; registerPresets: (presets: any[]) => void; registerPlugins: (plugins: (Plugin | {})[]) => void; } type DeclareKind = 'value' | 'type'; type Declaration = { type: 'ImportDeclaration'; source: string; specifiers: Array; importKind: DeclareKind; start: number; end: number; } | { type: 'DynamicImport'; source: string; start: number; end: number; } | { type: 'ExportNamedDeclaration'; source: string; specifiers: Array; exportKind: DeclareKind; start: number; end: number; } | { type: 'ExportAllDeclaration'; source: string; start: number; end: number; }; type SimpleImportSpecifier = { type: 'ImportDefaultSpecifier'; local: string; } | { type: 'ImportNamespaceSpecifier'; local: string; imported: string; } | { type: 'ImportNamespaceSpecifier'; local?: string; }; type SimpleExportSpecifier = { type: 'ExportDefaultSpecifier'; exported: string; } | { type: 'ExportNamespaceSpecifier'; exported?: string; } | { type: 'ExportSpecifier'; exported: string; local: string; }; export {};