@rushstack/heft
Version:
Build all your JavaScript projects the same way: A way that works.
108 lines • 4.49 kB
TypeScript
import { type IPackageJson } from '@rushstack/node-core-library';
import { type ITerminalProvider, type ITerminal } from '@rushstack/terminal';
import { type IProjectConfigurationFileSpecification } from '@rushstack/heft-config-file';
import { type IRigConfig } from '@rushstack/rig-package';
import { type IRigPackageResolver } from './RigPackageResolver';
/**
* @internal
*/
export interface IHeftConfigurationInitializationOptions {
/**
* The working directory the tool was executed in.
*/
cwd: string;
/**
* Terminal instance to facilitate logging.
*/
terminalProvider: ITerminalProvider;
/**
* The number of CPU cores available to the process. This is used to determine how many tasks can be run in parallel.
*/
numberOfCores: number;
}
/**
* @public
*/
export declare class HeftConfiguration {
private _slashNormalizedBuildFolderPath;
private _projectConfigFolderPath;
private _tempFolderPath;
private _rigConfig;
private _rigPackageResolver;
private readonly _knownConfigurationFiles;
/**
* Project build folder path. This is the folder containing the project's package.json file.
*/
readonly buildFolderPath: string;
/**
* {@link HeftConfiguration.buildFolderPath} with all path separators converted to forward slashes.
*/
get slashNormalizedBuildFolderPath(): string;
/**
* The path to the project's "config" folder.
*/
get projectConfigFolderPath(): string;
/**
* The project's temporary folder.
*
* @remarks This folder exists at \<project root\>/temp. In general, this folder is used to store temporary
* output from tasks under task-specific subfolders, and is not intended to be directly written to.
* Instead, plugins should write to the directory provided by HeftTaskSession.taskTempFolderPath
*/
get tempFolderPath(): string;
/**
* The rig.json configuration for this project, if present.
*/
get rigConfig(): IRigConfig;
/**
* The rig package resolver, which can be used to rig-resolve a requested package.
*/
get rigPackageResolver(): IRigPackageResolver;
/**
* Terminal instance to facilitate logging.
*/
readonly globalTerminal: ITerminal;
/**
* Terminal provider for the provided terminal.
*/
readonly terminalProvider: ITerminalProvider;
/**
* The Heft tool's package.json
*/
get heftPackageJson(): IPackageJson;
/**
* The package.json of the project being built
*/
get projectPackageJson(): IPackageJson;
/**
* The number of CPU cores available to the process. This can be used to determine how many tasks can be run
* in parallel.
*/
readonly numberOfCores: number;
private constructor();
/**
* Performs the search for rig.json and initializes the `HeftConfiguration.rigConfig` object.
* @internal
*/
_checkForRigAsync(): Promise<void>;
/**
* Attempts to load a riggable project configuration file using blocking, synchronous I/O.
* @param options - The options for the configuration file loader from `@rushstack/heft-config-file`. If invoking this function multiple times for the same file, reuse the same object.
* @param terminal - The terminal to log messages during configuration file loading.
* @returns The configuration file, or undefined if it could not be loaded.
*/
tryLoadProjectConfigurationFile<TConfigFile>(options: IProjectConfigurationFileSpecification<TConfigFile>, terminal: ITerminal): TConfigFile | undefined;
/**
* Attempts to load a riggable project configuration file using asynchronous I/O.
* @param options - The options for the configuration file loader from `@rushstack/heft-config-file`. If invoking this function multiple times for the same file, reuse the same object.
* @param terminal - The terminal to log messages during configuration file loading.
* @returns A promise that resolves to the configuration file, or undefined if it could not be loaded.
*/
tryLoadProjectConfigurationFileAsync<TConfigFile>(options: IProjectConfigurationFileSpecification<TConfigFile>, terminal: ITerminal): Promise<TConfigFile | undefined>;
/**
* @internal
*/
static initialize(options: IHeftConfigurationInitializationOptions): HeftConfiguration;
private _getConfigFileLoader;
}
//# sourceMappingURL=HeftConfiguration.d.ts.map