import { ProjectGraph, ProjectsConfigurations } from '@nx/devkit';
import { TypeScriptBuildOptions, AdditionalCLIOptions } from '@storm-software/build-tools';
import { StormWorkspaceConfig } from '@storm-software/config/types';
import { Options } from 'tsdown';

type ExternalTSDownOptions = Omit<Options, "treeshake" | "outDir" | "external">;
type TSDownOptions = ExternalTSDownOptions & Partial<Pick<TypeScriptBuildOptions, "name" | "mode" | "outputPath" | "assets" | "format" | "treeShaking" | "sourceRoot" | "debug" | "generatePackageJson">> & Required<Pick<TypeScriptBuildOptions, "projectRoot">> & {
    external?: string | RegExp | Array<string | RegExp>;
    noExternal?: string | RegExp | Array<string | RegExp>;
    distDir?: string;
};
type TSDownResolvedOptions = Options & Required<Pick<Options, "entry" | "outDir" | "format">> & Required<Pick<TSDownOptions, "name" | "mode" | "projectRoot" | "sourceRoot" | "assets" | "generatePackageJson">> & {
    workspaceConfig: StormWorkspaceConfig;
    projectName: string;
    projectGraph?: ProjectGraph;
    projectConfigurations?: ProjectsConfigurations;
};
type MaybePromise<T> = T | Promise<T>;
type TSDownCLIOptions = AdditionalCLIOptions & TSDownOptions;

export type { MaybePromise, TSDownCLIOptions, TSDownOptions, TSDownResolvedOptions };
