import type { Configuration as WebpackOptions } from 'webpack'; import type { Configuration as WebpackDevServerOptions } from 'webpack-dev-server'; import type ChainableWebpackConfig from 'webpack-chain'; import type { NpmClientType } from '../utils/getNpmClient.js'; import type { CommandItem } from './Service.js'; import type Service from './Service.js'; declare class PluginApi { id: string; service: Service; constructor(id: string, service: Service); get version(): string; get appName(): string; get npmClient(): NpmClientType; used: { typescript: () => boolean; tailwind: () => boolean; swc: () => boolean; babel: () => boolean; serviceWorker: () => boolean; jestConfig: () => string | undefined; }; assertVersion(range: number | string): void; /** * Current working directory. * * @return {string} */ getCwd(): string; /** * Resolve path for a project. * * @param {string[]} paths - Relative path from project root * @return {string} The resolved absolute path. */ resolve(...paths: string[]): string; /** * Check if the project has a given plugin. * * @param {string} id - Plugin id, can omit the (@planjs/|vue-|@scope/vue)-cli-plugin- prefix * @return {boolean} */ hasPlugin(id: string): boolean; /** * Register a command that will become available as `vue-cli-service [name]`. * * @param {string} name * @param {object} [options] * { * description: string, * usage: string, * details: string, * options: { [string]: string } * } * @param {function} fn * (args: { [string]: string }, rawArgs: string[]) => ?Promise */ registerCommand(name: string, options: Omit | CommandItem['fn'], fn?: CommandItem['fn']): void; /** * Register a function that will receive a chainable webpack config * the function is lazy and won't be called until `resolveWebpackConfig` is * called * * @param {function} fn */ chainWebpack(fn: (config: ChainableWebpackConfig) => void): void; /** * Register * - a webpack configuration object that will be merged into the config * OR * - a function that will receive the raw webpack config. * the function can either mutate the config directly or return an object * that will be merged into the config. * * @param {object | function} fn */ configureWebpack(fn: WebpackOptions | ((config: WebpackOptions) => WebpackOptions | void)): void; /** * Register a dev serve config function. It will receive the express `app` * instance of the dev server. * * @param {function} fn */ configureDevServer(fn: WebpackDevServerOptions['setupMiddlewares']): void; /** * Resolve the final raw webpack config, that will be passed to webpack. * * @param {ChainableWebpackConfig} [chainableConfig] * @return {object} Raw webpack config. */ resolveWebpackConfig(chainableConfig?: ChainableWebpackConfig): WebpackOptions; /** * Resolve an intermediate chainable webpack config instance, which can be * further tweaked before generating the final raw webpack config. * You can call this multiple times to generate different branches of the * base webpack config. * See https://github.com/mozilla-neutrino/webpack-chain * * @return {ChainableWebpackConfig} */ resolveChainableWebpackConfig(): ChainableWebpackConfig; /** * Generate a cache identifier from a number of variables */ getCacheIdentifier(id: string, partialIdentifier: any, configFiles?: string[] | string): { cacheDirectory: string; cacheIdentifier: string; }; } export default PluginApi;