import { Awaitable } from '@alexaegis/common'; import { WorkspacePackage } from '@alexaegis/workspace-tools'; import { DefaultAutotoolElements } from '../default/index.js'; import { NormalizedAutotoolPluginOptions } from '../plugin/index.js'; import { AutotoolElementValidator } from '../validator/element-validator.interface.js'; import { AutotoolElementExecutor } from './autotool-element-executor.interface.js'; import { AutotoolElement, UntargetedAutotoolElement } from './autotool-element.interface.js'; import { PackageJsonFilter } from './package-json-filter.interface.js'; export type AutotoolPluginElementPackageTargetKind = WorkspacePackage['packageKind'] | 'all'; export interface AutotoolPluginFilter { /** * Conditionally apply all elements based on the contents of the target * package. * * You can also set this at the element level. */ packageJsonFilter?: PackageJsonFilter | undefined; /** * 'workspace' means this will only be applied to the root package, the * entire workspace. 'regular' means a normal package thats inside the * workspace. The default 'both' setting will apply the plugin to both * the entire workspace and all inner packages too. * * You can also set this at the element level. * * @default 'both' */ packageKind?: AutotoolPluginElementPackageTargetKind | undefined; } export type ExecutorsOf = Elements extends UntargetedAutotoolElement ? Record> : never; export interface AutotoolPluginObject extends AutotoolPluginFilter { /** * Used to scope logging, it's best to use the name of the package * * The only reason it's not autofilled during load is that one package can * export multiple plugins. */ name: string; /** * Some elements like JSON properties and files are treated as templates. * Values defined as `${key}` will be replaced if a variable here is found * with the same name. * * Can also be defined per element, will overwrite plugin level variables. */ templateVariables?: Record | undefined; elements?: (Elements | DefaultAutotoolElements)[] | undefined; executors?: ExecutorsOf; /** * The plugin can provide validators. Validators are called after elements * are distributed to their packages, but before they are executed. * If any validator returns an error, execution will not procceed at all. * If you enable `--partial` execution, only the package where the error * originates from is skipped. */ validators?: AutotoolElementValidator[]; } export type AutotoolPluginFactory = (options: NormalizedAutotoolPluginOptions) => Awaitable> | Awaitable[]>; export type AutotoolPlugin = Awaitable> | Awaitable[]> | Awaitable> | Awaitable[]>; //# sourceMappingURL=autotool-plugin.interface.d.ts.map