import { type WatcherOptions } from 'rollup'; import { type ModularImportOption } from '@flatjs/forge-plugin-babel'; import { type ForgePluginDtsOptions } from '@flatjs/forge-plugin-dts'; import { type MultiInputOption } from '@flatjs/forge-plugin-multi-input'; import { type ForgeOutputOption } from './types-output.js'; import { type ForgePluginOption } from './types-plugin.js'; export interface FlatForgeOptions { /** * the project root directory */ projectCwd: string; /** * Must be undefined here, don't setup default value, because we need to use `projectCwd` as default. * if defined value here, we must pass `builtToCwd` in `ForgeBuildOptions` in each build cycle. * @default undefined */ builtToCwd?: string; /** * Customized externals modules. * @default [] */ externals?: Array; /** * rollup input, Note input must be valid fast-glob rules. * Normally it's absolute entry path. */ input: MultiInputOption; /** * Generate dts typings * @default true */ dts?: ForgePluginDtsOptions['dtsOptions']; /** * rollup output */ output: ForgeOutputOption; /** * rollup plugin configuration */ plugin: ForgePluginOption; /** * Modular import plugin for babel, compatible with antd, antd-mobile, lodash, material-ui, and so on. * Note: * - In `@flatjs/forge` if we config modular it will always ignored `bundledDependencies` * - because babel transpile/extract tree-shaking codes before `rollup`. * - normally it used to finnaly production build to reduce bundle size e.g for `miniprogram` build. */ modularImports?: ModularImportOption[]; /** * Specify options for watch mode or prevent this configuration from being watched. * Specifying false is only really useful when an array of configurations is used. In that case, this configuration will not be built or rebuilt on change in watch mode, but it will be built when running Rollup regularly: * Typings for `forge-serve` * @default {} */ watchOptions?: WatcherOptions; /** * the value indicates if we need to print some logging messages. * `true`: don't show message, `false` show message * @default false */ logSilent?: boolean; }