import { type Plugin } from 'rollup'; import { type ForgePluginBabelOptions } from '@flatjs/forge-plugin-babel'; import { type ForgePluginMultiInputOptions } from '@flatjs/forge-plugin-multi-input'; import { type PluginTerserOptions } from '@flatjs/forge-plugin-terser'; import { type ForgePluginTsPathsOptions } from '@flatjs/forge-plugin-ts-paths'; import { type RollupAliasOptions } from '@rollup/plugin-alias'; import { type RollupCommonJSOptions } from '@rollup/plugin-commonjs'; import { type RollupJsonOptions } from '@rollup/plugin-json'; import { type RollupNodeResolveOptions } from '@rollup/plugin-node-resolve'; import { type Replacement } from '@rollup/plugin-replace'; export interface ForgePluginConfigs { /** * Rollup Plugin to automatically resolve path aliases set in the compilerOptions section of tsconfig.json. * @example * ```ts * // For Mono repo, sometimes we want to build `lib` in packages/*, at this time, we may use "tsPaths" instead use `alias` * pluginConfigs: { * tsPaths: { * options: { * preserveExtensions: true, * tsConfigPath: join(__dirname, './tsconfig.build.json'), * }, * }, * .... * ``` */ tsPathsOptions?: ForgePluginTsPathsOptions; /** * rollup input filter with fast-glob options * now only support pass */ multiInputOptions?: Omit; /** * A Rollup plugin which replaces strings in files while bundling. * @package @rollup/plugin-replace */ replaceOptions?: { [str: string]: Replacement; }; /** * Specifies an `Object`, or an `Array` of `Object` * @link https://www.npmjs.com/package/@rollup/plugin-alias */ aliasOptions?: RollupAliasOptions; /** * @rollup/plugin-node-resolve */ nodeResolveOptions?: RollupNodeResolveOptions; /** * @rollup/plugin-json */ jsonOptions?: RollupJsonOptions; /** * @rollup/plugin-commonjs */ commonjsOptions?: RollupCommonJSOptions; /** * babel override configurations {presets, plugins} will merged via `babel-merge` * we also can setup babelOptions to `false` to disable babel transform, maybe you want to use `esbuild` instead. * @package @flatjs/forge-plugin-babel */ babelOptions?: false | ForgePluginBabelOptions['babelOptions']; /** * plugin options to minify generated es bundle. * https://github.com/TrySound/rollup-plugin-terser * @default true */ terserOptions?: boolean | PluginTerserOptions; } /** * the plugins for compiler */ export interface ForgePluginOption { /** * Extra rollup plugins */ extraPlugins?: Plugin[]; /** * All available plugin configurations. */ pluginConfigs?: ForgePluginConfigs; }