import type { BuildOptions } from 'esbuild';
import type { ApiExposureConfig } from './ApiExposureConfig.ts';
import type { MonolithConfig } from './MonolithConfig.ts';
export type EntryMode = 'all' | 'single' | 'auto' | 'platform' | 'custom';
/**
 * Configuration for specifying which paths are targeted.
 */
export interface PathConfig {
    /**
     * Glob patterns to exclude (takes precedence over include).
     */
    exclude?: string[];
    /**
     * Glob patterns to include.
     */
    include?: string[];
}
/**
 * Configuration for Dynamic Share.
 */
export interface DynamicShareConfig extends PathConfig {
}
/**
 * Configuration for Live Share.
 */
export interface LiveShareConfig extends PathConfig {
}
/**
 * How `xy compile` produces JavaScript output.
 * - `library` (default): bundle each entry's local source graph; keep npm deps external
 * - `bundle`: bundle entries and selected npm/workspace packages into outputs
 * - `monolith`: one package hosting many modules under `src/modules/` with
 *   `#module` imports — layout sync, library compile with computed entries,
 *   and declaration import rewriting (see MonolithConfig)
 * - `transpile`: emit one output file per source file without rolling up imports
 * - `tsc`: reserved for pure TypeScript emit (not wired into `packageCompile` yet)
 * - `vendor`: copy pre-compiled workspace package dist into a shared vendor tree,
 *   rewrite scoped imports to relative paths, and emit umbrella subpath shims
 */
export type CompileMode = 'bundle' | 'library' | 'monolith' | 'transpile' | 'tsc' | 'vendor';
/**
 * Select which npm packages esbuild inlines when `compile.mode` is `bundle`, or
 * when `compile.mode` is `library` with selective workspace/org bundling enabled.
 */
export interface BundlePackagesConfig {
    /** Bundle all npm packages not matched by other rules or `external`. */
    all?: boolean;
    /** Package names or glob patterns that always stay external (e.g. `typescript`). */
    external?: string[];
    /** Scope prefixes or patterns to bundle (e.g. `@xylabs` or `@xylabs/*`). */
    scopes?: string[];
    /** Bundle packages declared in this monorepo's workspace. */
    workspace?: boolean;
}
/**
 * Select which workspace packages are vendored when `compile.mode` is `vendor`.
 */
export interface VendorPackagesConfig {
    /**
     * Runtime subpath names that emit node/browser/neutral export conditions.
     * When omitted, inferred from packages with multi-platform exports.
     */
    conditionalSubpaths?: string[];
    /** Short package names to skip when vendoring (e.g. `sdk`). */
    exclude?: string[];
    /** Scope prefixes to vendor (e.g. `@internal` or `@internal/*`). */
    scopes: string[];
    /** Umbrella self-scope whose subpath imports are rewritten (e.g. `@ariestools/sdk`). */
    selfScope?: string;
}
/** Barrel source files used to discover the vendored package set. */
export interface VendorBarrelConfig {
    /** Model barrel relative to the package root. Default: `src/model.ts`. */
    model?: string;
    /** Runtime barrel relative to the package root. Default: `src/index.ts`. */
    runtime?: string;
}
export interface CompileConfig {
    /**
     * Which npm packages to inline when bundling. Only applies to `library` (selective)
     * and `bundle` modes. In `bundle` mode, defaults to `{ all: true }` when unset.
     */
    bundlePackages?: BundlePackagesConfig;
    bundleTypes?: boolean;
    /** @param entryMode all, single, custom, platform, or auto */
    entryMode?: EntryMode;
    /**
     * Output strategy for esbuild. Defaults to `library`.
     * `transpile` defaults `entryMode` to `all` when not set explicitly.
     */
    mode?: CompileMode;
    /** Module layout for `mode: 'monolith'`. See {@link MonolithConfig}. */
    monolith?: MonolithConfig;
    /** @param when building types with tsc, should it use the outDir to write to? */
    outDirAsBuildDir?: boolean;
    /**
     * When true (default), `xy compile` runs `tsc -p tsconfig.json` as a
     * no-emit pre-pass to validate every TypeScript file in the package,
     * including specs, stories, configs, and .storybook/. Set to false to
     * skip — useful as a temporary escape hatch while migrating a package.
     */
    validate?: boolean;
    /**
     * How root-level `xy compile` (and build/rebuild/recompile) runs the
     * type-validation pass.
     * - `per-package` (default): spawn `tsc -p` in every workspace
     *   (`package-compile --validate-only`).
     * - `shared`: validate all packages in one process with a shared
     *   source-file cache (the `xy tsc-validate` engine). Each package is
     *   still checked under its own tsconfig options; total work drops
     *   because shared dependency declarations are parsed once.
     * Single-package compiles (`xy compile <pkg>`) always validate in-package.
     */
    validator?: 'per-package' | 'shared';
    /** Barrel paths for `vendor` mode. */
    vendorBarrel?: VendorBarrelConfig;
    /** Directory under `dist/` for vendored workspace packages. Default: `_pkg`. */
    vendorDir?: string;
    /** Workspace packages to vendor when `mode` is `vendor`. */
    vendorPackages?: VendorPackagesConfig;
    /** Rewrite `package.json` `exports` to match the generated vendor layout. Default: true. */
    vendorSyncExports?: boolean;
}
/**
 * Custom entry with an explicit output name, esbuild `{in, out}` style.
 * `in` is relative to the platform source directory; `out` is the dist
 * basename (no extension). Only valid with `entryMode: 'custom'`.
 */
export interface CustomCompileEntry {
    in: string;
    out: string;
}
export type PackageCompileEntryOptions = BuildOptions & Record<string, unknown> & {
    /**
     * Extra entries relative to the platform source directory. This preserves the
     * old tsup-style `entry` field used by existing xy.config.ts files.
     */
    entry?: (string | CustomCompileEntry)[];
    /** @deprecated Use esbuild's `outdir` or the default platform output layout. */
    outDir?: string;
};
export type LegacyPackageCompileOptions = PackageCompileEntryOptions & Record<string, unknown>;
/**
 * Per-platform compile targets follow opt-in semantics:
 * - `true` or a non-empty object (e.g. `{ src: {} }`) → build this target.
 * - `false`, `{}`, or absent → do not build this target. (`{}` is deprecated;
 *   prefer `false` or omitting the field.)
 *
 * When no target is enabled, `neutral` builds by default. Enabling any target
 * turns every unlisted target off — e.g. `{ node: true }` builds node only,
 * while `{ node: true, neutral: true }` builds both.
 */
export type PackageCompileEsbuildConfig = CompileConfig & {
    /** Browser target. See {@link PackageCompileEsbuildConfig} for target semantics. */
    browser?: Record<string, LegacyPackageCompileOptions> | boolean;
    esbuild?: {
        options?: PackageCompileEntryOptions;
    };
    /** Neutral target — built by default when no target is enabled. See {@link PackageCompileEsbuildConfig}. */
    neutral?: Record<string, LegacyPackageCompileOptions> | boolean;
    /** Node target. See {@link PackageCompileEsbuildConfig} for target semantics. */
    node?: Record<string, LegacyPackageCompileOptions> | boolean;
    /** @deprecated Use `esbuild.options` instead. Shared fields are still honored. */
    tsup?: {
        options?: LegacyPackageCompileOptions;
    };
    verbose?: boolean;
};
/** @deprecated Use PackageCompileEsbuildConfig. */
export type PackageCompileTsupConfig = PackageCompileEsbuildConfig;
export type PackageCompileTscConfig = CompileConfig & {
    mode: 'tsc';
};
/** Vendor mode uses the same per-platform target fields as esbuild compile. */
export type PackageCompileVendorConfig = PackageCompileEsbuildConfig & {
    mode: 'vendor';
};
/** Monolith mode compiles via the esbuild library pipeline with computed entries. */
export type PackageCompileMonolithConfig = PackageCompileEsbuildConfig & {
    mode: 'monolith';
    monolith: MonolithConfig;
};
/**
 * How deplint should classify a dependency.
 * - `dep`: must stay in `dependencies` (never promoted to peerDependencies)
 * - `peer`: should be treated as a peerDependency (overrides a parent `dep` setting)
 * - `dev`: must only appear in `devDependencies`; flagged as misplaced if found in `dependencies` or `peerDependencies`
 */
export type DeplintRefType = 'dep' | 'dev' | 'peer';
/**
 * Per-package configuration within deplint.
 */
export interface DeplintPackageConfig {
    /**
     * Force `peerDependenciesMeta[<name>].optional` when this package is added
     * to `peerDependencies`. Omit (default) to auto-derive from the requiring
     * dependencies' own `peerDependenciesMeta` — optional only when every
     * requiring source marks it optional.
     */
    peerOptional?: boolean;
    /** How this dependency should be classified. */
    refType?: DeplintRefType;
}
export type DeplintRuleLevel = 'error' | 'off' | 'warn';
export interface DeplintRuleCommonOptions {
    /**
     * Package names or glob patterns to suppress for this rule.
     * Examples: `react`, `@scope/*`.
     */
    ignore?: string[];
}
export interface DeplintPeerRangeStyleRuleOptions extends DeplintRuleCommonOptions {
    /**
     * Broad peer range upper-bound style. Setting this implies
     * `form: "broad"` for backward compatibility.
     * - `infer` keeps the current behavior: `~` devDeps use a minor bound,
     *   everything else uses a major bound.
     * - `major` always uses `<next-major>`.
     * - `minor` always uses `<next-minor>`.
     */
    bound?: 'infer' | 'major' | 'minor';
    /**
     * Peer range style to enforce.
     * - `shorthand` rejects non-canonical ranges and fixes them to full-patch
     *   caret ranges like `^1.2.3`.
     * - `broad` enforces the legacy comparator form.
     * @default "shorthand"
     */
    form?: 'broad' | 'shorthand';
}
export interface DeplintWorkspaceProtocolRuleOptions extends DeplintRuleCommonOptions {
    /**
     * Workspace protocol value to write with `xy deplint --fix`.
     * When set explicitly, the rule also enforces this exact value.
     * @default "workspace:~"
     */
    protocol?: 'workspace:*' | 'workspace:^' | 'workspace:~';
}
export type DeplintRuleConfig<TOptions extends object = DeplintRuleCommonOptions> = DeplintRuleLevel | [DeplintRuleLevel, TOptions];
export interface DeplintRulesConfig {
    [ruleId: string]: DeplintRuleConfig | undefined;
    'deplint.dependencies.range-style'?: DeplintRuleConfig;
    'deplint.devDependencies.range-style'?: DeplintRuleConfig;
    'deplint.peerDependencies.range-style'?: DeplintRuleConfig<DeplintPeerRangeStyleRuleOptions>;
    'deplint.workspace.protocol'?: DeplintRuleConfig<DeplintWorkspaceProtocolRuleOptions>;
}
/**
 * Configuration for deplint (dependency linting).
 */
export interface DeplintConfig {
    /**
     * How deplint decides whether an external runtime dependency of a library
     * belongs in `dependencies` or `peerDependencies`.
     * - `legacy` (default): every external runtime dep of a library defaults
     *   to `peerDependencies`.
     * - `aei`: score each dependency with the API Exposure Index analyzer
     *   (`xy api-exposure`); only deps whose public-API coupling recommends a
     *   peer are promoted, borderline scores produce a non-fixable
     *   `deplint.dependencies.aei-review` warning instead of a fix.
     * `refType` overrides, terminal packages, workspace-internal deps, and
     * `@types/*` handling always take precedence over either classifier.
     */
    classifier?: 'aei' | 'legacy';
    /**
     * Workspace-relative file or directory globs to exclude from source scanning.
     * Use this for generated build output such as Electron release folders.
     */
    exclude?: string[];
    /**
     * Per-dependency configuration keyed by package name.
     * Cascades from root to package configs (maps are merged, with
     * package-level entries overriding root-level entries for the same key).
     */
    packages?: Record<string, DeplintPackageConfig>;
    /**
     * Additional deplint rule plugins to load.
     * Entries may be package names, absolute paths, or paths relative to the
     * current working directory.
     */
    plugins?: string[];
    /**
     * ESLint-style rule configuration keyed by rule id.
     *
     * Examples:
     * ```ts
     * rules: {
     *   'deplint.dependencies.unused': 'off',
     *   'deplint.peerDependencies.range-style': ['warn', { ignore: ['typescript'], form: 'broad', bound: 'major' }],
     *   'deplint.workspace.protocol': ['error', { protocol: 'workspace:^' }],
     * }
     * ```
     *
     * Root and package-level configs are merged by rule id; when the same rule
     * is configured in a package, its entry replaces the root entry.
     * Unconfigured rules default to warning severity and do not fail `xy deplint`.
     */
    rules?: DeplintRulesConfig;
    /**
     * Treat this package as terminal (an app or CLI, not a library).
     * Terminal packages send unsatisfied runtime peers to `dependencies`
     * instead of `peerDependencies`, and are exempt from the library
     * peer-promotion rule.
     *
     * Auto-detected when `private: true`, or when the package looks like a
     * bundled CLI (has `bin`, no `main`/`module`, and `exports` either
     * missing or limited to `.`/`./package.json`/`./README.md`). Set this
     * explicitly when neither auto-detection fires — e.g. a published CLI
     * with library-shaped exports.
     */
    terminal?: boolean;
}
/**
 * Canonical names for individually toggleable publint checks.
 */
export type PublintCheckName = 'compileTargets' | 'defaultExportOrder' | 'files' | 'importToDefault' | 'main' | 'module' | 'neutralToDefault' | 'peerDeps' | 'platform' | 'publint' | 'resolutions' | 'rootSource' | 'rootTypes' | 'sideEffects' | 'source' | 'types';
export declare const ALL_PUBLINT_CHECKS: PublintCheckName[];
/** Checks that are resolved by the workspace-level publint runner, not by packagePublintDetailed. */
export declare const WORKSPACE_PUBLINT_CHECKS: PublintCheckName[];
/** Checks that only apply to published (non-private) packages */
export declare const PUBLISH_ONLY_CHECKS: PublintCheckName[];
/**
 * Configuration for publint (package publishing linting).
 */
export interface PublintConfig {
    /**
     * Check names to exclude from publint runs.
     * All checks run by default; listed names are skipped.
     * Cannot be used together with `include`.
     */
    exclude?: PublintCheckName[];
    /**
     * Check names to include (whitelist) in publint runs.
     * Only listed checks will run; all others are skipped.
     * Cannot be used together with `exclude`.
     */
    include?: PublintCheckName[];
    /**
     * Whether to run `pack` when invoking the publint library.
     * When true (default), the package manager is used to determine which
     * files would be published. Set to false to skip packing for faster runs.
     */
    pack?: boolean;
}
export type DeadRuleLevel = 'error' | 'off' | 'warn';
export interface DeadRuleCommonOptions {
    /**
     * Package names or glob patterns to suppress for this rule.
     * Examples: `react`, `@scope/*`.
     */
    ignore?: string[];
}
export type DeadRuleConfig<TOptions extends object = DeadRuleCommonOptions> = DeadRuleLevel | [DeadRuleLevel, TOptions] | TOptions;
export interface DeadRulesConfig {
    [ruleId: string]: DeadRuleConfig | undefined;
    'dead.package.internal'?: DeadRuleConfig;
    'dead.repo.deprecated-export'?: DeadRuleConfig;
    'dead.repo.export'?: DeadRuleConfig;
    'dead.repo.internal'?: DeadRuleConfig;
    'dead.workspace.deprecated-export'?: DeadRuleConfig;
    'dead.workspace.deprecated-unused-export'?: DeadRuleConfig;
    'dead.workspace.export'?: DeadRuleConfig;
    'dead.workspace.export-published'?: DeadRuleConfig;
}
/**
 * Configuration for dead-code analysis (`xy dead`).
 *
 * Workspace-scoped export rules split by package visibility:
 * - `dead.workspace.export` (on by default) — restricted/scoped packages whose exports
 *   are not imported by any other folder in the active `*.code-workspace`.
 * - `dead.workspace.export-published` (off by default) — explicitly public packages;
 *   enable with `'warn'` or `'error'` when you want the same check for public packages.
 */
export interface DeadConfig {
    /**
     * ESLint-style rule configuration keyed by rule id.
     *
     * Examples:
     * ```ts
     * rules: {
     *   'dead.package.internal': { ignore: ['@scope/pkg'] },
     *   'dead.workspace.export-published': 'warn',
     *   'dead.repo.export': ['error', { ignore: ['@scope/*'] }],
     * }
     * ```
     */
    rules?: DeadRulesConfig;
}
/**
 * Configuration for packman lint (package manager config linting).
 */
export interface PackmanConfig {
    /**
     * Minimum age in minutes that a package must be published before pnpm will install it.
     * Only applies when pnpm is the detected package manager.
     * @default 1440 (1 day)
     */
    minimumReleaseAge?: number;
    /**
     * Package patterns to exclude from the minimumReleaseAge requirement.
     * These packages can be installed immediately upon release.
     * Supports exact names and scoped wildcards (e.g. '@myorg/*').
     * @default ["'@xylabs/*'", "'@xyo-network/*'"]
     */
    minimumReleaseAgeExclude?: string[];
}
/**
 * Command-specific configuration that cascades from root to package.
 * Settings here override the legacy top-level equivalents.
 */
export interface CommandsConfig {
    apiExposure?: ApiExposureConfig;
    dead?: DeadConfig;
    deplint?: DeplintConfig;
    packman?: PackmanConfig;
    publint?: boolean | PublintConfig;
}
export interface XyConfigBase {
    /**
     * Command-specific settings grouped under `commands`.
     * These cascade from root xy.config down to per-package xy.config files.
     * Takes precedence over the legacy top-level `deplint`/`publint` fields.
     */
    commands?: CommandsConfig;
    compile?: CompileConfig;
    /** @deprecated Use `commands.deplint` instead. */
    deplint?: DeplintConfig;
    dynamicShare?: DynamicShareConfig;
    liveShare?: LiveShareConfig;
    /** @deprecated Use `commands.publint` instead. */
    publint?: boolean | PublintConfig;
    verbose?: boolean;
}
export interface XyEsbuildConfig extends XyConfigBase {
    compile?: PackageCompileEsbuildConfig;
}
/** @deprecated Use XyEsbuildConfig. */
export interface XyTsupConfig extends XyConfigBase {
    compile?: PackageCompileEsbuildConfig;
}
export interface XyTscConfig extends XyConfigBase {
    compile?: PackageCompileTscConfig;
}
export type XyConfigLegacy = XyEsbuildConfig | XyTscConfig;
export type XyConfig = XyConfigLegacy & {
    dev?: {
        build?: {
            clean?: boolean;
            compile?: boolean;
            deplint?: boolean;
            gitlint?: boolean;
            license?: boolean;
            lint?: boolean;
            publint?: boolean;
            statics?: boolean;
            verbose?: boolean;
        };
        compile?: PackageCompileEsbuildConfig;
        verbose?: boolean;
    };
    verbose?: boolean;
};
//# sourceMappingURL=XyConfig.d.ts.map