/**
 * Helper routines for use with the jsii compiler
 *
 * These are mostly used for testing, but all projects that need to exercise
 * the JSII compiler to test something need to share this code, so might as
 * well put it in one reusable place.
 */
import { PackageJson } from '@jsii/spec';
import * as spec from '@jsii/spec';
import { Diagnostic } from 'typescript';
import { CompilerOptions } from './compiler';
/**
 * A set of source files for `sourceToAssemblyHelper`, at least containing 'index.ts'
 */
export type MultipleSourceFiles = {
    'index.ts': string;
    [name: string]: string;
};
/**
 * Assembly features supported by this compiler
 */
export declare const ASSEMBLY_FEATURES_SUPPORTED: spec.JsiiFeature[];
/**
 * Compile a piece of source and return the JSII assembly for it
 *
 * Only usable for trivial cases and tests.
 *
 * @param source can either be a single `string` (the content of `index.ts`), or
 *               a map of fileName to content, which *must* include `index.ts`.
 * @param options accepts a callback for historical reasons but really expects to
 *                take an options object.
 */
export declare function sourceToAssemblyHelper(source: string | MultipleSourceFiles, options?: TestCompilationOptions | ((obj: PackageJson) => void)): spec.Assembly;
export type HelperCompilationOut = HelperCompilationResult | HelperCompilationFailure;
/**
 * Successful output of a compilation command (for testing)
 *
 * A better name would have been `HelperCompilationSuccess`, but the name is part of
 * the public API surface, so we keep it like this.
 */
export interface HelperCompilationResult {
    readonly type: 'success';
    /**
     * The generated assembly
     */
    readonly assembly: spec.Assembly;
    /**
     * Generated .js/.d.ts file(s)
     */
    readonly files: Record<string, string>;
    /**
     * The packageInfo used
     */
    readonly packageJson: PackageJson;
    /**
     * Whether to compress the assembly file
     */
    readonly compressAssembly: boolean;
    /**
     * Diagnostics that occurred during compilation
     */
    readonly diagnostics: readonly Diagnostic[];
}
export interface HelperCompilationFailure {
    readonly type: 'failure';
    /**
     * Diagnostics that occurred during compilation
     *
     * Contains at least one error.
     */
    readonly diagnostics: readonly Diagnostic[];
}
/**
 * Compile a piece of source and return the assembly and compiled sources for it
 *
 * Only usable for trivial cases and tests.
 *
 * @param source can either be a single `string` (the content of `index.ts`), or
 *               a map of fileName to content, which *must* include `index.ts`.
 * @param options accepts a callback for historical reasons but really expects to
 *                take an options object.
 */
export declare function compileJsiiForTest<O extends TestCompilationOptions>(source: string | {
    'index.ts': string;
    [name: string]: string;
}, options?: O | ((obj: PackageJson) => void), compilerOptions?: Omit<CompilerOptions, 'projectInfo' | 'watch'>): ResultOrSuccess<O>;
type ResultOrSuccess<O extends TestCompilationOptions> = O['captureDiagnostics'] extends true ? HelperCompilationOut : HelperCompilationResult;
export interface TestCompilationOptions {
    /**
     * The directory in which we write and compile the files
     */
    readonly compilationDirectory?: string;
    /**
     * Parts of projectInfo to override (package name etc)
     *
     * @deprecated Prefer using `packageJson` instead.
     */
    readonly projectInfo?: Partial<PackageJson>;
    /**
     * Parts of projectInfo to override (package name etc)
     *
     * @default - Use some default values
     */
    readonly packageJson?: Partial<PackageJson>;
    /**
     * Whether to compress the assembly file.
     *
     * @default false
     */
    readonly compressAssembly?: boolean;
    /**
     * Whether or not to print the diagnostics
     *
     * @default false
     */
    readonly captureDiagnostics?: boolean;
}
/**
 * An NPM-ready workspace where we can install test-compile dependencies and compile new assemblies
 */
export declare class TestWorkspace {
    readonly rootDirectory: string;
    /**
     * Create a new workspace.
     *
     * Creates a temporary directory, don't forget to call cleanUp
     */
    static create(): TestWorkspace;
    /**
     * Execute a block with a temporary workspace
     */
    static withWorkspace<A>(block: (ws: TestWorkspace) => A): A;
    private readonly installed;
    private constructor();
    /**
     * Add a test-compiled jsii assembly as a dependency
     */
    addDependency(dependencyAssembly: HelperCompilationOut): void;
    dependencyDir(name: string): string;
    cleanup(): void;
}
export type PackageInfo = PackageJson;
/**
 * TSConfig paths can either be relative to the project or absolute.
 * This function normalizes paths to be relative to the provided root.
 * After normalization, code using these paths can be much simpler.
 *
 * @param root the project root
 * @param pathToNormalize the path to normalize, might be empty
 */
export declare function normalizeConfigPath(root: string, pathToNormalize?: string): string | undefined;
export {};
//# sourceMappingURL=helpers.d.ts.map