/** * A library for writing scripts that interact with the {@link https://rushjs.io/ | Rush} tool. * @packageDocumentation */ /// import { AsyncParallelHook } from 'tapable'; import { AsyncSeriesBailHook } from 'tapable'; import { AsyncSeriesHook } from 'tapable'; import { AsyncSeriesWaterfallHook } from 'tapable'; import type * as child_process from 'node:child_process'; import type { CollatedWriter } from '@rushstack/stream-collator'; import type { CommandLineParameter } from '@rushstack/ts-command-line'; import { CommandLineParameterKind } from '@rushstack/ts-command-line'; import { createRushDiagnostic } from '@rushstack/rush-reporter'; import { CredentialCache } from '@rushstack/credential-cache'; import { HookMap } from 'tapable'; import { ICreateRushDiagnosticOptions } from '@rushstack/rush-reporter'; import { ICredentialCacheEntry } from '@rushstack/credential-cache'; import { ICredentialCacheOptions } from '@rushstack/credential-cache'; import { IFileDiffStatus } from '@rushstack/package-deps-hash'; import { IPackageJson } from '@rushstack/node-core-library'; import { IPrefixMatch } from '@rushstack/lookup-by-path'; import type { IProblemCollector } from '@rushstack/terminal'; import { IReporterChildContext } from '@rushstack/rush-reporter'; import { IReporterEventEnvelope } from '@rushstack/rush-reporter'; import { IReporterEventScope } from '@rushstack/rush-reporter'; import { IReporterEventSink } from '@rushstack/rush-reporter'; import { IRushDiagnostic } from '@rushstack/rush-reporter'; import { IScopedLogger } from '@rushstack/rush-reporter'; import { IScopedMessageOptions } from '@rushstack/rush-reporter'; import { IScopedReporter } from '@rushstack/rush-reporter'; import type { ITelemetryAggregate } from '@rushstack/rush-reporter'; import { ITerminal } from '@rushstack/terminal'; import type { ITerminalChunk } from '@rushstack/terminal'; import { ITerminalProvider } from '@rushstack/terminal'; import { JsonNull } from '@rushstack/node-core-library'; import { JsonObject } from '@rushstack/node-core-library'; import { LockFile } from '@rushstack/node-core-library'; import { LookupByPath } from '@rushstack/lookup-by-path'; import { PackageNameParser } from '@rushstack/node-core-library'; import { parseReporterExtensionEventName } from '@rushstack/rush-reporter'; import type { PerformanceEntry as PerformanceEntry_2 } from 'node:perf_hooks'; import { ReporterExtensionEventName } from '@rushstack/rush-reporter'; import { ReporterJsonValue } from '@rushstack/rush-reporter'; import { ReporterPrivacyClassification } from '@rushstack/rush-reporter'; import type { StdioSummarizer } from '@rushstack/terminal'; import { SyncHook } from 'tapable'; import { SyncWaterfallHook } from 'tapable'; import { Terminal } from '@rushstack/terminal'; import type { TerminalWritable } from '@rushstack/terminal'; /** * This represents the JSON file specified via the "approvedPackagesFile" option in rush.json. * @public */ export declare class ApprovedPackagesConfiguration { #private; items: ApprovedPackagesItem[]; constructor(jsonFilename: string); /** * Clears all the settings, returning to an empty state. */ clear(): void; getItemByName(packageName: string): ApprovedPackagesItem | undefined; addOrUpdatePackage(packageName: string, reviewCategory: string): boolean; /** * If the file exists, calls loadFromFile(). */ tryLoadFromFile(approvedPackagesPolicyEnabled: boolean): boolean; /** * Loads the configuration data from the filename that was passed to the constructor. */ loadFromFile(): void; /** * Loads the configuration data to the filename that was passed to the constructor. */ saveToFile(): void; } /** * An item returned by ApprovedPackagesConfiguration * @public */ export declare class ApprovedPackagesItem { /** * The NPM package name */ packageName: string; /** * The project categories that are allowed to use this package. */ allowedCategories: Set; /** * @internal */ constructor(packageName: string); } /** * This is a helper object for RushConfiguration. * It exposes the "approvedPackagesPolicy" feature from rush.json. * @public */ export declare class ApprovedPackagesPolicy { /** * Whether the feature is enabled. The feature is enabled if the "approvedPackagesPolicy" * field is assigned in rush.json. */ readonly enabled: boolean; /** * A list of NPM package scopes that will be excluded from review (e.g. `@types`) */ readonly ignoredNpmScopes: ReadonlySet; /** * A list of category names that are valid for usage as the RushConfigurationProject.reviewCategory field. * This array will never be undefined. */ readonly reviewCategories: ReadonlySet; /** * Packages approved for usage in a web browser. This is the stricter of the two types, so by default * all new packages are added to this file. * * @remarks * * This is part of an optional approval workflow, whose purpose is to review any new dependencies * that are introduced (e.g. maybe a legal review is required, or maybe we are trying to minimize bloat). * When Rush discovers a new dependency has been added to package.json, it will update the file. * The intent is that the file will be stored in Git and tracked by a branch policy that notifies * reviewers when a PR attempts to modify the file. * * Example filename: `C:\MyRepo\common\config\rush\browser-approved-packages.json` */ readonly browserApprovedPackages: ApprovedPackagesConfiguration; /** * Packages approved for usage everywhere *except* in a web browser. * * @remarks * * This is part of an optional approval workflow, whose purpose is to review any new dependencies * that are introduced (e.g. maybe a legal review is required, or maybe we are trying to minimize bloat). * The intent is that the file will be stored in Git and tracked by a branch policy that notifies * reviewers when a PR attempts to modify the file. * * Example filename: `C:\MyRepo\common\config\rush\browser-approved-packages.json` */ readonly nonbrowserApprovedPackages: ApprovedPackagesConfiguration; /** @internal */ constructor(rushConfiguration: RushConfiguration, rushConfigurationJson: IRushConfigurationJson); } /** * Use this class to load and save the "common/config/rush/build-cache.json" config file. * This file provides configuration options for cached project build output. * @beta */ export declare class BuildCacheConfiguration { /** * Indicates whether the build cache feature is enabled. * Typically it is enabled in the build-cache.json config file. */ readonly buildCacheEnabled: boolean; /** * Indicates whether or not writing to the cache is enabled. */ cacheWriteEnabled: boolean; /** * Method to calculate the cache entry id for a project, phase, and project state. */ readonly getCacheEntryId: GetCacheEntryIdFunction; /** * The provider for interacting with the local build cache. */ readonly localCacheProvider: FileSystemBuildCacheProvider; /** * The provider for interacting with the cloud build cache, if configured. */ readonly cloudCacheProvider: ICloudBuildCacheProvider | undefined; /** * An optional salt to inject during calculation of the cache key. This can be used to invalidate the cache for all projects when the salt changes. */ readonly cacheHashSalt: string | undefined; private constructor(); /** * Attempts to load the build-cache.json data from the standard file path `common/config/rush/build-cache.json`. * If the file has not been created yet, then undefined is returned. */ static tryLoadAsync(terminal: ITerminal, rushConfiguration: RushConfiguration, rushSession: RushSession): Promise; /** * Loads the build-cache.json data from the standard file path `common/config/rush/build-cache.json`. * If the file has not been created yet, or if the feature is not enabled, then an error is reported. */ static loadAndRequireEnabledAsync(terminal: ITerminal, rushConfiguration: RushConfiguration, rushSession: RushSession): Promise; /** * Gets the absolute path to the build-cache.json file in the specified rush workspace. */ static getBuildCacheConfigFilePath(rushConfiguration: RushConfiguration): string; } /** * Type of version bumps * @public * * @internalRemarks * This is a copy of the semver ReleaseType enum, but with the `none` value added and * the `premajor` and `prepatch` omitted. * See `LockStepVersionPolicy.#getReleaseType`. * * TODO: Consider supporting `premajor` and `prepatch` in the future. */ export declare enum BumpType { 'none' = 0, 'prerelease' = 1, 'patch' = 2, 'preminor' = 3, 'minor' = 4, 'major' = 5 } /** * Fingerprints native merged project/rig/inherited configuration using invocation-owned loader caches. * Throws a {@link PhasedCommandEngineProjectConfigurationError} if a project's configuration cannot be loaded. * @alpha */ export declare function captureProjectConfigurationFingerprintAsync(rushConfiguration: RushConfiguration, terminal: ITerminal): Promise; /** Captures graph definitions and process-bound inputs without constructing a graph or executing commands. @alpha */ export declare function captureWorkspaceInputFingerprintAsync(options: IWorkspaceInputFingerprintOptions): Promise; /** * A class that helps with programmatically interacting with Rush's change files. * @public */ export declare class ChangeManager { /** * Creates a change file that has a 'none' type. * @param rushConfiguration - The rush configuration we are working with * @param projectName - The name of the project for which to create a change file * @param emailAddress - The email address which should be associated with this change * @returns the path to the file that was created, or undefined if no file was written */ static createEmptyChangeFiles(rushConfiguration: RushConfiguration, projectName: string, emailAddress: string): string | undefined; } /** Compares stable content identities; timestamps alone never cause reloads. @alpha */ export declare function classifyWorkspaceInputChange(current: IWorkspaceInputFingerprint, next: IWorkspaceInputFingerprint): WorkspaceInputChangeTier; /** * @beta */ export declare type CloudBuildCacheProviderFactory = (buildCacheJson: IBuildCacheJson) => ICloudBuildCacheProvider | Promise; /** * Use this class to load and save the "common/config/rush/cobuild.json" config file. * This file provides configuration options for the Rush Cobuild feature. * @beta */ export declare class CobuildConfiguration { #private; /** * Indicates whether the cobuild feature is enabled. * Typically it is enabled in the cobuild.json config file. * * Note: The orchestrator (or local users) should always have to opt into running with cobuilds by * providing a cobuild context id. Even if cobuilds are "enabled" as a feature, they don't * actually turn on for that particular build unless the cobuild context id is provided as an * non-empty string. */ readonly cobuildFeatureEnabled: boolean; /** * Cobuild context id * * @remarks * The cobuild feature won't be enabled until the context id is provided as an non-empty string. */ readonly cobuildContextId: string | undefined; /** * This is a name of the participating cobuild runner. It can be specified by the environment variable * RUSH_COBUILD_RUNNER_ID. If it is not provided, a random id will be generated to identify the runner. */ readonly cobuildRunnerId: string; /** * If true, Rush will automatically handle the leaf project with build cache "disabled" by writing * to the cache in a special "log files only mode". This is useful when you want to use Cobuilds * to improve the performance in CI validations and the leaf projects have not enabled cache. */ readonly cobuildLeafProjectLogOnlyAllowed: boolean; /** * If true, operations can opt into leveraging cobuilds without restoring from the build cache. * Operations will need to us the allowCobuildWithoutCache flag to opt into this behavior per phase. */ readonly cobuildWithoutCacheAllowed: boolean; private constructor(); /** * Attempts to load the cobuild.json data from the standard file path `common/config/rush/cobuild.json`. * If the file has not been created yet, then undefined is returned. */ static tryLoadAsync(terminal: ITerminal, rushConfiguration: RushConfiguration, rushSession: RushSession): Promise; static getCobuildConfigFilePath(rushConfiguration: RushConfiguration): string; createLockProviderAsync(terminal: ITerminal): Promise; destroyLockProviderAsync(): Promise; getCobuildLockProvider(): ICobuildLockProvider; } /** * @beta */ export declare type CobuildLockProviderFactory = (cobuildJson: ICobuildJson) => ICobuildLockProvider | Promise; /** * Use this class to load and save the "common/config/rush/common-versions.json" config file. * This config file stores dependency version information that affects all projects in the repo. * @public */ export declare class CommonVersionsConfiguration { #private; /** * Get the absolute file path of the common-versions.json file. */ readonly filePath: string; /** * When set to true, for all projects in the repo, all dependencies will be automatically added as preferredVersions, * except in cases where different projects specify different version ranges for a given dependency. For older * package managers, this tended to reduce duplication of indirect dependencies. However, it can sometimes cause * trouble for indirect dependencies with incompatible peerDependencies ranges. * * If the value is `undefined`, then the default value is `true`. */ readonly implicitlyPreferredVersions: boolean | undefined; /** * If true, then consistent version specifiers for dependencies will be enforced. * I.e. "rush check" is run before some commands. */ readonly ensureConsistentVersions: boolean; /** * A table that specifies a "preferred version" for a given NPM package. This feature is typically used * to hold back an indirect dependency to a specific older version, or to reduce duplication of indirect dependencies. * * @remarks * The "preferredVersions" value can be any SemVer range specifier (e.g. `~1.2.3`). Rush injects these values into * the "dependencies" field of the top-level common/temp/package.json, which influences how the package manager * will calculate versions. The specific effect depends on your package manager. Generally it will have no * effect on an incompatible or already constrained SemVer range. If you are using PNPM, similar effects can be * achieved using the pnpmfile.js hook. See the Rush documentation for more details. * * After modifying this field, it's recommended to run `rush update --full` so that the package manager * will recalculate all version selections. */ readonly preferredVersions: Map; /** * A table that stores, for a given dependency, a list of SemVer ranges that will be accepted * by "rush check" in addition to the normal version range. * * @remarks * The "rush check" command can be used to enforce that every project in the repo * must specify the same SemVer range for a given dependency. However, sometimes * exceptions are needed. The allowedAlternativeVersions table allows you to list * other SemVer ranges that will be accepted by "rush check" for a given dependency. * Note that the normal version range (as inferred by looking at all projects in the repo) * should NOT be included in this list. */ readonly allowedAlternativeVersions: Map>; private constructor(); /** * @deprecated Use {@link CommonVersionsConfiguration.loadFromFileAsync} method instead. */ static loadFromFile(jsonFilePath: string, rushConfiguration?: RushConfiguration): CommonVersionsConfiguration; /** * Loads the common-versions.json data from the specified file path. * If the file has not been created yet, then an empty object is returned. */ static loadFromFileAsync(jsonFilePath: string, rushConfiguration?: RushConfiguration): Promise; /** * Get a sha1 hash of the preferred versions. */ getPreferredVersionsHash(): string; /** * @deprecated Use {@link CommonVersionsConfiguration.saveAsync} method instead. */ save(): boolean; /** * Writes the "common-versions.json" file to disk, using the filename that was passed to loadFromFile(). */ saveAsync(): Promise; /** * Returns preferredVersions. */ getAllPreferredVersions(): Map; } export { createRushDiagnostic } export { CredentialCache } /** * An identifier representing a Rush message that can be customized by * defining a custom tip in `common/config/rush/custom-tips.json`. * @remarks * Custom tip ids always start with the `TIP_` prefix. * * @privateRemarks * Events from the Rush process should with "TIP_RUSH_". * Events from a PNPM subprocess should start with "TIP_PNPM_". * * @beta */ export declare enum CustomTipId { TIP_RUSH_INCONSISTENT_VERSIONS = "TIP_RUSH_INCONSISTENT_VERSIONS", TIP_RUSH_DISALLOW_INSECURE_SHA1 = "TIP_RUSH_DISALLOW_INSECURE_SHA1", TIP_PNPM_UNEXPECTED_STORE = "TIP_PNPM_UNEXPECTED_STORE", TIP_PNPM_NO_MATCHING_VERSION = "TIP_PNPM_NO_MATCHING_VERSION", TIP_PNPM_NO_MATCHING_VERSION_INSIDE_WORKSPACE = "TIP_PNPM_NO_MATCHING_VERSION_INSIDE_WORKSPACE", TIP_PNPM_PEER_DEP_ISSUES = "TIP_PNPM_PEER_DEP_ISSUES", TIP_PNPM_OUTDATED_LOCKFILE = "TIP_PNPM_OUTDATED_LOCKFILE", TIP_PNPM_TARBALL_INTEGRITY = "TIP_PNPM_TARBALL_INTEGRITY", TIP_PNPM_MISMATCHED_RELEASE_CHANNEL = "TIP_PNPM_MISMATCHED_RELEASE_CHANNEL", TIP_PNPM_INVALID_NODE_VERSION = "TIP_PNPM_INVALID_NODE_VERSION" } /** * Used to access the `common/config/rush/custom-tips.json` config file, * which allows repo maintainers to configure extra details to be printed alongside * certain Rush messages. * @beta */ export declare class CustomTipsConfiguration { #private; readonly providedCustomTipsByTipId: ReadonlyMap; /** * A registry mapping custom tip IDs to their corresponding metadata. * * @remarks * This registry is used to look up metadata for custom tips based on their IDs. The metadata includes * information such as the severity level, the type of tip, and an optional matching function. * * Each key in the registry corresponds to a `CustomTipIdEnum` value, and each value is an object * implementing the `ICustomTipInfo` interface. * * @example * ```typescript * const tipInfo = CustomTipsConfiguration.customTipRegistry[CustomTipIdEnum.TIP_RUSH_INCONSISTENT_VERSIONS]; * console.log(tipInfo.severity); // Output: CustomTipSeverity.Error * ``` * * See {@link CustomTipId} for the list of custom tip IDs. * See {@link ICustomTipInfo} for the structure of the metadata. */ static customTipRegistry: Readonly>; constructor(configFilePath: string); /** * If custom-tips.json defines a tip for the specified tipId, display the tip on the terminal. * * @remarks * The severity of the tip is defined in ${@link CustomTipsConfiguration.customTipRegistry}. * If you want to change the severity specifically for this call, * use other APIs such as {@link CustomTipsConfiguration._showErrorTip}. * * Custom tips by design do not replace Rush's standard messaging; instead, they annotate Rush's * output with additional team-specific advice. * * @internal */ _showTip(terminal: ITerminal, tipId: CustomTipId): void; /** * If custom-tips.json defines a tip for the specified tipId, display the tip on the terminal. * @remarks * Custom tips by design do not replace Rush's standard messaging; instead, they annotate Rush's * output with additional team-specific advice. * @internal */ _showInfoTip(terminal: ITerminal, tipId: CustomTipId): void; /** * If custom-tips.json defines a tip for the specified tipId, display the tip on the terminal. * @remarks * Custom tips by design do not replace Rush's standard messaging; instead, they annotate Rush's * output with additional team-specific advice. * @internal */ _showWarningTip(terminal: ITerminal, tipId: CustomTipId): void; /** * If custom-tips.json defines a tip for the specified tipId, display the tip on the terminal. * @remarks * Custom tips by design do not replace Rush's standard messaging; instead, they annotate Rush's * output with additional team-specific advice. * @internal */ _showErrorTip(terminal: ITerminal, tipId: CustomTipId): void; } /** * The severity of a custom tip. * It determines the printing severity ("Error" = red, "Warning" = yellow, "Info" = normal). * * @beta */ export declare enum CustomTipSeverity { Warning = "Warning", Error = "Error", Info = "Info" } /** * The type of the custom tip. * * @remarks * There might be types like `git` in the future. * * @beta */ export declare enum CustomTipType { rush = "rush", pnpm = "pnpm" } /** The exact recognized environment names. Unknown RUSH_DAEMON* names are rejected. @beta */ export declare const daemonEnvironmentVariables: Readonly>; /** * Writes build cache entries in the background, for the `deferCacheWrites` setting of the Rush daemon. * * @remarks * When an operation completes, its output files are cloned into a staging folder. On a file system that can clone * files, this usually takes well under a second, even for thousands of files, because the clones share the data of * the files until either changes. The build cache entry is then written from the clones while the build goes on, so * that later changes to the output files can't change the entry. If the clones take longer, for example while the * file system writes back what the build just wrote, the operation stops waiting for them after half a second. The * rest are cloned in the background, and the entry is dropped if a file changed before it was cloned. There is one * instance for each process, so that the writes outlive the engine of the build that queued them. */ declare class DeferredCacheEntryWrites { #private; constructor(options?: IDeferredCacheEntryWritesOptions); /** * The instance for this process. */ static get instance(): DeferredCacheEntryWrites; /** * Sets the function that gets a line for each entry that is written, fails or is dropped. */ setLog(log: ((message: string) => void) | undefined): void; /** * Clones the files into a new staging folder, keeping their modes and modification times. If that takes longer * than half a second, the rest of the files are cloned in the background. * * @returns The staging folder, or `undefined` if the files could not be cloned. The build cache entry must then * be written from the files themselves. */ trySealAsync(options: ISealOutputsOptions): Promise; /** * Queues a write. It starts when its outputs are sealed and fewer than two writes are running. */ enqueue(write: IDeferredCacheEntryWrite): void; /** * Whether a write of the build cache entry with the given ID is being sealed, is queued or is running. Such a * write replaces the entry when it ends. */ hasPendingWrite(cacheId: string): boolean; /** * Returns the counts since the previous report, and the number of pending writes. */ takeReport(): IDeferredCacheEntryWritesReport; /** * Resolves when no writes are being sealed, queued or running. */ waitForIdleAsync(): Promise; /** * Drops the queued writes, stops the seals in the background, kills the tar processes of the running writes and * waits for them all, then deletes the staging folders of this process. Their entries are not written. Writes * that are queued later run as usual. */ abortAsync(): Promise; } /** * @public */ export declare enum DependencyType { Regular = "dependencies", Dev = "devDependencies", Optional = "optionalDependencies", Peer = "peerDependencies", YarnResolutions = "resolutions" } /** * Provides Rush-specific environment variable data. All Rush environment variables must start with "RUSH_". This class * is designed to be used by RushConfiguration. * @beta * * @remarks * Initialize will throw if any unknown parameters are present. */ export declare class EnvironmentConfiguration { /** * If true, the environment configuration has been validated and initialized. */ static get hasBeenValidated(): boolean; /** * An override for the common/temp folder path. */ static get rushTempFolderOverride(): string | undefined; /** * If "1", create symlinks with absolute paths instead of relative paths. * See {@link EnvironmentVariableNames.RUSH_ABSOLUTE_SYMLINKS} */ static get absoluteSymlinks(): boolean; /** * If this environment variable is set to "1", the Node.js version check will print a warning * instead of causing a hard error if the environment's Node.js version doesn't match the * version specifier in `rush.json`'s "nodeSupportedVersionRange" property. * * See {@link EnvironmentVariableNames.RUSH_ALLOW_UNSUPPORTED_NODEJS}. */ static get allowUnsupportedNodeVersion(): boolean; /** * Setting this environment variable overrides the value of `allowWarningsInSuccessfulBuild` * in the `command-line.json` configuration file. Specify `1` to allow warnings in a successful build, * or `0` to disallow them. (See the comments in the command-line.json file for more information). */ static get allowWarningsInSuccessfulBuild(): boolean; /** * An override for the PNPM store path, if `pnpmStore` configuration is set to 'path' * See {@link EnvironmentVariableNames.RUSH_PNPM_STORE_PATH} */ static get pnpmStorePathOverride(): string | undefined; /** * If specified, enables or disables integrity verification of the pnpm store during install. * See {@link EnvironmentVariableNames.RUSH_PNPM_VERIFY_STORE_INTEGRITY} */ static get pnpmVerifyStoreIntegrity(): boolean | undefined; /** * Overrides the location of the `~/.rush` global folder where Rush stores temporary files. * See {@link EnvironmentVariableNames.RUSH_GLOBAL_FOLDER} */ static get rushGlobalFolderOverride(): string | undefined; /** * Provides a credential for reading from and writing to a remote build cache, if configured. * See {@link EnvironmentVariableNames.RUSH_BUILD_CACHE_CREDENTIAL} */ static get buildCacheCredential(): string | undefined; /** * If set, enables or disables the cloud build cache feature. * See {@link EnvironmentVariableNames.RUSH_BUILD_CACHE_ENABLED} */ static get buildCacheEnabled(): boolean | undefined; /** * If set, enables or disables writing to the cloud build cache. * See {@link EnvironmentVariableNames.RUSH_BUILD_CACHE_WRITE_ALLOWED} */ static get buildCacheWriteAllowed(): boolean | undefined; /** * If set, overrides the build cache configuration that normally lives at `common/config/rush/build-cache.json`. * See {@link EnvironmentVariableNames.RUSH_BUILD_CACHE_OVERRIDE_JSON} */ static get buildCacheOverrideJson(): string | undefined; /** * If set, overrides the build cache configuration that normally lives at `common/config/rush/build-cache.json`. * See {@link EnvironmentVariableNames.RUSH_BUILD_CACHE_OVERRIDE_JSON_FILE_PATH} */ static get buildCacheOverrideJsonFilePath(): string | undefined; /** * Provides a determined cobuild context id if configured * See {@link EnvironmentVariableNames.RUSH_COBUILD_CONTEXT_ID} */ static get cobuildContextId(): string | undefined; /** * Provides a determined cobuild runner id if configured * See {@link EnvironmentVariableNames.RUSH_COBUILD_RUNNER_ID} */ static get cobuildRunnerId(): string | undefined; /** * If set, enables or disables the cobuild leaf project log only feature. * See {@link EnvironmentVariableNames.RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED} */ static get cobuildLeafProjectLogOnlyAllowed(): boolean | undefined; /** * Allows the git binary path to be explicitly provided. * See {@link EnvironmentVariableNames.RUSH_GIT_BINARY_PATH} */ static get gitBinaryPath(): string | undefined; /** * Allows the tar binary path to be explicitly provided. * See {@link EnvironmentVariableNames.RUSH_TAR_BINARY_PATH} */ static get tarBinaryPath(): string | undefined; /** * If `true`, Rush will suppress informational startup messages, equivalent to passing `--quiet`. * See {@link EnvironmentVariableNames.RUSH_QUIET_MODE} */ static get quietMode(): boolean; /** * The front-end RushVersionSelector relies on `RUSH_GLOBAL_FOLDER`, so its value must be read before * `EnvironmentConfiguration` is initialized (and actually before the correct version of `EnvironmentConfiguration` * is even installed). Thus we need to read this environment variable differently from all the others. * @internal */ static _getRushGlobalFolderOverride(processEnv: IEnvironment): string | undefined; /** * Reads and normalizes `RUSH_TEMP_FOLDER` without initializing the global environment state. * * @internal */ static _getRushTempFolderOverride(processEnv: IEnvironment): string | undefined; /** * Reads and validates environment variables. If any are invalid, this function will throw. */ static validate(options?: IEnvironmentConfigurationInitializeOptions): void; /** * Resets EnvironmentConfiguration into an un-initialized state. */ static reset(): void; static parseBooleanEnvironmentVariable(name: string, value: string | undefined): boolean | undefined; } /** * Names of environment variables used by Rush. * @beta */ export declare const EnvironmentVariableNames: { /** * This variable overrides the temporary folder used by Rush. * The default value is "common/temp" under the repository root. * * @remarks This environment variable is not compatible with workspace installs. If attempting * to move the PNPM store path, see the `RUSH_PNPM_STORE_PATH` environment variable. */ readonly RUSH_TEMP_FOLDER: "RUSH_TEMP_FOLDER"; /** * This variable overrides the version of Rush that will be installed by * the version selector. The default value is determined by the "rushVersion" * field from rush.json. */ readonly RUSH_PREVIEW_VERSION: "RUSH_PREVIEW_VERSION"; /** * Frontend-owned reporter selection, including the legacy emergency override. * Engines recognize this variable without consuming its value. */ readonly RUSH_REPORTER: "RUSH_REPORTER"; /** * Frontend-owned reporter verbosity. Engines recognize this variable without consuming its value. */ readonly RUSH_LOG_LEVEL: "RUSH_LOG_LEVEL"; /** * If this variable is set to "1", Rush will not fail the build when running a version * of Node that does not match the criteria specified in the "nodeSupportedVersionRange" * field from rush.json. */ readonly RUSH_ALLOW_UNSUPPORTED_NODEJS: "RUSH_ALLOW_UNSUPPORTED_NODEJS"; /** * Setting this environment variable overrides the value of `allowWarningsInSuccessfulBuild` * in the `command-line.json` configuration file. Specify `1` to allow warnings in a successful build, * or `0` to disallow them. (See the comments in the command-line.json file for more information). */ readonly RUSH_ALLOW_WARNINGS_IN_SUCCESSFUL_BUILD: "RUSH_ALLOW_WARNINGS_IN_SUCCESSFUL_BUILD"; /** * This variable selects a specific installation variant for Rush to use when installing * and linking package dependencies. * For more information, see the command-line help for the `--variant` parameter * and this article: https://rushjs.io/pages/advanced/installation_variants/ */ readonly RUSH_VARIANT: "RUSH_VARIANT"; /** * Specifies the maximum number of concurrent processes to launch during a build. * For more information, see the command-line help for the `--parallelism` parameter for "rush build". */ readonly RUSH_PARALLELISM: "RUSH_PARALLELISM"; /** * If this variable is set to "1", Rush will create symlinks with absolute paths instead * of relative paths. This can be necessary when a repository is moved during a build or * if parts of a repository are moved into a sandbox. */ readonly RUSH_ABSOLUTE_SYMLINKS: "RUSH_ABSOLUTE_SYMLINKS"; /** * When using PNPM as the package manager, this variable can be used to configure the path that * PNPM will use as the store directory. * * If a relative path is used, then the store path will be resolved relative to the process's * current working directory. An absolute path is recommended. */ readonly RUSH_PNPM_STORE_PATH: "RUSH_PNPM_STORE_PATH"; /** * When using PNPM as the package manager, this variable can be used to control whether or not PNPM * validates the integrity of the PNPM store during installation. The value of this environment variable must be * `1` (for true) or `0` (for false). If not specified, defaults to the value in .npmrc. */ readonly RUSH_PNPM_VERIFY_STORE_INTEGRITY: "RUSH_PNPM_VERIFY_STORE_INTEGRITY"; /** * This environment variable can be used to specify the `--target-folder` parameter * for the "rush deploy" command. */ readonly RUSH_DEPLOY_TARGET_FOLDER: "RUSH_DEPLOY_TARGET_FOLDER"; /** * Overrides the location of the `~/.rush` global folder where Rush stores temporary files. * * @remarks * * Most of the temporary files created by Rush are stored separately for each monorepo working folder, * to avoid issues of concurrency and compatibility between tool versions. However, a small set * of files (e.g. installations of the `@microsoft/rush-lib` engine and the package manager) are stored * in a global folder to speed up installations. The default location is `~/.rush` on POSIX-like * operating systems or `C:\Users\YourName` on Windows. * * Use `RUSH_GLOBAL_FOLDER` to specify a different folder path. This is useful for example if a Windows * group policy forbids executing scripts installed in a user's home directory. * * POSIX is a registered trademark of the Institute of Electrical and Electronic Engineers, Inc. */ readonly RUSH_GLOBAL_FOLDER: "RUSH_GLOBAL_FOLDER"; /** * Provides a credential for a remote build cache, if configured. This credential overrides any cached credentials. * * @remarks * Setting this environment variable overrides whatever credential has been saved in the * local cloud cache credentials using `rush update-cloud-credentials`. * * * If Azure Blob Storage is used to store cache entries, this must be a SAS token serialized as query * parameters. * * For information on SAS tokens, see here: https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview */ readonly RUSH_BUILD_CACHE_CREDENTIAL: "RUSH_BUILD_CACHE_CREDENTIAL"; /** * Setting this environment variable overrides the value of `buildCacheEnabled` in the `build-cache.json` * configuration file. * * @remarks * Specify `1` to enable the build cache or `0` to disable it. * * If there is no build cache configured, then this environment variable is ignored. */ readonly RUSH_BUILD_CACHE_ENABLED: "RUSH_BUILD_CACHE_ENABLED"; /** * Overrides the value of `isCacheWriteAllowed` in the `build-cache.json` configuration file. The value of this * environment variable must be `1` (for true) or `0` (for false). If there is no build cache configured, then * this environment variable is ignored. */ readonly RUSH_BUILD_CACHE_WRITE_ALLOWED: "RUSH_BUILD_CACHE_WRITE_ALLOWED"; /** * Set this environment variable to a JSON string to override the build cache configuration that normally lives * at `common/config/rush/build-cache.json`. * * This is useful for testing purposes, or for OSS repos that are have a local-only cache, but can have * a different cache configuration in CI/CD pipelines. * * @remarks * This is similar to {@link EnvironmentVariableNames.RUSH_BUILD_CACHE_OVERRIDE_JSON_FILE_PATH}, but it allows you to specify * a JSON string instead of a file path. The two environment variables are mutually exclusive, meaning you can * only use one of them at a time. */ readonly RUSH_BUILD_CACHE_OVERRIDE_JSON: "RUSH_BUILD_CACHE_OVERRIDE_JSON"; /** * Set this environment variable to the path to a `build-cache.json` file to override the build cache configuration * that normally lives at `common/config/rush/build-cache.json`. * * This is useful for testing purposes, or for OSS repos that are have a local-only cache, but can have * a different cache configuration in CI/CD pipelines. * * @remarks * This is similar to {@link EnvironmentVariableNames.RUSH_BUILD_CACHE_OVERRIDE_JSON}, but it allows you to specify * a file path instead of a JSON string. The two environment variables are mutually exclusive, meaning you can * only use one of them at a time. */ readonly RUSH_BUILD_CACHE_OVERRIDE_JSON_FILE_PATH: "RUSH_BUILD_CACHE_OVERRIDE_JSON_FILE_PATH"; /** * Setting this environment variable opts into running with cobuilds. The context id should be the same across * multiple VMs, but changed when it is a new round of cobuilds. * * e.g. `Build.BuildNumber` in Azure DevOps Pipeline. * * @remarks * If there is no cobuild configured, then this environment variable is ignored. */ readonly RUSH_COBUILD_CONTEXT_ID: "RUSH_COBUILD_CONTEXT_ID"; /** * Explicitly specifies a name for each participating cobuild runner. * * Setting this environment variable opts into running with cobuilds. * * @remarks * This environment variable is optional, if it is not provided, a random id is used. * * If there is no cobuild configured, then this environment variable is ignored. */ readonly RUSH_COBUILD_RUNNER_ID: "RUSH_COBUILD_RUNNER_ID"; /** * If this variable is set to "1", When getting distributed builds, Rush will automatically handle the leaf project * with build cache "disabled" by writing to the cache in a special "log files only mode". This is useful when you * want to use Cobuilds to improve the performance in CI validations and the leaf projects have not enabled cache. */ readonly RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED: "RUSH_COBUILD_LEAF_PROJECT_LOG_ONLY_ALLOWED"; /** * Explicitly specifies the path for the Git binary that is invoked by certain Rush operations. */ readonly RUSH_GIT_BINARY_PATH: "RUSH_GIT_BINARY_PATH"; /** * Explicitly specifies the path for the `tar` binary that is invoked by certain Rush operations. */ readonly RUSH_TAR_BINARY_PATH: "RUSH_TAR_BINARY_PATH"; /** * Internal variable used by `rushx` when recursively invoking another `rushx` process, to avoid * nesting event hooks. */ readonly _RUSH_RECURSIVE_RUSHX_CALL: "_RUSH_RECURSIVE_RUSHX_CALL"; /** * Internal variable that explicitly specifies the path for the version of `@microsoft/rush-lib` being executed. * Will be set upon loading Rush. */ readonly _RUSH_LIB_PATH: "_RUSH_LIB_PATH"; /** * Internal variable that `rush-client` sets when it runs Rush in-process after it tried the Rush daemon: the time, * in milliseconds since the Unix epoch, until which the command waits for another Rush process to release the * repository's lock, instead of failing at once. Rush reads and removes it when it starts. */ readonly _RUSH_LOCK_WAIT_DEADLINE: "_RUSH_LOCK_WAIT_DEADLINE"; /** * Internal variable that `rush-client` sets with `_RUSH_LOCK_WAIT_DEADLINE`: the process ID of the Rush daemon * that handed the command back, so that Rush can name the daemon when it holds the repository's lock. * Rush reads and removes it when it starts. */ readonly _RUSH_LOCK_WAIT_DAEMON_PID: "_RUSH_LOCK_WAIT_DAEMON_PID"; /** * When Rush executes shell scripts, it sometimes changes the working directory to be a project folder or * the repository root folder. The original working directory (where the Rush command was invoked) is assigned * to the the child process's `RUSH_INVOKED_FOLDER` environment variable, in case it is needed by the script. * * @remarks * The `RUSH_INVOKED_FOLDER` variable is the same idea as the `INIT_CWD` variable that package managers * assign when they execute lifecycle scripts. */ readonly RUSH_INVOKED_FOLDER: "RUSH_INVOKED_FOLDER"; /** * When running a hook script, this environment variable communicates the original arguments * passed to the `rush` or `rushx` command. * * @remarks * Unlike `RUSH_INVOKED_FOLDER`, the `RUSH_INVOKED_ARGS` variable is only available for hook scripts. * Other lifecycle scripts should not make assumptions about Rush's command line syntax * if Rush did not explicitly pass along command-line parameters to their process. */ readonly RUSH_INVOKED_ARGS: "RUSH_INVOKED_ARGS"; /** * When set to `1` or `true`, this environment variable is equivalent to passing the `--quiet` flag * to `rush`, `rushx`, and `install-run-rush.ts`. It suppresses informational startup messages * while preserving error output. */ readonly RUSH_QUIET_MODE: "RUSH_QUIET_MODE"; /** Enables the opt-in standalone daemon client. */ readonly RUSH_DAEMON: "RUSH_DAEMON"; /** Overrides the daemon idle shutdown timeout. */ readonly RUSH_DAEMON_IDLE_TIMEOUT_SECONDS: "RUSH_DAEMON_IDLE_TIMEOUT_SECONDS"; /** Allows the opted-in client to start an absent daemon. */ readonly RUSH_DAEMON_AUTO_START: "RUSH_DAEMON_AUTO_START"; /** Controls persistent daemon observation of warm project files, without scheduling builds. */ readonly RUSH_DAEMON_WATCH: "RUSH_DAEMON_WATCH"; /** Enables explicitly configured persistent Node IPC operations in the daemon. */ readonly RUSH_DAEMON_USE_PERSISTENT_IPC_RUNNERS: "RUSH_DAEMON_USE_PERSISTENT_IPC_RUNNERS"; /** Lets daemon builds run an operation's guarded `:incremental` script outside watch mode. */ readonly RUSH_DAEMON_INCREMENTAL_BUILDS: "RUSH_DAEMON_INCREMENTAL_BUILDS"; /** Keeps `:incremental:ipc` watch-mode workers alive between daemon builds. */ readonly RUSH_DAEMON_WARM_WORKERS: "RUSH_DAEMON_WARM_WORKERS"; /** Lets a daemon build request add its operations to the executing iteration of a compatible batch. */ readonly RUSH_DAEMON_JOIN_RUNNING_BATCH: "RUSH_DAEMON_JOIN_RUNNING_BATCH"; /** Lets daemon operations complete before their build cache entries are written. */ readonly RUSH_DAEMON_DEFER_CACHE_WRITES: "RUSH_DAEMON_DEFER_CACHE_WRITES"; /** Lets an idle daemon load the next workspace graph and create its engine before the next request. */ readonly RUSH_DAEMON_BACKGROUND_PREPARE: "RUSH_DAEMON_BACKGROUND_PREPARE"; /** Overrides the request admission queue timeout. */ readonly RUSH_DAEMON_QUEUE_TIMEOUT_SECONDS: "RUSH_DAEMON_QUEUE_TIMEOUT_SECONDS"; /** Overrides idle eviction in an attached daemon warm set. */ readonly RUSH_DAEMON_WARM_IDLE_TIMEOUT_SECONDS: "RUSH_DAEMON_WARM_IDLE_TIMEOUT_SECONDS"; /** Overrides the attached warm set's best-effort sampled RSS budget. */ readonly RUSH_DAEMON_WARM_MEMORY_BUDGET_MB: "RUSH_DAEMON_WARM_MEMORY_BUDGET_MB"; /** Overrides the attached warm set's retained project limit. */ readonly RUSH_DAEMON_WARM_SET_MAX_PROJECTS: "RUSH_DAEMON_WARM_SET_MAX_PROJECTS"; /** Enables telemetry-weighted retention of requested work in an attached warm set. */ readonly RUSH_DAEMON_AUTO_WARM_BY_TELEMETRY: "RUSH_DAEMON_AUTO_WARM_BY_TELEMETRY"; /** Overrides the plugins that the repository has verified for long-lived daemon engines. */ readonly RUSH_DAEMON_COMPATIBLE_PLUGINS: "RUSH_DAEMON_COMPATIBLE_PLUGINS"; /** Overrides the plugins that the repository has verified to tap `runAnyPhasedCommand` the same way for every command. */ readonly RUSH_DAEMON_COMMAND_AGNOSTIC_PLUGINS: "RUSH_DAEMON_COMMAND_AGNOSTIC_PLUGINS"; /** Gates the experimental graph client; requires host graph integration. */ readonly RUSH_DAEMON_EXPERIMENTAL: "RUSH_DAEMON_EXPERIMENTAL"; }; /** * Events happen during Rush invocation. * @beta */ declare enum Event_2 { /** * Pre Rush install event */ preRushInstall = 1, /** * Post Rush install event */ postRushInstall = 2, /** * Pre Rush build event */ preRushBuild = 3, /** * Post Rush build event */ postRushBuild = 4, /** * Start of rushx execution event */ preRushx = 5, /** * End of rushx execution event */ postRushx = 6 } export { Event_2 as Event } /** * This class represents Rush event hooks configured for this repo. * Hooks are customized script actions that Rush executes when specific events occur. * The actions are expressed as a command-line that is executed using the operating system shell. * @beta */ export declare class EventHooks { #private; /** * @internal */ constructor(eventHooksJson: IEventHooksJson); /** * Return all the scripts associated with the specified event. * @param event - Rush event */ get(event: Event_2): string[]; } /** * Use this class to load the "common/config/rush/experiments.json" config file. * This file allows repo maintainers to enable and disable experimental Rush features. * @public */ export declare class ExperimentsConfiguration { /** * Get the experiments configuration. * @beta */ readonly configuration: Readonly; /** * @internal */ constructor(jsonFilePath: string); } /** * A build cache provider using the local file system. * Required by all cloud cache providers. * @beta */ export declare class FileSystemBuildCacheProvider { /** * Returns the absolute disk path for the specified cache id. */ readonly getCacheEntryPath: (cacheId: string) => string; constructor(options: IFileSystemBuildCacheProviderOptions); /** * Validates that the specified cache id exists on disk, and returns the path if it does. */ tryGetCacheEntryPathByIdAsync(terminal: ITerminal, cacheId: string): Promise; /** * Writes the specified buffer to the corresponding file system path for the cache id. */ trySetCacheEntryBufferAsync(terminal: ITerminal, cacheId: string, entryBuffer: Buffer): Promise; } /** * A base class for flag file. * @internal */ export declare class _FlagFile { /** * Flag file path */ readonly path: string; /** * Content of the flag */ protected _state: TState; /** * Creates a new flag file * @param folderPath - the folder that this flag is managing * @param state - optional, the state that should be managed or compared */ constructor(folderPath: string, flagName: string, initialState: TState); /** * Returns true if the file exists and the contents match the current state. */ isValidAsync(): Promise; /** * Writes the flag file to disk with the current state */ createAsync(): Promise; /** * Removes the flag file */ clearAsync(): Promise; } /** * Renders the lines that announce an iteration: the `Selected N operations:` listing, unless `quietMode` * is set, followed by the `Executing a maximum of N simultaneous processes...` line. * * @param operationNames - The names of the operations to announce, which should not be silent, in any order. * @param parallelism - The graph's parallelism. * @param quietMode - Whether the graph is in quiet mode. * @returns The plain text of each line, in order. * * @internal */ export declare function _formatIterationStartLines(operationNames: Iterable, parallelism: number, quietMode: boolean): string[]; /** * Calculates the cache entry id string for an operation. * @beta */ export declare type GetCacheEntryIdFunction = (options: IGenerateCacheEntryIdOptions) => string; /** * Function that computes a new snapshot of the current state of the repository as of the current moment. * Rush-level configuration state will have been bound during creation of the function. * Captures the state of the environment, tracked files, and additional files. * * @beta */ export declare type GetInputsSnapshotAsyncFn = () => Promise; /** * Returns the defined environment entries that participate in workspace fingerprints, sorted by name. * * @remarks * Omits undefined values and {@link workspaceFingerprintIgnoredEnvironmentVariables}, and removes repeated * `PATH` entries. Hosts that compare environments outside {@link captureWorkspaceInputFingerprintAsync} must use * this function so that every comparison applies the same normalization. * * @alpha */ export declare function getWorkspaceFingerprintEnvironmentEntries(environment: Readonly>): [string, string][]; /** * Returns a copy of a host startup environment without {@link workspaceRequestScopedEnvironmentVariables}. * * @alpha */ export declare function getWorkspaceHostEnvironment(environment: Readonly>): Record; /** * Returns the environment that an operation starts from when a long-lived host runs it for a request. * * @remarks * Every variable in {@link workspaceFingerprintIgnoredEnvironmentVariables} takes the request's value, and is * omitted when the request does not define it, so that the operation sees its own requester's session, terminal * and credential-helper variables. Every other variable comes from the host, whose environment matches the * request's for identity, and so does `RUSHD_OPERATION_GROUPS`, which marks the processes that the host starts * and is omitted when the host does not define it. A host returns the result from * `IOperationGraphIterationOptions.getOperationEnvironment`. On Windows, names are matched case-insensitively. * * @alpha */ export declare function getWorkspaceRequestOperationEnvironment(hostEnvironment: Readonly>, requestEnvironment: Readonly>): Record; /** * Part of IRushConfigurationJson. */ declare interface IApprovedPackagesPolicyJson { reviewCategories?: string[]; ignoredNpmScopes?: string[]; } /** * Describes the file structure for the "common/config/rush/build-cache.json" config file. */ declare interface IBaseBuildCacheJson { buildCacheEnabled: boolean; cacheProvider: string; /** * Used to specify the cache entry ID format. If this property is set, it must * contain a `[hash]` token. It may also contain one of the following tokens: * - `[projectName]` * - `[projectName:normalize]` * - `[phaseName]` * - `[phaseName:normalize]` * - `[phaseName:trimPrefix]` * - `[os]` * - `[arch]` * @privateRemarks * NOTE: If you update this comment, make sure to update build-cache.json in the "rush init" template. * The token parser is in CacheEntryId.ts */ cacheEntryNamePattern?: string; /** * An optional salt to inject during calculation of the cache key. This can be used to invalidate the cache for all projects when the salt changes. */ cacheHashSalt?: string; } /** * @alpha */ export declare interface IBaseOperationExecutionResult { /** * The operation itself */ readonly operation: Operation; /** * The relative path to the folder that contains operation metadata. This folder will be automatically included in cache entries. */ readonly metadataFolderPath: string; /** * Gets the hash of the state of all registered inputs to this operation. * Calling this method will throw if Git is not available. */ getStateHash(): string; /** * Gets the structured components of the state hash. This is useful for debugging and * incremental change detection. * Calling this method will throw if Git is not available. */ getStateHashComponents(): IOperationStateHashComponents; } /** * @beta */ declare type IBuildCacheJson = ICloudBuildCacheJson | ILocalBuildCacheJson; /** * @internal */ export declare interface _IBuiltInPluginConfiguration extends _IRushPluginConfigurationBase { pluginPackageFolder: string; } /** * @beta */ declare interface ICloudBuildCacheJson extends IBaseBuildCacheJson { readonly cacheProvider: string; [otherConfigKey: string]: JsonObject; } /** * @beta */ export declare interface ICloudBuildCacheProvider { readonly isCacheWriteAllowed: boolean; tryGetCacheEntryBufferByIdAsync(terminal: ITerminal, cacheId: string): Promise; trySetCacheEntryBufferAsync(terminal: ITerminal, cacheId: string, entryBuffer: Buffer): Promise; /** * If implemented, the build cache will prefer to use this method over * {@link ICloudBuildCacheProvider.tryGetCacheEntryBufferByIdAsync} to avoid loading the entire * cache entry into memory, if possible. The implementation should download the cache entry and write it * to the specified local file path. * * @returns `true` if the cache entry was found and written to the file; otherwise `false`. * Implementations typically log transfer failures and return `false`, but may still throw for * unexpected errors. */ tryDownloadCacheEntryToFileAsync?(terminal: ITerminal, cacheId: string, localFilePath: string): Promise; /** * If implemented, the build cache will prefer to use this method over * {@link ICloudBuildCacheProvider.trySetCacheEntryBufferAsync} to avoid loading the entire * cache entry into memory, if possible. The implementation should read the cache entry from * the specified local file path and upload it. * * @returns `true` if the cache entry was written to the cache, otherwise `false`. */ tryUploadCacheEntryFromFileAsync?(terminal: ITerminal, cacheId: string, localFilePath: string): Promise; updateCachedCredentialAsync(terminal: ITerminal, credential: string): Promise; updateCachedCredentialInteractiveAsync(terminal: ITerminal): Promise; deleteCachedCredentialsAsync(terminal: ITerminal): Promise; } /** * @beta */ export declare interface ICobuildCompletedState { status: OperationStatus.Success | OperationStatus.SuccessWithWarning | OperationStatus.Failure; /** * Completed state points to the cache id that was used to store the build cache. * Note: Cache failed builds in a separate cache id */ cacheId: string; } /** * @beta */ export declare interface ICobuildContext { /** * The key for acquiring lock. */ lockKey: string; /** * The expire time of the lock in seconds. */ lockExpireTimeInSeconds: number; /** * The key for storing completed state. */ completedStateKey: string; /** * The contextId is provided by the monorepo maintainer, it reads from environment variable {@link EnvironmentVariableNames.RUSH_COBUILD_CONTEXT_ID}. * It ensure only the builds from the same given contextId cooperated. */ contextId: string; /** * The id of the cluster. The operations in the same cluster share the same clusterId and * will be executed on the same machine. */ clusterId: string; /** * The id of the runner. The identifier for the running machine. * * It can be specified via assigning `RUSH_COBUILD_RUNNER_ID` environment variable. */ runnerId: string; /** * The id of the cache entry. It should be kept the same as the normal cacheId from ProjectBuildCache. * Otherwise, there is a discrepancy in the success case wherein turning on cobuilds will * fail to populate the normal build cache. */ cacheId: string; /** * The name of NPM package * * Example: `@scope/MyProject` */ packageName: string; /** * The name of the phase. * * Example: _phase:build */ phaseName: string; } /** * @beta */ export declare interface ICobuildJson { cobuildFeatureEnabled: boolean; cobuildLockProvider: string; } /** * @beta */ export declare interface ICobuildLockProvider { /** * The callback function invoked to connect to the lock provider. * For example, initializing the connection to the redis server. */ connectAsync(): Promise; /** * The callback function invoked to disconnect the lock provider. */ disconnectAsync(): Promise; /** * The callback function to acquire a lock with a lock key and specific contexts. * * NOTE: This lock implementation must be a ReentrantLock. It says the lock might be acquired * multiple times, since tasks in the same cluster can be run in the same VM. */ acquireLockAsync(context: Readonly): Promise; /** * The callback function to renew a lock with a lock key and specific contexts. * * NOTE: If the lock key expired */ renewLockAsync(context: Readonly): Promise; /** * The callback function to set completed state. */ setCompletedStateAsync(context: Readonly, state: ICobuildCompletedState): Promise; /** * The callback function to get completed state. */ getCompletedStateAsync(context: Readonly): Promise; } /** * The `IConfigurableOperation` interface represents an {@link Operation} whose * execution can be configured before running. * @alpha */ export declare interface IConfigurableOperation extends IBaseOperationExecutionResult { /** * True if the operation should execute in this iteration, false otherwise. */ enabled: boolean; /** * True if the operation's runner should remain active after its execution, false otherwise. * When false, the runner is closed before dependent operations can execute, including when this * operation is skipped. Configure this through {@link OperationGraphHooks.configureIteration}. * Defaults to true on each iteration; the previous iteration's policy is not inherited. */ shouldRunnerPersist: boolean; } /** * A collection of environment variables * @public */ export declare interface IConfigurationEnvironment { /** * Environment variables */ [environmentVariableName: string]: IConfigurationEnvironmentVariable; } /** * Represents the value of an environment variable, and if the value should be overridden if the variable is set * in the parent environment. * @public */ export declare interface IConfigurationEnvironmentVariable { /** * Value of the environment variable */ value: string; /** * Set to true to override the environment variable even if it is set in the parent environment. * The default value is false. */ override?: boolean; } /** * Context used for creating operations to be executed. * @alpha */ export declare interface ICreateOperationsContext { /** * The configuration for the build cache, if the feature is enabled. */ readonly buildCacheConfiguration: BuildCacheConfiguration | undefined; /** * If true, for an incremental build, Rush will only include projects with immediate changes or projects with no consumers. * @remarks * This is an optimization that may produce invalid outputs if some of the intervening projects are impacted by the changes. */ readonly changedProjectsOnly: boolean; /** * The configuration for the cobuild, if cobuild feature and build cache feature are both enabled. */ readonly cobuildConfiguration: CobuildConfiguration | undefined; /** * The set of custom parameters for the executing command. * Maps from the `longName` field in command-line.json to the parser configuration in ts-command-line. */ readonly customParameters: ReadonlyMap; /** * If true, dependencies of the selected phases will be automatically enabled in the execution. */ readonly includePhaseDeps: boolean; /** * If true, projects may read their output from cache or be skipped if already up to date. * If false, neither of the above may occur, e.g. "rush rebuild" */ readonly isIncrementalBuildAllowed: boolean; /** * If true, the command is running in watch mode. */ readonly isWatch: boolean; /** * The currently configured maximum parallelism for the command. */ readonly parallelism: Parallelism; /** * The set of phases selected for execution. */ readonly phaseSelection: ReadonlySet; /** * All successfully loaded rush-project.json data for selected projects. */ readonly projectConfigurations: ReadonlyMap; /** * The set of Rush projects selected for execution. */ readonly projectSelection: ReadonlySet; /** * If true, the operation graph should include all projects in the repository (watch broad graph mode). * Only the projects in projectSelection should start enabled; others are present but disabled. */ readonly generateFullGraph?: boolean; /** * The Rush configuration */ readonly rushConfiguration: RushConfiguration; } export { ICreateRushDiagnosticOptions } export { ICredentialCacheEntry } export { ICredentialCacheOptions } /** * This represents the JSON data structure for the "current-variant.json" data file. */ declare interface ICurrentVariantJson { variant: string | JsonNull; } /** * Metadata for a custom tip. * * @remarks * This differs from the {@link ICustomTipItemJson} interface in that these are not configurable by the user; * it's the inherent state of a custom tip. For example, the custom tip for `ERR_PNPM_NO_MATCHING_VERSION` * has a inherent severity of `Error`, and a inherent match function that rush maintainer defines. * * @beta */ export declare interface ICustomTipInfo { tipId: CustomTipId; /** * The severity of the custom tip. It will determine the printing severity ("Error" = red, "Warning" = yellow, "Info" = normal). * * @remarks * The severity should be consistent with the original message, unless there are strong reasons not to. */ severity: CustomTipSeverity; /** * The type of the custom tip. */ type: CustomTipType; /** * The function to determine how to match this tipId. * * @remarks * This function might need to be updated if the depending package is updated. * For example, if `pnpm` change the error logs for "ERR_PNPM_NO_MATCHING_VERSION", we will need to update the match function accordingly. */ isMatch?: (str: string) => boolean; } /** * An item from the {@link ICustomTipsJson.customTips} list. * @beta */ export declare interface ICustomTipItemJson { /** * (REQUIRED) An identifier indicating a message that may be printed by Rush. * If that message is printed, then this custom tip will be shown. * Consult the Rush documentation for the current list of possible identifiers. */ tipId: CustomTipId; /** * (REQUIRED) The message text to be displayed for this tip. */ message: string; } /** * This interface represents the raw custom-tips.json file which allows repo maintainers * to configure extra details to be printed alongside certain Rush messages. * @beta */ export declare interface ICustomTipsJson { /** * Specifies the custom tips to be displayed by Rush. */ customTips?: ICustomTipItemJson[]; } /** The opt-in `rush.json` daemon block. Environment overrides take precedence. @beta */ export declare interface IDaemonConfigurationJson { /** Enables the separate client. Defaults to false; existing rush/rushx are unchanged. */ readonly enabled?: boolean; /** Idle shutdown timeout in seconds. Defaults to 900. */ readonly idleTimeoutSeconds?: number; /** Start an absent daemon. Defaults to true, but only for opted-in invocations. */ readonly autoStart?: boolean; /** Retains host file observation for warm projects between requests; never schedules builds. Defaults to false. */ readonly watch?: boolean; /** Enables explicit operationSettings[].daemonIpc Node runners for daemon builds. Defaults to false. */ readonly usePersistentIpcRunners?: boolean; /** * Lets daemon builds run an operation's `:incremental` script, instead of its initial script, on top of the * outputs of its last successful run in the daemon, when only files that it builds were edited since then and its * output folders are unchanged. Otherwise the initial script runs, as it does for native Rush. Results of an * incremental script are not written to the build cache. Defaults to true. */ readonly incrementalBuilds?: boolean; /** * Keeps a watch-mode worker (the `:incremental:ipc` script) alive between daemon builds for each operation * whose rush-project.json operation settings set `allowDaemonWarmWorker`, and sends it the next incremental run * when `incrementalBuilds` allows one. Otherwise the worker is closed and the initial script runs. Requires * `incrementalBuilds`. Defaults to false. */ readonly warmWorkers?: boolean; /** * Lets a build request that arrives while the daemon executes an incremental batch with the same request settings * add its operations to the executing iteration, and get its result once they complete, instead of waiting for the * iteration to end. Experimental. Defaults to false. */ readonly joinRunningBatch?: boolean; /** * Lets an operation of a daemon build complete before its build cache entry is written. The daemon clones the * operation's output files, which takes well under a second on a file system that can clone files (such as Btrfs, * XFS or APFS), and writes the entry from the clones in the background. So the operations that depend on it, and the * command, don't wait for the entry. An operation waits at most half a second for its clones. Slower clones finish * in the background, and the entry is dropped if an output file changes before it is cloned. Otherwise, and in * cobuilds, the entry is written before the operation completes, as in native Rush. An entry that fails to be * written in the background doesn't change the operation's status, and the daemon drops the entries that it hasn't * written when it stops. Defaults to false. */ readonly deferCacheWrites?: boolean; /** * Lets an idle daemon load the next workspace graph and create its engine once the workspace inputs change in a way * that the next request would otherwise reload for, so that the next request with the same command line as the last * one starts on a bound engine. It never runs an operation. A request that it cannot serve stops it. Experimental. * Defaults to false. */ readonly backgroundPrepare?: boolean; /** Maximum admission queue wait in seconds. Defaults to 30. */ readonly queueTimeoutSeconds?: number; /** * Idle resource expiration in an attached daemon warm set; retained results of resource-free projects do not * expire. Defaults to 300 seconds. */ readonly warmIdleTimeoutSeconds?: number; /** * Best-effort sampled RSS budget for an attached warm set, not a hard ceiling; active/protected work and retained * results of resource-free projects are exempt. Defaults to 512 MiB. */ readonly warmMemoryBudgetMB?: number; /** * Best-effort limit on projects holding warm resources (active runners or file watchers); active/protected work * is exempt, and retained results of resource-free projects do not count. Defaults to 20 projects. */ readonly warmSetMaxProjects?: number; /** Prefer measured time-saved * frequency / resident-memory retention over LRU. Never starts scripts. Defaults to false. */ readonly autoWarmByTelemetry?: boolean; /** * Names of configured Rush plugins (their `pluginName` in rush-plugins.json) that the repository has verified * for long-lived daemon engines, in addition to plugins whose manifest sets `daemonCompatible`. Defaults to none. */ readonly compatiblePlugins?: ReadonlyArray; /** * Names of configured Rush plugins (their `pluginName` in rush-plugins.json) that the repository has verified to be * command-agnostic, in addition to plugins whose manifest sets `daemonCommandAgnostic`. Such a plugin's * `initialize` and `runAnyPhasedCommand` taps do the same for every phased command, so they don't stop one * daemon engine from serving several commands. Defaults to none. */ readonly commandAgnosticPlugins?: ReadonlyArray; } /** * An explicitly selected, non-cacheable Node IPC tool for an unsharded daemon build operation. * @alpha */ export declare interface IDaemonIpcConfiguration { /** * A project-root-relative .js, .cjs or .mjs entrypoint in a dedicated implementation subdirectory. * The directory's complete file tree is fingerprinted; imports outside it (other than Node built-ins) * are unsupported. Do not write build outputs or ordinary input files into this directory. */ entryPoint: string; /** Literal tool arguments, followed by the operation's non-ignored raw custom parameters. */ args?: string[]; } /** * A build cache entry to write from sealed outputs. */ declare interface IDeferredCacheEntryWrite { readonly cacheId: string; /** The name of the operation, such as `my-project (build)` */ readonly operationName: string; readonly sealedOutputs: ISealedOutputs; /** * Writes the entry from the sealed outputs. Resolves to the size of the entry in bytes, or to `undefined` if it * was not written, in which case its terminal output is logged. The abort signal kills tar. */ readonly writeAsync: (terminal: ITerminal, abortSignal: AbortSignal) => Promise; } declare interface IDeferredCacheEntryWritesOptions { /** Clones a file. By default, this fails unless the file system can clone the file. */ readonly cloneFileAsync?: (sourcePath: string, destinationPath: string) => Promise; /** Whether a process with the given ID is running */ readonly isProcessRunning?: (pid: number) => boolean; /** The ID of this process */ readonly pid?: number; /** * How long `trySealAsync` waits for the files to be cloned before it lets them be cloned in the background. By * default, half a second. */ readonly sealWaitMs?: number; } declare interface IDeferredCacheEntryWritesReport { /** Entries that were queued since the previous report */ readonly queuedCount: number; /** Entries that were written since the previous report */ readonly writtenCount: number; /** The total size in bytes of those entries */ readonly writtenByteCount: number; /** Entries that failed to be written since the previous report */ readonly failedCount: number; /** * Entries that were dropped since the previous report, because an output file changed before it was sealed or * because the writes were aborted */ readonly droppedCount: number; /** Entries that are being sealed, queued or being written */ readonly pendingCount: number; } declare interface IEnvironment { [environmentVariableName: string]: string | undefined; } /** * @beta */ export declare interface IEnvironmentConfigurationInitializeOptions { doNotNormalizePaths?: boolean; } /** * Part of IRushConfigurationJson. * @beta */ declare interface IEventHooksJson { /** * The list of scripts to run after every Rush build command finishes */ postRushBuild?: string[]; } /** * The `IExecutionResult` interface represents the results of executing a set of {@link Operation}s. * @alpha */ export declare interface IExecutionResult { /** * The results for each scheduled operation. */ readonly operationResults: ReadonlyMap; /** * The overall result. */ readonly status: OperationStatus; } /** * This interface represents the raw experiments.json file which allows repo * maintainers to enable and disable experimental Rush features. * @beta */ export declare interface IExperimentsJson { /** * By default, 'rush install' passes --no-prefer-frozen-lockfile to 'pnpm install'. * Set this option to true to pass '--frozen-lockfile' instead for faster installs. */ usePnpmFrozenLockfileForRushInstall?: boolean; /** * By default, 'rush update' passes --no-prefer-frozen-lockfile to 'pnpm install'. * Set this option to true to pass '--prefer-frozen-lockfile' instead to minimize shrinkwrap changes. */ usePnpmPreferFrozenLockfileForRushUpdate?: boolean; /** * By default, 'rush update' runs as a single operation. * Set this option to true to instead update the lockfile with `--lockfile-only`, then perform a `--frozen-lockfile` install. * Necessary when using the `afterAllResolved` hook in .pnpmfile.cjs. */ usePnpmLockfileOnlyThenFrozenLockfileForRushUpdate?: boolean; /** * If using the 'preventManualShrinkwrapChanges' option, restricts the hash to only include the layout of external dependencies. * Used to allow links between workspace projects or the addition/removal of references to existing dependency versions to not * cause hash changes. */ omitImportersFromPreventManualShrinkwrapChanges?: boolean; /** * If true, the chmod field in temporary project tar headers will not be normalized. * This normalization can help ensure consistent tarball integrity across platforms. */ noChmodFieldInTarHeaderNormalization?: boolean; /** * If true, build caching will respect the allowWarningsInSuccessfulBuild flag and cache builds with warnings. * This will not replay warnings from the cached build. */ buildCacheWithAllowWarningsInSuccessfulBuild?: boolean; /** * If true, build skipping will respect the allowWarningsInSuccessfulBuild flag and skip builds with warnings. * This will not replay warnings from the skipped build. */ buildSkipWithAllowWarningsInSuccessfulBuild?: boolean; /** * If true, perform a clean install after when running `rush install` or `rush update` if the * `.npmrc` file has changed since the last install. */ cleanInstallAfterNpmrcChanges?: boolean; /** * If true, print the outputs of shell commands defined in event hooks to the console. */ printEventHooksOutputToConsole?: boolean; /** * If true, Rush will not allow node_modules in the repo folder or in parent folders. */ forbidPhantomResolvableNodeModulesFolders?: boolean; /** * (UNDER DEVELOPMENT) For certain installation problems involving peer dependencies, PNPM cannot * correctly satisfy versioning requirements without installing duplicate copies of a package inside the * node_modules folder. This poses a problem for "workspace:*" dependencies, as they are normally * installed by making a symlink to the local project source folder. PNPM's "injected dependencies" * feature provides a model for copying the local project folder into node_modules, however copying * must occur AFTER the dependency project is built and BEFORE the consuming project starts to build. * The "pnpm-sync" tool manages this operation; see its documentation for details. * Enable this experiment if you want "rush" and "rushx" commands to resync injected dependencies * by invoking "pnpm-sync" during the build. */ usePnpmSyncForInjectedDependencies?: boolean; /** * If set to true, Rush will generate a `project-impact-graph.yaml` file in the repository root during `rush update`. */ generateProjectImpactGraphDuringRushUpdate?: boolean; /** * If true, when running in watch mode, Rush will check for phase scripts named `_phase::ipc` and run them instead * of `_phase:` if they exist. The created child process will be provided with an IPC channel and expected to persist * across invocations. */ useIPCScriptsInWatchMode?: boolean; /** * (UNDER DEVELOPMENT) The Rush alerts feature provides a way to send announcements to engineers * working in the monorepo, by printing directly in the user's shell window when they invoke Rush commands. * This ensures that important notices will be seen by anyone doing active development, since people often * ignore normal discussion group messages or don't know to subscribe. */ rushAlerts?: boolean; /** * Allow cobuilds without using the build cache to store previous execution info. When setting up * distributed builds, Rush will allow uncacheable projects to still leverage the cobuild feature. * This is useful when you want to speed up operations that can't (or shouldn't) be cached. */ allowCobuildWithoutCache?: boolean; /** * By default, rush perform a full scan of the entire repository. For example, Rush runs `git status` to check for local file changes. * When this toggle is enabled, Rush will only scan specific paths, significantly speeding up Git operations. */ enableSubpathScan?: boolean; /** * Rush has a policy that normally requires Rush projects to specify `workspace:*` in package.json when depending * on other projects in the workspace, unless they are explicitly declared as `decoupledLocalDependencies` * in rush.json. Enabling this experiment will remove that requirement for dependencies belonging to a different * subspace. This is useful for large product groups who work in separate subspaces and generally prefer to consume * each other's packages via the NPM registry. */ exemptDecoupledDependenciesBetweenSubspaces?: boolean; /** * If true, when running on macOS, Rush will omit AppleDouble files (`._*`) from build cache archives * when a companion file exists in the same directory. AppleDouble files are automatically created by * macOS to store extended attributes on filesystems that don't support them, and should generally not * be included in the shared build cache. */ omitAppleDoubleFilesFromBuildCache?: boolean; /** * If true, `rush change --verify` will perform additional validation of change files. Specifically, * it will report errors if change files reference projects that do not exist in the Rush configuration, * or if change files target a project that belongs to a lockstepped version policy but is not the * policy's main project. */ strictChangefileValidation?: boolean; /** * If true, the build cache will use file-based APIs to transfer cache entries to and from cloud * storage. This avoids loading the entire cache entry into memory, which can prevent out-of-memory * errors for large build outputs and allow cache entries to exceed the limit of a single Buffer. * The cloud cache provider plugin must implement the optional file-based methods for this to take * effect; otherwise it falls back to the buffer-based approach. */ useDirectFileTransfersForBuildCache?: boolean; /** * By default, Rush forwards its entire process environment (minus a small denylist) to the shell * commands it invokes for operations (e.g. "build", "test"). If true, environment variables whose * names begin with `RUSH_` will additionally be omitted from that forwarded environment. This can * help prevent operation scripts from accidentally depending on Rush's own internal environment * variables. */ trimRushEnvironmentVariablesForOperations?: boolean; /** * If true, when using PNPM, Rush resolves the `${VAR}` tokens that appear in credentials and * registry URLs in the `.npmrc` file, instead of relying on PNPM to expand them. Credentials are * passed to PNPM using `npm_config_*` environment variables and are not written to the generated * `.npmrc` file. * * @remarks * This compatibility workaround applies to PNPM 10.34.2 through 10.x and PNPM 11.5.3 through * versions earlier than 11.6.0. PNPM 11.6.0 and newer support URL-scoped `pnpm_config_//...` * environment variables, which should be supplied directly by CI so the trusted environment binds * each credential to its registry. Dynamic registry and proxy settings must likewise be supplied * through trusted user, global, CLI, or environment configuration rather than a project `.npmrc`. */ provideNpmrcCredentialsViaEnvironment?: boolean; /** * If true, Rush may use the experimental Rush reporter system. If omitted or false, * Rush preserves the legacy reporting behavior. */ useRushReporter?: boolean; } /** * Options for creating a file system build cache provider. * @beta */ export declare interface IFileSystemBuildCacheProviderOptions { /** * The workspace Rush configuration */ rushConfiguration: RushConfiguration; /** * The user Rush configuration */ rushUserConfiguration: RushUserConfiguration; } /** * Options for generating the cache id for an operation. * @beta */ export declare interface IGenerateCacheEntryIdOptions { /** * The name of the project */ projectName: string; /** * The name of the phase */ phaseName: string; /** * A hash of the input files */ projectStateHash: string; } /** * @beta */ export declare interface IGetChangedProjectsOptions { targetBranchName: string; terminal: ITerminal; shouldFetch?: boolean; variant?: string; /** * If set to `true`, consider a project's external dependency installation layout as defined in the * package manager lockfile when determining if it has changed. */ includeExternalDependencies: boolean; /** * If set to `true` apply the `incrementalBuildIgnoredGlobs` property in a project's `rush-project.json` * and exclude matched files from change detection. */ enableFiltering: boolean; /** Optional request-owned configuration source, avoiding shared project/rig caches. */ getIncrementalBuildIgnoredGlobsAsync?: (project: RushConfigurationProject) => Promise | undefined>; /** * If set to `true`, excludes projects where the only changes are: * - A version change to `package.json`, optionally accompanied by changes to `peerDependencies` * - Changes to `CHANGELOG.md` and/or `CHANGELOG.json` files * * This prevents `rush version --bump` from triggering `rush change --verify` to request change files * for the version bumps and changelog updates it creates. */ excludeVersionOnlyChanges?: boolean; } /** * Information about the currently executing global script command (as defined in command-line.json) provided to plugins. * @beta */ export declare interface IGlobalCommand extends IRushCommand { /** * Get a parameter by its long name (e.g. "--output-path") that was defined in command-line.json for this command. * If the parameter was not defined or not provided on the command line, this will throw. */ getCustomParametersByLongName(longName: string): TParameter; /** * Call this from a plugin hook to indicate that the command has been fully handled * by the plugin. When set, the default shell command execution will be skipped. */ setHandled(): void; } /** * Decides whether an operation may run its `:incremental` command outside watch mode. * The Rush daemon registers one for each execution record. Runners get it from * {@link IOperationRunnerContext.getIncrementalExecutionGuard}. * * @beta */ export declare interface IIncrementalExecutionGuard { /** * Returns `undefined` if the incremental command may run, otherwise why it may not, as a clause that completes * "Not using the incremental command because ...", e.g. `its command line changed`. */ getBlockReasonAsync(options?: IIncrementalExecutionGuardOptions): Promise; /** * Called after the incremental command succeeded. Returns `undefined` if its outputs can be kept, otherwise why * the initial command must run as well, as a clause that completes "Running the initial command, because ...". */ verifyIncrementalResultAsync(options?: IIncrementalExecutionGuardOptions): Promise; } /** * Options that an operation runner passes to its {@link IIncrementalExecutionGuard}. * * @beta */ export declare interface IIncrementalExecutionGuardOptions { /** * Set by a runner whose incremental runs keep the previous build in memory, such as a watch-mode bundler in a * warm worker. Outputs that look like bundles then do not require the initial command. If an incremental run * changes which output files exist, that run is still followed by the initial command, but later runs of the * operation may use the incremental command again, unless the run added or removed a content-hashed file. * Defaults to false. */ readonly outputsMayBeBundles?: boolean; } /** * This interface represents the raw individual version policy JSON object which extends the base version policy * with additional fields specific to individual versioning. * @public */ export declare interface IIndividualVersionJson extends IVersionPolicyJson { lockedMajor?: number; } /** * Represents a synchronously-queryable in-memory snapshot of the state of the inputs to a Rush repository. * * The methods on this interface are idempotent and will return the same result regardless of when they are executed. * @beta */ export declare interface IInputsSnapshot { /** * The raw hashes of all tracked files in the repository. */ readonly hashes: ReadonlyMap; /** * The directory that all paths in `hashes` are relative to. */ readonly rootDirectory: string; /** * Whether or not the repository has uncommitted changes. */ readonly hasUncommittedChanges: boolean; /** * The time, in milliseconds since the epoch, at which this snapshot began reading the state of the working tree, * if known. * * @remarks * A tracked file that was modified at or after this time may be newer than its hash in `hashes`, because Git * may have read the file before it was saved. */ readonly workingTreeReadStartTimeMs?: number; /** * Gets the map of file paths to Git hashes that will be used to compute the local state hash of the operation. * Exposed separately from the final state hash to facilitate detailed change detection. * * @param project - The Rush project to get hashes for * @param operationName - The name of the operation (phase) to get hashes for. If omitted, returns a default set for the project, as used for bulk commands. * @returns A map of file name to Git hash. For local files paths will be relative. Configured additional files may be absolute paths. */ getTrackedFileHashesForOperation(project: IRushConfigurationProjectForSnapshot, operationName?: string): ReadonlyMap; /** * Gets the state hash for the files owned by this operation, including the resolutions of package.json dependencies. This will later be combined with the hash of * the command being executed and the final hashes of the operation's dependencies to compute the final hash for the operation. * @param project - The Rush project to compute the state hash for * @param operationName - The name of the operation (phase) to get hashes for. If omitted, returns a generic hash for the whole project, as used for bulk commands. * @param environment - The environment that the operation runs with, if it differs from the environment of the * snapshot. The operation's `dependsOnEnvVars` are hashed from it. * @returns The local state hash for the project. This is a hash of the environment, the project's tracked files, and any additional files. */ getOperationOwnStateHash(project: IRushConfigurationProjectForSnapshot, operationName?: string, environment?: Readonly>): string; } /** * Options to pass to the rush "launch" functions. * * @public */ export declare interface ILaunchOptions { /** * True if the tool was invoked from within a project with a rush.json file, otherwise false. We * consider a project without a rush.json to be "unmanaged" and we'll print that to the command line when * the tool is executed. This is mainly used for debugging purposes. */ isManaged: boolean; /** * If true, the wrapper process already printed a warning that the version of Node.js hasn't been tested * with this version of Rush, so we shouldn't print a similar error. */ alreadyReportedNodeTooNewError?: boolean; /** * Pass along the terminal provider from the CLI version selector. * * @privateRemarks * We should remove this. The version selector package can be very old. It's unwise for * `rush-lib` to rely on a potentially ancient `ITerminalProvider` implementation. */ terminalProvider?: ITerminalProvider; /** * Used only by `@microsoft/rush/lib/start-dev.js` during development. * Specifies Rush devDependencies of the `@microsoft/rush` to be manually loaded. * * @remarks * Marked as `@internal` because `IBuiltInPluginConfiguration` is internal. * @internal */ builtInPluginConfigurations?: _IBuiltInPluginConfiguration[]; /** * Supplies the structured event sink owned by the Rush frontend. * * @remarks * This is an internal cross-version frontend-to-engine handoff. Reporter * selection and concrete reporter instances remain owned by the frontend. * * @internal */ reporter?: IRushSessionReporterOptions; } /** * @public */ declare interface ILocalBuildCacheJson extends IBaseBuildCacheJson { readonly cacheProvider: 'local-only'; } /** * This interface represents the raw lock-step version policy JSON object which extends the base version policy * with additional fields specific to lock-step versioning. * @public */ export declare interface ILockStepVersionJson extends IVersionPolicyJson { version: string; nextBump?: string; mainProject?: string; } /** * Information about the log files for an operation. * * @alpha */ export declare interface ILogFilePaths { /** * The absolute path to the folder containing the text log files. * Provided as a convenience since it is an intermediary value of producing the text log file path. */ textFolder: string; /** * The absolute path to the folder containing the JSONL log files. * Provided as a convenience since it is an intermediary value of producing the jsonl log file path. */ jsonlFolder: string; /** * The absolute path to the merged (interleaved stdout and stderr) text log. * ANSI escape codes have been stripped. */ text: string; /** * The absolute path to the stderr text log. * ANSI escape codes have been stripped. */ error: string; /** * The absolute path to the JSONL log. ANSI escape codes are left intact to be able to reproduce the console output. */ jsonl: string; } /** * @beta */ export declare interface ILogger { readonly terminal: Terminal; /** * Call this function to emit an error to the Rush runtime. */ emitError(error: Error): void; /** * Call this function to emit a warning to the Rush runtime. */ emitWarning(warning: Error): void; } /** * This policy indicates all related projects get version bump driven by their own changes. * @public */ export declare class IndividualVersionPolicy extends VersionPolicy { /** * @internal */ readonly _json: IIndividualVersionJson; /** * The major version that has been locked */ get lockedMajor(): number | undefined; /** * @internal */ constructor(versionPolicyJson: IIndividualVersionJson); /** * Returns an updated package json that satisfies the version policy. * * @param project - input package json * @param force - force update even when the project version is higher than the policy version. */ ensure(project: IPackageJson, force?: boolean): IPackageJson | undefined; /** * Bumps version. * Individual version policy lets change files drive version bump. This method currently does not do anything. * * @param bumpType - bump type * @param identifier - prerelease id */ bump(bumpType?: BumpType, identifier?: string): void; /** * Validates the specified version and throws if the version does not satisfy the policy. * * @param versionString - version string * @param packageName - package name */ validate(versionString: string, packageName: string): void; } /** * Part of IRushConfigurationJson. * @internal */ export declare interface _INpmOptionsJson extends IPackageManagerOptionsJsonBase { } /** * Provenance of a status line emitted via the sink's activity callback. * * @internal */ export declare interface _IOperationActivityOptions { /** * Set when the line was written to an operation's own collated stream. */ readonly operationId?: string; /** * True when the line was written to stderr. */ readonly stderr?: boolean; } /** * @internal */ export declare interface _IOperationBuildCacheOptions { /** * The repo-wide configuration for the build cache. */ buildCacheConfiguration: BuildCacheConfiguration; /** * The terminal to use for logging. */ terminal: ITerminal; /** * If true, omit AppleDouble (`._*`) files from cache archives when running on macOS * and a companion file exists in the same directory. */ excludeAppleDoubleFiles: boolean; /** * If true, use file-based APIs (when available) to transfer cache entries to and from the * cloud provider, avoiding buffering the entire entry in memory. */ useDirectFileTransfersForBuildCache: boolean; } /** * A negotiated reporter channel allocated for one operation child process. * * @internal */ export declare interface _IOperationChildProcessReporter { readonly environment: Readonly>; readonly hasWarningOrError: boolean; readonly stdio: child_process.StdioOptions; attachAsync(child: child_process.ChildProcess, structuredOutputTerminalProvider: ITerminalProvider): Promise; } /** * Which command an operation runner executed for an operation in one iteration. * * @beta */ export declare interface IOperationCommandExecution { /** * The command that produced the final outputs. */ readonly kind: 'initial' | 'incremental'; /** * Whether the runner has an incremental command that a later iteration could use. */ readonly hasIncrementalCommand: boolean; /** * Whether the command ran in a process that keeps watching the operation's input files after the command * completed, to run the incremental command again, such as a warm worker. A watcher can miss changes in a folder * that was deleted and recreated, so the next incremental run then requires that none of the folders that held * input files was deleted or recreated since this run started. Defaults to false. */ readonly watchesInputs?: boolean; } /** * The `IOperationExecutionResult` interface represents the results of executing an {@link Operation}. * @alpha */ export declare interface IOperationExecutionResult extends IBaseOperationExecutionResult, IOperationLastState { /** * The graph iteration that owns this result. */ readonly iterationId: number; /** * The current execution status of an operation. Operations start in the 'ready' state, * but can be 'blocked' if an upstream operation failed. It is 'executing' when * the operation is executing. Once execution is complete, it is either 'success' or * 'failure'. */ readonly status: OperationStatus; /** * The error which occurred while executing this operation, this is stored in case we need * it later (for example to re-print errors at end of execution). */ readonly error: Error | undefined; /** * If this operation is only present in the graph to maintain dependency relationships, this flag will be set to true. */ readonly silent: boolean; /** * True if the operation should execute in this iteration, false otherwise. */ readonly enabled: boolean; /** * True if the operation's runner should remain active after its execution, false otherwise. */ readonly shouldRunnerPersist: boolean; /** * Object tracking execution timing. */ readonly stopwatch: IStopwatchResult; /** * Object used to report a summary at the end of the Rush invocation. */ readonly stdioSummarizer: StdioSummarizer; /** * Object used to collect problems (errors/warnings/info) encountered during the operation. */ readonly problemCollector: IProblemCollector; /** * The value indicates the duration of the same operation without cache hit. */ readonly nonCachedDurationMs: number | undefined; /** * The paths to the log files, if applicable. */ readonly logFilePaths: ILogFilePaths | undefined; } /** * Public API for the operation graph. * @alpha */ export declare interface IOperationGraph { /** * Hooks into the execution process for operations */ readonly hooks: OperationGraphHooks; /** * The set of operations in the graph. */ readonly operations: ReadonlySet; /** * A map from each `Operation` in the graph to its current result record. * The map is updated in real time as operations execute during an iteration. * Only statuses representing a completed execution (e.g. `Success`, `Failure`, * `SuccessWithWarning`) write to this map, as does `Skipped` for an operation that was * selected to execute and whose outputs a plugin (e.g. change detection) found up to date. * Statuses such as `Aborted`, or `Skipped` for an operation that was not selected — * which indicate that an operation did not actually run — do not update it. * For operations that have not yet run in the current iteration, the map retains the * result from whichever prior iteration the operation last ran in. * An entry with status `Ready` indicates that the operation is considered stale and * has been queued to run again. * Empty until at least one operation has completed execution. */ readonly resultByOperation: ReadonlyMap; /** * The maximum allowed parallelism for this operation graph. * Reads as a concrete integer. Accepts a `Parallelism` value and coerces it on write. */ get parallelism(): number; set parallelism(value: Parallelism); /** * If additional debug information should be printed during execution. */ debugMode: boolean; /** * If true, operations will be executed in "quiet mode" where only errors are reported. */ quietMode: boolean; /** * If true, allow operations to oversubscribe the CPU. Defaults to true. */ allowOversubscription: boolean; /** * When true, the operation graph will pause before running the next iteration (manual mode). * When false, iterations run automatically when scheduled. */ pauseNextIteration: boolean; /** * The current overall status of the execution. */ readonly status: OperationStatus; /** * The current set of terminal destinations. */ readonly terminalDestinations: ReadonlySet; /** * True if there is a scheduled (but not yet executing) iteration. * This will be false while an iteration is actively executing, or when no work is scheduled. */ readonly hasScheduledIteration: boolean; /** * AbortController controlling the lifetime of the overall session (e.g. watch mode). * Aborting this controller should signal all listeners (such as file system watchers) to dispose * and prevent further iterations from being scheduled. */ readonly abortController: AbortController; /** * Abort the current execution iteration, if any. Operations that have already started * will run to completion; only operations that have not yet begun will be aborted. * * If `options.terminateRunning` is true and the graph supports it, operations that are already running are also * signaled to terminate (via `IOperationRunnerContext.abortSignal`) and are reported as `Aborted`. */ abortCurrentIterationAsync(options?: { terminateRunning?: boolean; }): Promise; /** * Cleans up any resources used by the operation runners, if applicable. * * Does not wait for executing operations to finish before closing their runners. Hosts performing * idle eviction must coordinate this call with iteration scheduling. Operations, their last results, * and host-owned watchers are not removed. * * @param operations - The operations whose runners should be closed, or undefined to close all runners. */ closeRunnersAsync(operations?: Iterable): Promise; /** * Drops retained results after the host has awaited runner and watcher cleanup. * Rejects executing/prepared iterations and runners that still report active resources. * Detaches completed iteration contexts so surviving results do not retain evicted records. * Does not change enabled states, disk caches, or operation definitions. * Optional for compatibility with hosts that do not support idle eviction. */ deleteResults?(operations: Iterable): void; /** * Executes a single iteration of the operations. * @param options - Options for this execution iteration. * @returns A promise that resolves to true if the iteration has work to be done, or false if the iteration was empty and therefore not scheduled. */ scheduleIterationAsync(options: IOperationGraphIterationOptions): Promise; /** * Discards prepared, unstarted work without executing scripts or closing retained runners. * Throws while an iteration is executing. Completed results remain unchanged. * @returns Whether a prepared iteration was discarded. */ discardScheduledIteration(): boolean; /** * Executes all operations in the currently scheduled iteration, if any. * @returns A promise which is resolved when all operations have been processed to a final state. */ executeScheduledIterationAsync(): Promise; /** * Keeps the executing iteration from dispatching the operations that it holds (see * {@link IOperationGraphIterationOptions.holdUnneededOperations}) until the returned function is called, so that a * request can still join the iteration while the inputs are read for it. Aborting the iteration dispatches them * regardless. * @returns A function that ends the retention, or undefined if no iteration is executing with held operations. */ retainHeldOperations?(): (() => void) | undefined; /** * Adds the work of a request that arrives while an iteration is executing to that iteration, instead of to a later * one. The iteration must hold its unneeded operations (see * {@link IOperationGraphIterationOptions.holdUnneededOperations}). * * @remarks * The caller first enables the operations of all requests that the iteration serves, including the joining one. * The graph then calculates the state hashes of the operations that were not dispatched yet from the newer inputs * snapshot, and plans the iteration again with `configureIteration`. That call receives every operation of the * iteration, and its `startedOperations` names those that were already dispatched. The new plan can only enable * operations that were not dispatched yet: an operation that the iteration already enabled or dispatched keeps its * `enabled` state, its state hash and its configuration. * * The iteration is not extended if it was aborted, is not incremental or has no inputs snapshot, if an operation * that the caller invalidates already ran in it, or if the joining request needs an operation that was dispatched * before its inputs or outputs last changed. Nor is it extended if the new plan enables an operation that the * joining request needs and that was dispatched without running; the graph finds this only after the * `configureIteration` taps ran, and it discards their plan. When the iteration is not extended, the graph is left * unchanged, and the caller restores the enabled states. * * Otherwise, the graph calls {@link IOperationGraphExtensionOptions.beforeCommit}, the operations that changed are * passed to `extendIteration`, and the joining request's operations are dispatched before the others. */ tryExtendCurrentIteration?(options: IOperationGraphExtensionOptions): IOperationGraphExtensionResult; /** * Invalidates the specified operations, causing them to be re-executed. * @param operations - The operations to invalidate, or undefined to invalidate all operations. * @param reason - Optional reason for invalidation. */ invalidateOperations(operations?: Iterable, reason?: string): void; /** * Sets the enabled state for a collection of operations. * * @param operations - The operations whose enabled state should be updated. * @param targetState - The target enabled state to apply. * @param mode - 'unsafe' to directly mutate only the provided operations, 'safe' to also enable * transitive dependencies of enabled operations and disable transitive dependents of disabled operations. * @returns true if any operation's enabled state changed, false otherwise. */ setEnabledStates(operations: Iterable, targetState: Operation['enabled'], mode: 'safe' | 'unsafe'): boolean; /** * Adds a terminal destination for output. Only new output will be sent to the destination. * @param destination - The destination to add. */ addTerminalDestination(destination: TerminalWritable): void; /** * Removes a terminal destination for output. Optionally closes the stream. * New output will no longer be sent to the destination. * @param destination - The destination to remove. * @param close - Whether to close the stream. Defaults to `true`. */ removeTerminalDestination(destination: TerminalWritable, close?: boolean): boolean; } /** * Context used for configuring the operation graph. * @alpha */ export declare interface IOperationGraphContext extends ICreateOperationsContext { /** * The current state of the repository, if available. * Not part of the creation context to avoid the overhead of Git calls when initializing the graph. */ readonly initialSnapshot?: IInputsSnapshot; } /** * A structured, presentation-free event sink for the operation graph. * * @remarks * When a host (for example the Rush daemon) assigns a sink, the engine * "dual-emits": every operation state transition and every status line that * would be written as colorized terminal text is also emitted here as * structured data, with no change to the existing terminal output. * * All events are emitted synchronously in engine order. Implementations must * not call back into the graph. * * @internal */ export declare interface _IOperationGraphEventSink { /** * Invoked when an operation is prepared for an iteration. */ onOperationRegistered?(operationId: string, silent: boolean, result?: IOperationExecutionResult, iterationId?: number): void; /** * Invoked synchronously on every operation status transition. The result's * `status`, `error`, and `stopwatch` reflect the new state. */ onOperationStatusChanged?(result: IOperationExecutionResult, previousStatus: OperationStatus): void; /** * Invoked when an operation's collated output is about to be displayed, * with the progress counters rendered in the legacy * `==[ name ]===[ x of y ]==` header. */ onOperationHeader?(operationId: string, completedOperations: number, totalOperations: number): void; /** * Invoked for each chunk of an operation's raw output, upstream of any * newline normalization or quiet-mode filtering. */ onOperationChunk?(operationId: string, chunk: ITerminalChunk, result?: IOperationExecutionResult, iterationId?: number): void; /** * Invoked when an operation's collated output stream is closed at the end of * its execution, after all status lines and output have been written. This * is the authoritative "no more output for this operation" signal. */ onOperationStreamClosed?(operationId: string, result?: IOperationExecutionResult, iterationId?: number): void; /** * Invoked after the operation stream is closed and the final outcome is authoritative. */ onOperationCompleted?(result: IOperationExecutionResult): void; /** * Invoked for each human-oriented status line written to the terminal, * carrying the plain (pre-colorization) text. */ onActivity?(text: string, options?: _IOperationActivityOptions): void; /** * Invoked once when an iteration starts executing, before any of its operations start. * * @remarks * The engine announces an iteration with a `Selected N operations:` listing, which quiet mode omits, * and an `Executing a maximum of N simultaneous processes...` line. A sink that does not implement * this method receives those lines through `onActivity`. A sink that implements it receives them only * through this call, so that a host serving several requests from one iteration can announce each * request's own operations with `_formatIterationStartLines`. * * @param records - Every operation of the iteration, including silent ones. * @param parallelism - The graph's parallelism for the iteration. * @param quietMode - Whether the graph is in quiet mode. */ onIterationStarting?(records: ReadonlyArray, parallelism: number, quietMode: boolean): void; /** * Allocates a reporter channel for a child spawned by the specified operation. */ createChildProcessReporter?(operationId: string, iterationId: number): _IOperationChildProcessReporter | undefined; } /** * Options for {@link IOperationGraph.tryExtendCurrentIteration}. * @alpha */ export declare interface IOperationGraphExtensionOptions { /** * A snapshot of the inputs that was taken after the joining request was received. */ readonly inputsSnapshot: IInputsSnapshot; /** * The operations that the joining request needs. The operations that they depend on are needed as well. The caller * enables them (see {@link IOperationGraph.setEnabledStates}) before extending the iteration. */ readonly neededOperations: Iterable; /** * Operations whose last results can no longer be used, for example because their outputs changed. */ readonly invalidatedOperations?: Iterable; /** * The reason for invalidating `invalidatedOperations`. */ readonly invalidationReason?: string; /** * Called once the graph will extend the iteration, before it changes the iteration or dispatches any operation, so * that the joining request starts only if its work is added. If it throws, the iteration is not extended, the graph * is left unchanged, and the error propagates. */ readonly beforeCommit?: () => void; } /** * The outcome of {@link IOperationGraph.tryExtendCurrentIteration}. * @alpha */ export declare interface IOperationGraphExtensionResult { /** * Whether the iteration was extended. */ readonly extended: boolean; /** * Why the iteration was not extended, if it was not. */ readonly reason?: string; /** * The operations whose `enabled` state, runner policy or state hash the extension changed. Empty if the iteration * was not extended. */ readonly changedOperations: ReadonlySet; } /** * Options for a single iteration of operation execution. * @alpha */ export declare interface IOperationGraphIterationOptions { inputsSnapshot?: IInputsSnapshot; /** * The time when the iteration was scheduled, if available, as returned by `performance.now()`. */ startTime?: number; /** * Returns the environment that an operation of this iteration starts from, before any * `createEnvironmentForOperation` tap. The operation's `dependsOnEnvVars` are hashed from the same environment. * When omitted, every operation starts from `process.env` and hashes the environment of the inputs snapshot. * * @remarks * A long-lived host serves requests from clients whose environments differ from its own, and one iteration can * serve several requests. The host gives each operation the environment of a request that selected it * (see `getWorkspaceRequestOperationEnvironment`). */ getOperationEnvironment?: (operation: Operation) => Readonly>; /** * False to run every enabled operation of this iteration as a fresh process of a non-incremental command such as * `rush rebuild` would: without skipping unchanged operations, without reading the build cache, and without * passing the last result to the runner (so no runner uses its incremental command). Cache writes are unaffected. * When omitted or true, the graph's own setting (`ICreateOperationsContext.isIncrementalBuildAllowed`) applies. * * @remarks * A long-lived graph created by an incremental command serves a non-incremental request this way. The results * of operations that the iteration does not enable are kept. */ isIncrementalBuildAllowed?: boolean; /** * Returns the identifier of the request whose environment `getOperationEnvironment` returns for an operation of * this iteration, or `undefined` if there is no such request. When omitted, the iteration serves no identified * request. * * @remarks * A long-lived host can serve several requests in one iteration. A plugin can use this identifier to attribute * each operation to the request that selected it, for example to join per-operation telemetry with that * request's own telemetry entry. */ getOperationRequestId?: (operation: Operation) => string | undefined; /** * If true, the iteration does not dispatch the operations that none of its enabled operations needs (an operation * that is not enabled, and on which no enabled operation depends, directly or indirectly) until every other * operation has completed. Until then, {@link IOperationGraph.tryExtendCurrentIteration} can still enable them for * a request that joins the iteration. */ holdUnneededOperations?: boolean; /** * Set only when hooks configure or prepare the operations of an iteration that is already executing, because a * request joined it (see {@link IOperationGraph.tryExtendCurrentIteration}). These operations have already been * dispatched in the iteration: the graph ignores changes to their configuration, and a plugin should not act on * them again. * * @remarks * The graph can still refuse the plan of a `configureIteration` call with this set, after the call returns. A * plugin that keeps state across iterations applies the effects of such a plan in `extendIteration`, which the graph * calls only for a plan that it accepts, with the same options object. */ startedOperations?: ReadonlySet; } /** * The results of one request for an operation graph's work, passed to * {@link OperationGraphHooks.afterExecuteRequestAsync}. * * @remarks * A native command makes one request for each iteration, so its request has the iteration's results. A long-lived * host such as the Rush daemon can serve several requests with one iteration, and it serves a request whose * operations are all up to date without any iteration. Each of those requests has only its own results. * * @alpha */ export declare interface IOperationGraphRequestResult extends IExecutionResult { /** * The results of the operations that the request selected. An operation that was already up to date, so that * the request did not need to run it, has the `Skipped` status, a zero-length stopwatch and no problems. * A request that returned before its iteration finished omits the operations that had not finished. * The map can include silent operations; check `silent` before reporting an operation. */ readonly operationResults: ReadonlyMap; /** * The request's overall status, as its caller reports it. */ readonly status: OperationStatus; /** * The name of the Rush command that made the request, for example `build`. */ readonly commandName: string; /** * The environment of the request's caller. For a native command, this is `process.env`. A long-lived host passes * the environment of the client that sent the request, which can differ from the host's own `process.env`. */ readonly environment: Readonly>; /** * The id that a long-lived host gave the request, or `undefined` for a native command. */ readonly requestId: string | undefined; /** * Writes to the output of the request's caller. A long-lived host shows this output only to the client that sent * the request. */ readonly terminal: ITerminal; } /** * A snapshot of a previous operation execution, passed to runners to inform incremental behavior. * * @beta */ export declare interface IOperationLastState { /** * The status from the previous execution of this operation. */ readonly status: OperationStatus; } /** * @internal */ export declare interface _IOperationMetadata { durationInSeconds: number; logPath: string; errorLogPath: string; logChunksPath: string; cobuildContextId: string | undefined; cobuildRunnerId: string | undefined; } /** * @internal */ export declare interface _IOperationMetadataManagerOptions { operation: Operation; } /** * Options for constructing a new Operation. * @alpha */ export declare interface IOperationOptions { /** * The Rush phase associated with this Operation */ phase: IPhase; /** * The Rush project associated with this Operation */ project: RushConfigurationProject; /** * If set to false, this operation will be skipped during evaluation (return OperationStatus.Skipped). * This is useful for plugins to alter the scope of the operation graph across executions, * e.g. to enable or disable unit test execution, or to include or exclude dependencies. * * The special value "ignore-dependency-changes" can be used to indicate that this operation should only * be executed if there are local changes in the project. This is useful for operations like * "test" where you may want to skip testing projects that haven't changed. * * The default value is `true`, meaning the operation will be executed if it or any dependencies change. */ enabled?: OperationEnabledState; /** * When the scheduler is ready to process this `Operation`, the `runner` implements the actual work of * running the operation. */ runner?: IOperationRunner | undefined; /** * Settings defined in the project configuration for this operation, can be overridden. */ settings?: IOperationSettings | undefined; /** * {@inheritDoc Operation.logFilenameIdentifier} */ logFilenameIdentifier: string; } /** * The `Operation` class is a node in the dependency graph of work that needs to be scheduled by the * `OperationGraph`. Each `Operation` has a `runner` member of type `IOperationRunner`, whose * implementation manages the actual process for running a single operation. * * @beta */ export declare interface IOperationRunner { /** * Name of the operation, for logging. */ readonly name: string; /** * Whether or not the operation is cacheable. If false, all cache engines will be disabled for this operation. */ cacheable: boolean; /** * Indicates that this runner's duration has meaning. */ reportTiming: boolean; /** * Indicates that this runner is architectural and should not be reported on. */ silent: boolean; /** * If set to true, a warning result should not make Rush exit with a nonzero * exit code */ warningsAreAllowed: boolean; /** * If set to true, this operation is considered a no-op and can be considered always skipped for * analysis purposes. */ readonly isNoOp?: boolean; /** * If true, this runner currently owns some kind of active resource (e.g. a service or a watch process). * This can be used to determine if the operation is "in progress" even if it is not currently executing. * If the runner supports this property, it should update it as appropriate during execution. * The property is optional to avoid breaking existing implementations of IOperationRunner. */ readonly isActive?: boolean; /** * Last measured RSS of this runner's retained child process, in bytes. * Undefined if unmeasured or no longer resident. This is a sample, not a limit, allocation estimate, * or measurement of descendants. Runners sharing a process must not each report its RSS. */ readonly residentMemoryBytes?: number; /** * Method to be executed for the operation. * @param context - The context object containing information about the execution environment. * @param lastState - The last execution result of this operation, if any. */ executeAsync(context: IOperationRunnerContext, lastState?: IOperationLastState): Promise; /** * Return a hash of the configuration that affects the operation. */ getConfigHash(): string; /** * If this runner performs any background work to optimize future runs, this method will clean it up. * Must be safe to call again after the resources have been released. */ closeAsync?(): Promise; } /** * Information passed to the executing `IOperationRunner` * * @beta */ export declare interface IOperationRunnerContext { /** * The writer into which this `IOperationRunner` should write its logs. */ collatedWriter: CollatedWriter; /** * If Rush was invoked with `--debug` */ debugMode: boolean; /** * Defaults to `true`. Will be `false` if Rush was invoked with `--verbose`. */ quietMode: boolean; /** * Object used to manage metadata of the operation. * * @internal */ _operationMetadataManager: _OperationMetadataManager; /** * Object used to track elapsed time. */ stopwatch: IStopwatchResult; /** * The current execution status of an operation. Operations start in the 'ready' state, * but can be 'blocked' if an upstream operation failed. It is 'executing' when * the operation is executing. Once execution is complete, it is either 'success' or * 'failure'. */ status: OperationStatus; /** * True if the runner should remain active after this execution, false otherwise. */ readonly shouldRunnerPersist: boolean; /** * When defined, this signal is aborted if the host requests termination of in-progress work * (see `IOperationGraph.abortCurrentIterationAsync` with `terminateRunning: true`). Runners that observe it * should promptly stop any work they started (for example, kill their child process tree) and return * `OperationStatus.Aborted`. It is `undefined` when the graph does not support terminating running operations. */ readonly abortSignal?: AbortSignal; /** * The environment in which the operation is being executed. * A return value of `undefined` indicates that it should inherit the environment from the parent process. */ environment: IEnvironment | undefined; /** * Error which occurred while executing this operation, this is stored in case we need * it later (for example to re-print errors at end of execution). */ error?: Error; /** * Returns a callback that invalidates this operation so that it will be re-executed in the next iteration. * The returned callback captures only the minimal state needed, avoiding retention of the full context. * Callers should store the result rather than calling this method repeatedly. */ getInvalidateCallback(): (reason: string) => void; /** * Returns the guard that decides whether this operation may run its incremental command outside watch mode, or * `undefined` if nothing guards incremental commands in this process, for example outside the Rush daemon. * * @remarks * It is optional because older versions of Rush do not have it. A runner that has an incremental command and runs * outside watch mode follows the same steps as Rush's own shell command runner: * * 1. If it has no last state, or there is no guard, it runs its initial command. * * 2. If `getBlockReasonAsync()` returns a reason, it writes * `Not using the incremental command because .` and runs its initial command. * * 3. Otherwise it runs its incremental command. If that succeeds and `verifyIncrementalResultAsync()` returns a * reason, it writes `Running the initial command, because .` and runs its initial command. * * If either method rejects, the runner treats the error like a reason. Before it starts each command, the runner * calls {@link IOperationRunnerContext.reportCommandExecution}. The guard never allows the incremental command of an * operation whose runner did not report the command of its last successful run. */ getIncrementalExecutionGuard?(): IIncrementalExecutionGuard | undefined; /** * Records which command the runner is about to execute for this operation. Call it before starting each command, * so that the outputs of a command that fails or is aborted are attributed to it too. * * @remarks * It is optional because older versions of Rush do not have it. The outputs of an incremental command, and of * operations built against them, are never written to the build cache. */ reportCommandExecution?(execution: IOperationCommandExecution): void; /** * Allocates a negotiated reporter channel for a child process, when enabled. * * @internal */ createChildProcessReporter(): _IOperationChildProcessReporter | undefined; /** * Invokes the specified callback with a terminal that is associated with this operation. * * Will write to a log file corresponding to the phase and project, and clean it up upon completion. */ runWithTerminalAsync(callback: (terminal: ITerminal, terminalProvider: ITerminalProvider, structuredChildOutputTerminalProvider: ITerminalProvider) => Promise, options: { createLogFile: boolean; logFileSuffix?: string; }): Promise; } /** * @alpha */ export declare interface IOperationSettings { /** * The name of the operation. This should be a key in the `package.json`'s `scripts` object. */ operationName: string; /** * Explicit Node IPC launcher, used only with daemon.usePersistentIpcRunners for incremental daemon builds. * Native shell, rebuild, missing-script/NoOp, and preassigned sharded runners remain unchanged. */ daemonIpc?: IDaemonIpcConfiguration; /** * If true, and `daemon.warmWorkers` is enabled, the Rush daemon keeps the operation's `:incremental:ipc` * script running as a warm worker between builds, and sends it the incremental runs that the incremental * execution guard allows. * * @remarks * Set this only if that script, run in watch mode, runs every task and check that the `` script runs, * because the daemon reports a run on the worker as if the `` script had run. For Heft, that means the * `lintInWatchMode` option of heft-lint-plugin and the `runInWatchMode` setting of API Extractor, which both * default to skipping their task in watch mode. */ allowDaemonWarmWorker?: boolean; /** * Specify the folders where this operation writes its output files. If enabled, the Rush build * cache will restore these folders from the cache. The strings are folder names under the project * root folder. * * These folders should not be tracked by Git. They must not contain symlinks. * * @remarks * A plugin-defined operation for a project without a `rush-project.json` file can use the build cache * if this property is explicitly set to an empty array and the operation does not use the * `dependsOnEnvVars`, `dependsOnNodeVersion`, or `dependsOnAdditionalFiles` settings. */ outputFolderNames?: string[]; /** * Disable caching for this operation. The operation will never be restored from cache. * This may be useful if this operation affects state outside of its folder. * * This option is only used when the build cache is enabled for the repo. You can set * disableBuildCacheForOperation=true to disable caching for a specific project operation. * This is a useful workaround if that project's build scripts violate the assumptions of the cache, * for example by writing files outside the project folder. Where possible, a better solution is to improve * the build scripts to be compatible with caching. */ disableBuildCacheForOperation?: boolean; /** * An optional list of environment variables that can affect this operation. The values of * these environment variables will become part of the hash when reading and writing the build cache. * * Note: generally speaking, all environment variables available to Rush are also available to any * operations performed -- Rush assumes that environment variables do not affect build outputs unless * you list them here. */ dependsOnEnvVars?: string[]; /** * Specifies whether and at what granularity the Node.js version should be included in the hash * used for the build cache. When enabled, changing the Node.js version at the specified granularity * will invalidate cached outputs and cause the operation to be re-executed. This is useful for * projects that produce Node.js-version-specific outputs, such as native module builds. * * Allowed values: * - `true` - alias for `"patch"`, includes the full version (e.g. `18.17.1`) * - `"major"` - includes only the major version (e.g. `18`) * - `"minor"` - includes the major and minor version (e.g. `18.17`) * - `"patch"` - includes the full version (e.g. `18.17.1`) */ dependsOnNodeVersion?: boolean | NodeVersionGranularity; /** * An optional list of glob (minimatch) patterns pointing to files that can affect this operation. * The hash values of the contents of these files will become part of the final hash when reading * and writing the build cache. * * Note: if a particular file will be matched by patterns provided by both `incrementalBuildIgnoredGlobs` and * `dependsOnAdditionalFiles` options - `dependsOnAdditionalFiles` will win and the file will be included * calculating final hash value when reading and writing the build cache */ dependsOnAdditionalFiles?: string[]; /** * An optional config object for sharding the operation. If specified, the operation will be sharded * into multiple invocations. The `count` property specifies the number of shards to create. The * `shardArgumentFormat` property specifies the format of the argument to pass to the command to * indicate the shard index and count. The default value is `--shard={shardIndex}/{shardCount}`. */ sharding?: IRushPhaseSharding; /** * How many concurrency units this operation should take up during execution. The maximum concurrent units is * determined by the -p flag. */ weight?: number | `${number}%`; /** * If true, this operation can use cobuilds for orchestration without restoring build cache entries. */ allowCobuildWithoutCache?: boolean; /** * If true, this operation will never be skipped by the `--changed-projects-only` flag. */ ignoreChangedProjectsOnlyFlag?: boolean; /** * An optional list of custom command-line parameter names (their `parameterLongName` values from * command-line.json) that should be ignored when invoking the command for this operation. * This allows a project to opt out of parameters that don't affect its operation, preventing * unnecessary cache invalidation for this operation and its consumers. */ parameterNamesToIgnore?: string[]; } /** * @internal */ export declare interface _IOperationStateFileOptions { projectFolder: string; metadataFolder: string; } /** * Structured components of the state hash for an operation. * @alpha */ export declare interface IOperationStateHashComponents { /** * The state hashes of operation dependencies, sorted by name. * Each entry is of the form `{dependencyName}={hash}`. */ readonly dependencies: readonly string[]; /** * The hash of the operation's own local inputs (e.g. tracked files, environment variables). */ readonly local: string; /** * The hash of the operation's configuration (e.g. CLI parameters). */ readonly config: string; } /** * @internal */ export declare interface _IOperationStateJson { nonCachedDurationMs: number; cobuildContextId: string | undefined; cobuildRunnerId: string | undefined; } /** * Options for the package manager. * @public */ export declare interface IPackageManagerOptionsJsonBase { /** * Environment variables for the package manager */ environmentVariables?: IConfigurationEnvironment; } /** * A parallelism value expressed as a fraction of total available concurrency slots. * @beta */ export declare interface IParallelismScalar { readonly scalar: number; } /** Options for parsing a command for a long-lived engine host. @alpha */ export declare interface IParsePhasedCommandOptions { readonly argv: ReadonlyArray; readonly cwd: string; /** * The environment of the client that sent the command. It supplies the defaults of environment-backed * parameters (`RUSH_PARALLELISM`), because a long-lived host's own environment belongs to no request. * Defaults to `process.env`. */ readonly environment?: Readonly>; readonly rushConfiguration: RushConfiguration; readonly terminalProvider: ITerminalProvider; } /** * Metadata about a phase. * @alpha */ export declare interface IPhase { /** * The name of this phase. */ name: string; /** * If set to `true,` this this phase was generated from a bulk command, and * was not explicitly defined in the command-line.json file. */ isSynthetic: boolean; /** * This property is used in the name of the filename for the logs generated by this * phase. This is a filesystem-safe version of the phase name. For example, * a phase with name `_phase:compile` has a `logFilenameIdentifier` of `_phase_compile`. */ logFilenameIdentifier: string; /** * The set of custom command line parameters that are relevant to this phase. */ associatedParameters: Set; /** * The resolved dependencies of the phase */ dependencies: { self: Set; upstream: Set; }; /** * By default, Rush returns a nonzero exit code if errors or warnings occur during a command. If this option is * set to `true`, Rush will return a zero exit code if warnings occur during the execution of this phase. */ allowWarningsOnSuccess: boolean; /** * What should happen if the script is not defined in a project's package.json scripts field. Default is "error". */ missingScriptBehavior: IPhaseBehaviorForMissingScript; /** * (Optional) If the `shellCommand` field is set for a bulk command, Rush will invoke it for each * selected project; otherwise, Rush will invoke the package.json `"scripts"` entry matching Rush command/phase name. * * This string is the path to a script that will be invoked using the OS shell. The working directory will be * the folder that contains rush.json. If custom parameters are associated with this command, their * values will be appended to the end of this string. */ shellCommand?: string; } /** * The set of valid behaviors for a missing script in a project's package.json scripts for a given phase. * @alpha */ export declare type IPhaseBehaviorForMissingScript = 'silent' | 'log' | 'error'; /** * Information about the currently executing phased script command (as defined in command-line.json, or default "build" or "rebuild") provided to plugins. * @beta */ export declare interface IPhasedCommand extends IRushCommand { /** * Hooks into the execution of the current phased command * @alpha */ readonly hooks: PhasedCommandHooks; /** * An abort controller that can be used to abort the command. * Long-lived plugins should listen to the signal to handle any cleanup logic. * @alpha */ readonly sessionAbortController: AbortController; } /** * A native phased command graph prepared without executing an iteration. * @alpha */ export declare interface IPhasedCommandEngine extends AsyncDisposable { [Symbol.asyncDispose](): Promise; /** Acquire once per coalesced iteration, before input reconciliation; dispose after output and runner cleanup. */ readonly acquireExecutionLeaseAsync?: () => Promise; readonly operationGraph: IOperationGraph; readonly rushSession: RushSession; readonly inputsSnapshot: IInputsSnapshot; readonly getInputsSnapshotAsync: GetInputsSnapshotAsyncFn; readonly phaseNames: ReadonlyArray; readonly pluginNames: ReadonlyArray; readonly isIncremental: boolean; /** * Logs one request's telemetry entry the way a native iteration logs its own: `beforeLogRequest` and `beforeLog` * taps run first, then the entry is saved under `common/temp/telemetry` and passed to `flushTelemetry` taps. * Disposing the engine waits up to 2 seconds for taps that are still running; a tap that takes longer, such as an * upload over a stalled network, keeps running in the background, so that it cannot hold the host. Saving does * nothing when telemetry is disabled for the repository. * * @remarks * `beforeLog` taps describe the latest iteration, so a host logs an iteration's entries before it starts the * next iteration. */ readonly logTelemetry?: (data: ITelemetryData, options?: IPhasedCommandEngineLogTelemetryOptions) => void; } /** * Options for `IPhasedCommandEngine.logTelemetry`. * @alpha */ export declare interface IPhasedCommandEngineLogTelemetryOptions { /** * Whether a graph iteration served the request. If `false`, as for a request that the warm graph answered * without an iteration, `beforeLog` taps are skipped, because they would describe an earlier iteration; * `beforeLogRequest` taps still run. Defaults to `true`. */ readonly servedByIteration?: boolean; } /** * Presentation and scheduling settings of one parsed command. They do not affect the operation graph or any * operation hash, so they are not part of `PhasedCommandEngine.parameterIdentity`; hosts apply them to the * shared graph (`IOperationGraph.quietMode` / `IOperationGraph.parallelism`) and to the iteration before each * iteration. * @alpha */ export declare interface IPhasedCommandEngineRequestSettings { readonly quietMode: boolean; readonly parallelism: Parallelism; /** * False for a command that runs every selected operation, such as `rebuild`. Hosts pass it to the iteration * (`IOperationGraphIterationOptions.isIncrementalBuildAllowed`), because an engine created by an incremental * command can serve such a command; see `PhasedCommandEngine.getEngineSharingBlocker`. */ readonly isIncrementalBuildAllowed: boolean; } /** * How the reason that `PhasedCommandEngine.getEngineSharingBlocker` returns names the command that created the engine * and the requested command, for example `"build"` or `the earlier "test"`. * @alpha */ export declare interface IPhasedCommandEngineSharingLabels { /** Names the command that created the engine. */ readonly engine: string; /** Names the requested command. */ readonly request: string; } /** * The results of one request served by a long-lived engine. * @alpha */ export declare interface IPhasedCommandEngineTelemetryOptions { /** The results of the request's selected operations. Silent operations are omitted from the entry. */ readonly records: ReadonlyMap; /** Whether the request succeeded. As for a native command, only a `Success` status counts as success. */ readonly succeeded: boolean; /** How long the request's graph iteration took, in seconds. */ readonly durationInSeconds: number; /** A `performance.now()` value. Operation and performance entry times are reported relative to it. */ readonly timeOriginMs: number; /** Host-specific fields, added after the native fields. */ readonly extraData?: Readonly>; /** The request's performance entries, with `performance.now()` start times. */ readonly performanceEntries?: ReadonlyArray; } /** * One operation's result in a request-scoped telemetry entry. * @alpha */ export declare interface IPhasedCommandEngineTelemetryRecord { /** The operation's status in this request. */ readonly status: OperationStatus; /** Whether the operation's runner is silent. Silent operations are omitted from the entry. */ readonly silent: boolean; /** `performance.now()` values for when the operation started and ended in this request. */ readonly stopwatch: { readonly startTime: number | undefined; readonly endTime: number | undefined; }; /** How long the operation would have taken without the build cache. */ readonly nonCachedDurationMs: number | undefined; } /** * A plugin that interacts with a phased commands. * @alpha */ export declare interface IPhasedCommandPlugin { /** * Applies this plugin. */ apply(hooks: PhasedCommandHooks): void; } /** * Possible values for the `pnpmLockfilePolicies` setting in Rush's pnpm-config.json file. * @public */ export declare interface IPnpmLockfilePolicies { /** * Forbid sha1 hashes in `pnpm-lock.yaml` */ disallowInsecureSha1?: { enabled: boolean; exemptPackageVersions: Record; }; } /** * Part of IRushConfigurationJson. * @internal */ export declare interface _IPnpmOptionsJson extends IPackageManagerOptionsJsonBase { $schema?: string; /** * {@inheritDoc PnpmOptionsConfiguration.pnpmStore} */ pnpmStore?: PnpmStoreLocation; /** * {@inheritDoc PnpmOptionsConfiguration.strictPeerDependencies} */ strictPeerDependencies?: boolean; /** * {@inheritDoc PnpmOptionsConfiguration.preventManualShrinkwrapChanges} */ preventManualShrinkwrapChanges?: boolean; /** * {@inheritDoc PnpmOptionsConfiguration.useWorkspaces} */ useWorkspaces?: boolean; /** * {@inheritDoc PnpmOptionsConfiguration.globalOverrides} */ globalOverrides?: Record; /** * {@inheritDoc PnpmOptionsConfiguration.globalPeerDependencyRules} */ globalPeerDependencyRules?: IPnpmPeerDependencyRules; /** * {@inheritDoc PnpmOptionsConfiguration.globalPackageExtensions} */ globalPackageExtensions?: Record; /** * {@inheritDoc PnpmOptionsConfiguration.globalNeverBuiltDependencies} */ globalNeverBuiltDependencies?: string[]; /** * {@inheritDoc PnpmOptionsConfiguration.globalOnlyBuiltDependencies} */ globalOnlyBuiltDependencies?: string[]; /** * {@inheritDoc PnpmOptionsConfiguration.globalAllowBuilds} */ globalAllowBuilds?: Record; /** * {@inheritDoc PnpmOptionsConfiguration.globalIgnoredOptionalDependencies} */ globalIgnoredOptionalDependencies?: string[]; /** * {@inheritDoc PnpmOptionsConfiguration.globalAllowedDeprecatedVersions} */ globalAllowedDeprecatedVersions?: Record; /** * {@inheritDoc PnpmOptionsConfiguration.globalPatchedDependencies} */ globalPatchedDependencies?: Record; /** * {@inheritDoc PnpmOptionsConfiguration.unsupportedPackageJsonSettings} */ unsupportedPackageJsonSettings?: unknown; /** * {@inheritDoc PnpmOptionsConfiguration.resolutionMode} */ resolutionMode?: PnpmResolutionMode; /** * {@inheritDoc PnpmOptionsConfiguration.autoInstallPeers} */ autoInstallPeers?: boolean; /** * {@inheritDoc PnpmOptionsConfiguration.minimumReleaseAgeMinutes} */ minimumReleaseAgeMinutes?: number; /** * @deprecated Use `minimumReleaseAgeMinutes` instead. */ minimumReleaseAge?: number; /** * {@inheritDoc PnpmOptionsConfiguration.minimumReleaseAgeExclude} */ minimumReleaseAgeExclude?: string[]; /** * {@inheritDoc PnpmOptionsConfiguration.trustPolicy} */ trustPolicy?: PnpmTrustPolicy; /** * {@inheritDoc PnpmOptionsConfiguration.trustPolicyExclude} */ trustPolicyExclude?: string[]; /** * {@inheritDoc PnpmOptionsConfiguration.trustPolicyIgnoreAfterMinutes} */ trustPolicyIgnoreAfterMinutes?: number; /** * {@inheritDoc PnpmOptionsConfiguration.alwaysInjectDependenciesFromOtherSubspaces} */ alwaysInjectDependenciesFromOtherSubspaces?: boolean; /** * {@inheritDoc PnpmOptionsConfiguration.alwaysFullInstall} */ alwaysFullInstall?: boolean; /** * {@inheritDoc PnpmOptionsConfiguration.pnpmLockfilePolicies} */ pnpmLockfilePolicies?: IPnpmLockfilePolicies; /** * {@inheritDoc PnpmOptionsConfiguration.globalCatalogs} */ globalCatalogs?: Record>; } /** * @public */ export declare interface IPnpmPackageExtension { dependencies?: Record; optionalDependencies?: Record; peerDependencies?: Record; peerDependenciesMeta?: IPnpmPeerDependenciesMeta; } /** * @public */ export declare interface IPnpmPeerDependenciesMeta { [packageName: string]: { optional?: boolean; }; } /** * @public */ export declare interface IPnpmPeerDependencyRules { ignoreMissing?: string[]; allowAny?: string[]; allowedVersions?: Record; } export { IPrefixMatch } /** * @internal */ export declare type _IProjectBuildCacheOptions = _IOperationBuildCacheOptions & { /** * Value from rush-project.json */ projectOutputFolderNames: ReadonlyArray; /** * The project to be cached. */ project: RushConfigurationProject; /** * The hash of all relevant inputs and configuration that uniquely identifies this execution. */ operationStateHash: string; /** * The name of the phase that is being cached. */ phaseName: string; }; export { IReporterEventScope } export { IReporterEventSink } /** * Information about the currently executing command provided to plugins. * @beta */ export declare interface IRushCommand { /** * The name of this command, as seen on the command line */ readonly actionName: string; } /** * The full spec of an available Rush command line action * * @beta */ export declare interface IRushCommandLineAction { actionName: string; parameters: IRushCommandLineParameter[]; } /** * Information about the available parameters associated with a Rush action * * @beta */ export declare interface IRushCommandLineParameter { /** * The corresponding string representation of CliParameterKind */ readonly kind: keyof typeof CommandLineParameterKind; /** * The long name of the flag including double dashes, e.g. "--do-something" */ readonly longName: string; /** * An optional short name for the flag including the dash, e.g. "-d" */ readonly shortName?: string; /** * Documentation for the parameter that will be shown when invoking the tool with "--help" */ readonly description: string; /** * If true, then an error occurs if the parameter was not included on the command-line. */ readonly required?: boolean; /** * If provided, this parameter can also be provided by an environment variable with the specified name. */ readonly environmentVariable?: string; } /** * The full spec of a Rush CLI * * @beta */ export declare interface IRushCommandLineSpec { actions: IRushCommandLineAction[]; } /** * This represents the JSON data structure for the "rush.json" configuration file. * See rush.schema.json for documentation. */ declare interface IRushConfigurationJson { $schema: string; npmVersion?: string; pnpmVersion?: string; yarnVersion?: string; rushVersion: string; repository?: IRushRepositoryJson; nodeSupportedVersionRange?: string; nodeSupportedVersionInstructions?: string; suppressNodeLtsWarning?: boolean; suppressRushIsPublicVersionCheck?: boolean; projectFolderMinDepth?: number; projectFolderMaxDepth?: number; allowMostlyStandardPackageNames?: boolean; approvedPackagesPolicy?: IApprovedPackagesPolicyJson; gitPolicy?: IRushGitPolicyJson; telemetryEnabled?: boolean; daemon?: IDaemonConfigurationJson; allowedProjectTags?: string[]; projects: IRushConfigurationProjectJson[]; eventHooks?: IEventHooksJson; hotfixChangeEnabled?: boolean; npmOptions?: _INpmOptionsJson; pnpmOptions?: _IPnpmOptionsJson; yarnOptions?: _IYarnOptionsJson; ensureConsistentVersions?: boolean; variants?: IRushVariantOptionsJson[]; reporting?: IRushReportingConfigurationJson; } /** * @beta */ export declare type IRushConfigurationProjectForSnapshot = Pick; /** * This represents the JSON data object for a project entry in the rush.json configuration file. */ declare interface IRushConfigurationProjectJson { packageName: string; projectFolder: string; reviewCategory?: string; decoupledLocalDependencies: string[]; cyclicDependencyProjects?: string[]; versionPolicyName?: string; shouldPublish?: boolean; skipRushCheck?: boolean; publishFolder?: string; tags?: string[]; subspaceName?: string; } /** * @internal */ declare interface IRushConfigurationProjectOptions { /** * The raw JSON representation from rush.json */ projectJson: IRushConfigurationProjectJson; /** * The enclosing configuration */ rushConfiguration: RushConfiguration; /** * A unique string name for this project */ tempProjectName: string; /** * If specified, validate project tags against this list. */ allowedProjectTags: Set | undefined; /** * The containing subspace. */ subspace: Subspace; } export { IRushDiagnostic } /** * Part of IRushConfigurationJson. */ declare interface IRushGitPolicyJson { allowedEmailRegExps?: string[]; sampleEmail?: string; versionBumpCommitMessage?: string; changeLogUpdateCommitMessage?: string; changefilesCommitMessage?: string; tagSeparator?: string; } /** @alpha */ export declare interface IRushPhaseSharding { /** * The number of shards to create. */ count: number; /** * The format of the argument to pass to the command to indicate the shard index and count. * * @defaultValue `--shard={shardIndex}/{shardCount}` */ shardArgumentFormat?: string; /** * An optional argument to pass to the command to indicate the output folder for the shard. * It must end with `{shardIndex}`. * * @defaultValue `--shard-output-folder=.rush/operations/{phaseName}/shards/{shardIndex}`. */ outputFolderArgumentFormat?: string; /** * @deprecated Create a separate operation settings object for the shard operation settings with the name `{operationName}:shard`. */ shardOperationSettings?: unknown; } /** * @beta */ export declare interface IRushPlugin { apply(rushSession: RushSession, rushConfiguration: RushConfiguration): void; } declare interface IRushPluginConfiguration extends _IRushPluginConfigurationBase { autoinstallerName: string; } /** * @internal */ export declare interface _IRushPluginConfigurationBase { packageName: string; pluginName: string; } declare interface IRushPluginsConfigurationJson { plugins: IRushPluginConfiguration[]; } /** * Describes the file structure for the `/config/rush-project.json` config file. * @internal */ export declare interface _IRushProjectJson { /** * The incremental analyzer can skip Rush commands for projects whose input files have * not changed since the last build. Normally, every Git-tracked file under the project * folder is assumed to be an input. Set incrementalBuildIgnoredGlobs to ignore specific * files, specified as globs relative to the project folder. The list of file globs will * be interpreted the same way your .gitignore file is. */ incrementalBuildIgnoredGlobs?: string[]; /** * Disable caching for this project. The project will never be restored from cache. * This may be useful if this project affects state outside of its folder. * * This option is only used when the build cache is enabled for the repo. You can set * disableBuildCacheForProject=true to disable caching for a specific project. This is a useful workaround * if that project's build scripts violate the assumptions of the cache, for example by writing * files outside the project folder. Where possible, a better solution is to improve the build scripts * to be compatible with caching. */ disableBuildCacheForProject?: boolean; operationSettings?: IOperationSettings[]; } /** * Repository settings used by the Rush reporter system. * @beta */ export declare interface IRushReportingConfiguration { /** * Additional environment variable names that identify an agent environment. */ readonly agentEnvironmentVariables: readonly string[]; } declare interface IRushReportingConfigurationJson { agentEnvironmentVariables?: string[]; } declare type IRushRepositoryJson = IRushRepositoryJsonSingleUrl | IRushRepositoryJsonMultipleUrls; /** * Part of IRushConfigurationJson. */ declare interface IRushRepositoryJsonBase { /** * The default branch name. This tells "rush change" which remote branch to compare against. */ defaultBranch?: string; /** * The default remote. This tells "rush change" which remote to compare against if the remote URL is not set * or if a remote matching the provided remote URL is not found. */ defaultRemote?: string; } declare interface IRushRepositoryJsonMultipleUrls extends IRushRepositoryJsonBase { /** * Remote url(s) of the repository. If a value is provided, \"rush change\" will * use one of these to find the right remote to compare against. Specifying multiple URLs * is useful if a GitHub repository is renamed or for `.visualstudio.com` versus * `dev.azure.com/` URLs. */ urls?: string[]; } declare interface IRushRepositoryJsonSingleUrl extends IRushRepositoryJsonBase { /** * The remote url of the repository. If a value is provided, * \"rush change\" will use it to find the right remote to compare against. * * @deprecated Use "urls" instead. */ url?: string; } /** * @beta */ export declare interface IRushSessionOptions { terminalProvider: ITerminalProvider; getIsDebugMode: () => boolean; /** * The optional structured reporter channel for this session. * * @remarks * When omitted, scoped reporter APIs return `undefined` and legacy terminal * behavior remains unchanged. */ reporter?: IRushSessionReporterOptions; } /** * The reporter channel supplied by the Rush frontend for a single Rush session. * * @remarks * The frontend owns reporter selection and the concrete reporter instances. Rush * only receives this presentation-free sink and binds producer identities before * exposing scoped reporters to actions and plugins. * * @beta */ export declare interface IRushSessionReporterOptions { /** * The typed event sink owned by the Rush frontend. */ readonly eventSink: IReporterEventSink; /** * The identifier assigned to this Rush session by the frontend. */ readonly sessionId: string; /** * Enables raw semantic operation events for the pre-major reporter opt-in path. * * @remarks * When false or omitted, Rush retains the shadow lifecycle-only behavior and * does not tap operation output. * * @internal */ readonly operationStreamEnabled?: boolean; /** * Enables negotiated reporting for compatible child processes. * * @internal */ readonly childProcessReporter?: { readonly requestId: string; readonly context: IReporterChildContext; readonly ingestForeignEnvelope: (envelope: IReporterEventEnvelope) => string; }; /** * Flushes and closes the frontend-owned reporters before an explicit process exit. * * @internal */ readonly flushAsync?: () => Promise; } /** * Options defining an allowed variant as part of IRushConfigurationJson. */ declare interface IRushVariantOptionsJson { variantName: string; description: string; } /** Native Rushx arguments. Options after the command belong to the script. @beta */ export declare interface IRushXCommandLineArguments { /** * Flag indicating whether to suppress any rushx startup information. */ quiet: boolean; /** * Flag indicating whether the user has asked for help. */ help: boolean; /** * Flag indicating whether the user has requested debug mode. */ isDebug: boolean; /** * Flag indicating whether the user wants to not call hooks. */ ignoreHooks: boolean; /** * The command to run (i.e., the target "script" in package.json.) */ commandName: string; /** * Any additional arguments/parameters passed after the command name. */ commandArgs: string[]; } /** Explicit process state and an optional owned asynchronous spawn seam for native Rushx. @beta */ export declare interface IRushXCommandOptions { /** Parse before dotenv initialization, as the native frontend does. */ readonly arguments: IRushXCommandLineArguments; readonly abortSignal?: AbortSignal; readonly cwd: string; readonly environment: Readonly; readonly rushConfiguration: RushConfiguration | undefined; /** The caller-validated governing configuration path in the invocation's namespace, including Windows aliases. */ readonly rushJsonFilePath?: string; readonly terminal: ITerminal; /** Console output preserves native ANSI and newline bytes independently of diagnostic terminal capabilities. */ readonly consoleTerminal: ITerminal; readonly launchOptions: ILaunchOptions; /** When omitted, preserves the native CLI's synchronous inherited-stdio execution. */ readonly spawn?: (command: string, args: ReadonlyArray, options: child_process.SpawnOptions) => child_process.ChildProcess; } export { IScopedLogger } export { IScopedMessageOptions } export { IScopedReporter } /** * Output files that were cloned into a staging folder. */ declare interface ISealedOutputs { /** The staging folder, which the paths of the files are relative to */ readonly folderPath: string; readonly fileCount: number; readonly byteCount: number; /** * True if some of the files were still being cloned when the outputs were returned. They are cloned in the * background, and the build cache entry is written only if none of them changed before it was cloned. */ readonly isSealing?: boolean; } declare interface ISealOutputsOptions { /** The common temp folder of the repository, which holds the staging folder */ readonly commonTempFolder: string; /** The folder that `relativePaths` are relative to */ readonly sourceFolderPath: string; readonly relativePaths: ReadonlyArray; /** Gets a line if the files can't be sealed */ readonly terminal: ITerminal; } /** * Represents a readonly view of a `Stopwatch`. * @beta */ export declare interface IStopwatchResult { /** * Displays how long the stopwatch has been executing in a human readable format. */ toString(): string; /** * Get the duration in seconds. */ get duration(): number; /** * Return the start time of the most recent stopwatch run. */ get startTime(): number | undefined; /** * Return the end time of the most recent stopwatch run. */ get endTime(): number | undefined; } /** * @internal */ declare interface ISubspaceOptions { subspaceName: string; rushConfiguration: RushConfiguration; splitWorkspaceCompatibility: boolean; } /** * @beta */ export declare interface ITelemetryData { /** * Command name * @example `"build"` */ readonly name: string; /** * Duration in seconds */ readonly durationInSeconds: number; /** * The result of the command */ readonly result: 'Succeeded' | 'Failed'; /** * The millisecond-resolution timestamp of the telemetry logging * @example 1648001893024 */ readonly timestampMs?: number; /** * The platform the command was executed on, based on the Node.js `process.platform()` API * @example `"darwin"`, `"win32"`, `"linux"` */ readonly platform?: string; /** * The Rush version * @example `5.63.0` */ readonly rushVersion?: string; /** * Detailed information about the host machine. */ readonly machineInfo?: ITelemetryMachineInfo; /** * Only applicable to phased commands. Provides detailed results by operation. * Keys are operation names, values contain result, timing information, and dependencies. */ readonly operationResults?: Record; readonly extraData?: { [key: string]: string | number | boolean; }; /** * Performance marks and measures collected during the execution of this command. * This is an array of `PerformanceEntry` objects, which can include marks, measures, and function timings. */ readonly performanceEntries?: readonly PerformanceEntry_2[]; /** * The allowlisted projection derived from shadow reporter events. * * @remarks * This is present only when the Rush frontend supplied a reporter event sink. * It never contains messages, paths, arguments, raw output, remediation * parameters, stack traces, or non-public envelope metadata. */ readonly reporterData?: ITelemetryAggregate; } /** * @beta */ export declare interface ITelemetryMachineInfo { /** * The CPU architecture * @example `"AMD64"` */ machineArchitecture: string; /** * The CPU model * * @example `"AMD Ryzen 7 3700X 8-Core Processor"` */ machineCpu: string; /** * The number of logical CPU cores. */ machineCores: number; /** * The total amount of RAM on the machine, in MiB. */ machineTotalMemoryMiB: number; /** * The amount of free RAM on the machine at the end of execution, in MiB. */ machineFreeMemoryMiB: number; } /** * @beta */ export declare interface ITelemetryOperationResult { /** * The names of operations that this operation depends on. */ dependencies: string[]; /** * The status code for the operation. */ result: string; /** * A timestamp in milliseconds (from `performance.now()`) when the operation started. * If the operation was blocked, will be `undefined`. */ startTimestampMs?: number; /** * A timestamp in milliseconds (from `performance.now()`) when the operation finished. * If the operation was blocked, will be `undefined`. */ endTimestampMs?: number; /** * Duration in milliseconds when the operation does not hit cache */ nonCachedDurationMs?: number; /** * Was this operation built on this machine? If so, the duration can be calculated from `startTimestampMs` and `endTimestampMs`. * If not, you should use the metrics from the machine that built it. */ wasExecutedOnThisMachine?: boolean; } /** * Options for `RushConfiguration.tryFindRushJsonLocation`. * @public */ export declare interface ITryFindRushJsonLocationOptions { /** * Whether to show verbose console messages. Defaults to false. */ showVerbose?: boolean; /** * The folder path where the search will start. Defaults to the current working directory. */ startingFolder?: string; } /** * This interface represents the `dependencies` field in a version policy JSON object, * allowing repo maintainers to specify how dependencies' versions should be handled * during publishing and committing. * @public */ declare interface IVersionPolicyDependencyJson { versionFormatForPublish?: VersionFormatForPublish; versionFormatForCommit?: VersionFormatForCommit; } /** * This interface represents the raw version policy JSON object which allows repo * maintainers to define how different groups of projects will be published by Rush, * and how their version numbers will be determined. * @public */ export declare interface IVersionPolicyJson { policyName: string; definitionName: string; dependencies?: IVersionPolicyDependencyJson; exemptFromRushChange?: boolean; includeEmailInChangeFile?: boolean; } /** Stable inputs which distinguish reusable, reloadable, and process-bound workspace state. @alpha */ export declare interface IWorkspaceInputFingerprint { readonly configurationHash: string; readonly environmentHash: string; readonly installationHash: string; /** * The Node.js executable and version, the running Rush package, the host's `runtimePaths`, and the installed * package folder of every configured Rush plugin. A change requires a new process. */ readonly runtimeHash: string; readonly selectedRushVersion: string; } /** Options for capturing workspace definition inputs, not ordinary project source/output files. @alpha */ export declare interface IWorkspaceInputFingerprintOptions { readonly rushConfiguration: RushConfiguration; readonly environment: Readonly>; /** Additional implementation files/folders owned by the embedding host. */ readonly runtimePaths?: ReadonlyArray; /** * Invocation-owner cache for file digests. Workspace definitions are always compared by content: a cached * digest is reused only for a file that had stopped changing before it was read (see * {@link WorkspaceRuntimeFingerprintCache}). */ readonly runtimeCache?: WorkspaceRuntimeFingerprintCache; } /** * Part of IRushConfigurationJson. * @internal */ export declare interface _IYarnOptionsJson extends IPackageManagerOptionsJsonBase { /** * If true, then Rush will add the "--ignore-engines" option when invoking Yarn. * This allows "rush install" to succeed if there are dependencies with engines defined in * package.json which do not match the current environment. * * The default value is false. */ ignoreEngines?: boolean; } /** * This policy indicates all related projects should use the same version. * @public */ export declare class LockStepVersionPolicy extends VersionPolicy { #private; /** * @internal */ readonly _json: ILockStepVersionJson; /** * The type of bump for next bump. */ get nextBump(): BumpType | undefined; /** * The main project for the version policy. * * If the value is provided, change logs will only be generated in that project. * If the value is not provided, change logs will be hosted in each project associated with the policy. */ get mainProject(): string | undefined; /** * @internal */ constructor(versionPolicyJson: ILockStepVersionJson); /** * The value of the lockstep version */ get version(): string; /** * Returns an updated package json that satisfies the version policy. * * @param project - input package json * @param force - force update even when the project version is higher than the policy version. */ ensure(project: IPackageJson, force?: boolean): IPackageJson | undefined; /** * Bumps the version of the lockstep policy * * @param bumpType - Overwrite bump type in version-policy.json with the provided value. * @param identifier - Prerelease identifier if bump type is prerelease. */ bump(bumpType?: BumpType, identifier?: string): void; /** * Updates the version of the policy directly with a new value * @param newVersionString - New version */ update(newVersionString: string): boolean; /** * Validates the specified version and throws if the version does not satisfy lockstep version. * * @param versionString - version string * @param packageName - package name */ validate(versionString: string, packageName: string): void; } export { LookupByPath } /** * The granularity at which the Node.js version is included in the build cache hash. * * - `"major"` - includes only the major version (e.g. `18`) * - `"minor"` - includes the major and minor version (e.g. `18.17`) * - `"patch"` - includes the full version (e.g. `18.17.1`) * * @alpha */ export declare type NodeVersionGranularity = 'major' | 'minor' | 'patch'; /** * Options that are only used when the NPM package manager is selected. * * @remarks * It is valid to define these options in rush.json even if the NPM package manager * is not being used. * * @public */ export declare class NpmOptionsConfiguration extends PackageManagerOptionsConfigurationBase { /** @internal */ constructor(json: _INpmOptionsJson); } /** * The `Operation` class is a node in the dependency graph of work that needs to be scheduled by the * `OperationGraph`. Each `Operation` has a `runner` member of type `IOperationRunner`, whose * implementation manages the actual process of running a single operation. * * The graph of `Operation` instances will be cloned into a separate execution graph after processing. * * @alpha */ export declare class Operation { /** * The Rush phase associated with this Operation */ readonly associatedPhase: IPhase; /** * The Rush project associated with this Operation */ readonly associatedProject: RushConfigurationProject; /** * A set of all operations which depend on this operation. */ readonly consumers: ReadonlySet; /** * A set of all dependencies which must be executed before this operation is complete. */ readonly dependencies: ReadonlySet; /** * This property is used in the name of the filename for the logs generated by this * operation. This is a filesystem-safe version of the phase name. For example, * an operation for a phase with name `_phase:compile` has a `logFilenameIdentifier` of `_phase_compile`. */ logFilenameIdentifier: string; /** * When the scheduler is ready to process this `Operation`, the `runner` implements the actual work of * running the operation. */ runner: IOperationRunner | undefined; /** * The concurrency weight for this operation. When coerced to an integer via `coerceParallelism`, * this value represents how many concurrency slots the operation consumes while running. * * May be specified as: * - A raw `number`: used directly as the slot count (e.g. `2` consumes two slots). * - An `IParallelismScalar` (e.g. `{ scalar: 0.5 }`): coerced relative to the graph's * configured `maxParallelism` at execution time, so the weight scales with the available * concurrency rather than being fixed at parse time. * * Coerced values guide scheduling as follows: * - `1` slot: typical operation consuming one logical thread. * - `> 1` slots: operation that spawns multiple threads or requires significant RAM; reserving * extra slots prevents overloading the machine (e.g. a whole-program bundler or a test suite * that runs its own internal parallelism). * - `0` slots: effectively free (e.g. a no-op or cache-restore step). */ weight: Parallelism; /** * Get the operation settings for this operation, defaults to the values defined in * the project configuration. */ settings: IOperationSettings | undefined; /** * If set to false, this operation will be skipped during evaluation (return OperationStatus.Skipped). * This is useful for plugins to alter the scope of the operation graph across executions, * e.g. to enable or disable unit test execution, or to include or exclude dependencies. * * The special value "ignore-dependency-changes" can be used to indicate that this operation should only * be executed if there are local changes in the project. This is useful for operations like * "test" where you may want to skip testing projects that haven't changed. * * The default value is `true`, meaning the operation will be executed if it or any dependencies change. */ enabled: OperationEnabledState; constructor(options: IOperationOptions); /** * The name of this operation, for logging. */ get name(): string; /** * If set to true, this operation is considered a no-op and can be considered always skipped for analysis purposes. */ get isNoOp(): boolean; /** * Adds the specified operation as a dependency and updates the consumer list. */ addDependency(dependency: Operation): void; /** * Deletes the specified operation as a dependency and updates the consumer list. */ deleteDependency(dependency: Operation): void; } /** * @internal */ export declare class _OperationBuildCache { #private; private constructor(); get cacheId(): string | undefined; static getOperationBuildCache(options: _IProjectBuildCacheOptions): _OperationBuildCache; static forOperation(executionResult: IBaseOperationExecutionResult, options: _IOperationBuildCacheOptions): _OperationBuildCache; tryRestoreFromCacheAsync(terminal: ITerminal, specifiedCacheId?: string): Promise; /** * Writes the build cache entry for the output files of the operation. * * @param deferredCacheEntryWrites - If specified, the output files are sealed, and the entry is written from them * in the background, so that this resolves as soon as they are sealed. If they can't be sealed, the entry is * written before this resolves, as it is without this parameter. */ trySetCacheEntryAsync(terminal: ITerminal, specifiedCacheId?: string, deferredCacheEntryWrites?: DeferredCacheEntryWrites): Promise; } /** * State for the `enabled` property of an `Operation`. * * - `true`: The operation should be executed if it or any dependencies changed. * - `false`: The operation should be skipped. * - `"ignore-dependency-changes"`: The operation should be executed if there are local changes in the project, * otherwise it should be skipped. This is useful for operations like "test" where you may want to skip * testing projects that haven't changed. * @alpha */ export declare type OperationEnabledState = boolean | 'ignore-dependency-changes'; /** * Hooks into the execution process for operations within the graph. * * Per-iteration lifecycle: * 1. `configureIteration` - Synchronously decide which operations to enable for the next iteration. * 2. `onIterationScheduled` - Fires after the iteration is prepared but before execution begins, if it has any enabled operations. * 3. `beforeExecuteIterationAsync` - Async hook that can bail out the iteration entirely. * 4. Operations execute (status changes reported via `onExecutionStatesUpdated`). If another request joins the * iteration, `configureIteration` plans the iteration again, with `startedOperations` naming the operations that * were already dispatched. If the graph accepts the new plan, `extendIteration` prepares the operations that * changed. * 5. `afterExecuteIterationAsync` - Fires after all operations in the iteration have settled. * 6. `afterExecuteRequestAsync` - Fires once for each request that the iteration served. * 7. `onIdle` - Fires when the graph enters idle state awaiting changes (watch mode only). * * Additional hooks: * - `onEnableStatesChanged` - Fires when `setEnabledStates` mutates operation enabled flags. * - `onInvalidateOperations` - Fires when operations are invalidated (e.g. by file watchers). * - `onGraphStateChanged` - Fires on any observable graph state change. * * @alpha */ export declare class OperationGraphHooks { /** * Hook invoked to decide what work a potential new iteration contains. * Use the `lastExecutedRecords` to determine which operations are new or have had their inputs changed. * Set `enabled` and `shouldRunnerPersist` on the values in `initialRecords` to control which operations * execute and which runners remain active after their operation completes. * * @remarks * This hook is synchronous to guarantee that the `lastExecutedRecords` map remains stable for the * duration of configuration. This hook often executes while an execution iteration is currently running, so * operations could complete if there were async ticks during the configuration phase. * * If no operations are marked for execution, the iteration will not be scheduled. * If there is an existing scheduled iteration, it will remain. * * When `context.startedOperations` is set, the call plans an iteration that is already executing again, for the * work of a request that joins it (see {@link IOperationGraph.tryExtendCurrentIteration}). The graph can still * refuse that plan after this hook returns, and then discards it. A plugin that keeps state across iterations * applies the effects of such a plan in `extendIteration`, which is called only for an accepted plan. */ readonly configureIteration: SyncHook<[ ReadonlyMap, ReadonlyMap, IOperationGraphIterationOptions ]>; /** * Hook invoked when the work of another request is added to an iteration that is already executing (see * {@link IOperationGraph.tryExtendCurrentIteration}), before any of the given records is dispatched. It receives the * records whose `enabled` state, runner policy or state hash changed, and the options of the extension, whose * `inputsSnapshot` is the newer snapshot that the state hashes of these records were calculated from. A plugin that * prepares state for each operation in `beforeExecuteIterationAsync` prepares it again here for these records. * * The options are the same object that the `configureIteration` call of the accepted plan received. A tap that * throws aborts the iteration. */ readonly extendIteration: SyncHook<[ ReadonlyMap, IOperationGraphIterationOptions ]>; /** * Hook invoked before operation start for an iteration. Allows a plugin to perform side-effects or * short-circuit the entire iteration. * * If any tap returns an {@link OperationStatus}, the remaining taps are skipped and the iteration will * end immediately with that status. Operations which have not yet executed are marked Skipped if the * returned status is successful (e.g. `Success`, `FromCache`, `NoOp`); otherwise they are marked Aborted. */ readonly beforeExecuteIterationAsync: AsyncSeriesBailHook<[ ReadonlyMap, IOperationGraphIterationOptions ], OperationStatus | undefined | void>; /** * Batched hook invoked when one or more operation statuses have changed during the same microtask. * The hook receives an array of the operation execution results that changed status. * @remarks * This hook is batched to reduce noise when updating many operations synchronously in quick succession. */ readonly onExecutionStatesUpdated: SyncHook<[ReadonlySet]>; /** * Hook invoked when one or more operations have their enabled state mutated via * {@link IOperationGraph.setEnabledStates}. Provides the set of operations whose * enabled state actually changed. */ readonly onEnableStatesChanged: SyncHook<[ReadonlySet]>; /** * Hook invoked immediately after a new execution iteration is scheduled (i.e. operations selected and prepared), * before any operations in that iteration have started executing. Can be used to snapshot planned work, * drive UIs, or pre-compute auxiliary data. */ readonly onIterationScheduled: SyncHook<[ReadonlyMap]>; /** * Hook invoked when any observable state on the operation graph changes. * This includes configuration mutations (parallelism, quiet/debug modes, pauseNextIteration) * as well as dynamic state (status transitions, scheduled iteration availability, etc.). * Hook is series for stable output. */ readonly onGraphStateChanged: SyncHook<[IOperationGraph]>; /** * Hook invoked when operations are invalidated for any reason. */ readonly onInvalidateOperations: SyncHook<[Iterable, string | undefined]>; /** * Releases plugin-held completed-iteration state before idle result deletion. * The graph rejects active/prepared iterations before invoking this hook. A thrown cleanup error * prevents result deletion. Only invoked by hosts explicitly using `deleteResults()`. */ readonly beforeDeleteResults: SyncHook<[ReadonlySet]>; /** * Hook invoked after an iteration has finished and the command is watching for changes. * May be used to display additional relevant data to the user. * Only relevant when running in watch mode. */ readonly onIdle: SyncHook; /** * Hook invoked after executing a set of operations. * Hook is series for stable output. */ readonly afterExecuteIterationAsync: AsyncSeriesWaterfallHook<[ OperationStatus, ReadonlyMap, IOperationGraphIterationOptions ]>; /** * Hook invoked once for each request for this graph's work, after the operations that the request selected have * settled and before the request's result is reported. Use it instead of `afterExecuteIterationAsync` for work that * describes one command's results, such as a build summary. * * @remarks * A native command makes one request for each iteration, and invokes this hook after * `afterExecuteIterationAsync`, with the iteration's final status and results. * * A long-lived host such as the Rush daemon can serve several requests with one iteration, and it serves a request * whose operations are all up to date without any iteration, so the iteration hooks never fire for that request. * The host invokes this hook once for each request it serves, including those, with only that request's * results. Several requests can be in this hook at the same time. * * A host can also return a failed request as soon as nothing that still runs can change its result. It then * invokes this hook while the iteration runs, and the request's results omit the operations that have not * finished. * * The hook is not invoked for a request that ends without results: one whose iteration throws, or one that a * long-lived host stops serving because its client cancelled the request or disconnected. * * If a tap throws, the request fails with that error. */ readonly afterExecuteRequestAsync: AsyncSeriesHook<[IOperationGraphRequestResult]>; /** * Hook invoked after executing an iteration, before the telemetry entry is written. * Allows the caller to augment or modify the log entry. * * @remarks * Taps describe the iteration that just ran. A long-lived host such as the Rush daemon logs one entry for each * request, and skips this hook for a request that it served without an iteration. Use `beforeLogRequest` for data * that every entry needs. */ readonly beforeLog: SyncHook; /** * Hook invoked before any telemetry entry for this graph's work is written, including the entry of a request that * a long-lived host such as the Rush daemon served without an iteration. Use it instead of `beforeLog` for data * that does not describe an iteration, such as a flag that says that a plugin is active. * * @remarks * A native command invokes this hook for each iteration's entry, before `beforeLog`. A long-lived host invokes it * once for each request that it logs, and invokes `beforeLog` after it only if an iteration served the request. */ readonly beforeLogRequest: SyncHook; /** * Hook invoked before executing a operation. */ readonly beforeExecuteOperationAsync: AsyncSeriesBailHook<[ IOperationRunnerContext & IOperationExecutionResult ], OperationStatus | undefined>; /** * Hook invoked to define environment variables for an operation. * May be invoked by the runner to get the environment for the operation. */ readonly createEnvironmentForOperation: SyncWaterfallHook<[ IEnvironment, IOperationRunnerContext & IOperationExecutionResult ]>; /** * Hook invoked after executing a operation. */ readonly afterExecuteOperationAsync: AsyncSeriesHook<[ IOperationRunnerContext & IOperationExecutionResult ]>; } /** * A helper class for managing the meta files of a operation. * * @internal */ export declare class _OperationMetadataManager { #private; readonly stateFile: _OperationStateFile; readonly logFilenameIdentifier: string; wasCobuilt: boolean; constructor(options: _IOperationMetadataManagerOptions); /** * Returns the relative paths of the metadata files to project folder. * * Example: `.rush/temp/operation/_phase_build/state.json` * Example: `.rush/temp/operation/_phase_build/all.log` * Example: `.rush/temp/operation/_phase_build/error.log` */ get metadataFolderPath(): string; saveAsync({ durationInSeconds, cobuildContextId, cobuildRunnerId, logPath, errorLogPath, logChunksPath }: _IOperationMetadata): Promise; tryRestoreAsync({ terminal, terminalProvider, errorLogPath, cobuildContextId, cobuildRunnerId }: { terminalProvider: ITerminalProvider; terminal: ITerminal; errorLogPath: string; cobuildContextId?: string; cobuildRunnerId?: string; }): Promise; tryRestoreStopwatch(originalStopwatch: IStopwatchResult): IStopwatchResult; } /** * A helper class for managing the state file of a operation. * * @internal */ export declare class _OperationStateFile { #private; /** * The path of the state json file. * * Example: `/code/repo/my-project/.rush/temp/operation/_phase_build/state.json` */ readonly filepath: string; /** * The relative path of the state json file to project folder * * Example: `.rush/temp/operation/_phase_build/state.json` */ readonly relativeFilepath: string; static filename: string; constructor(options: _IOperationStateFileOptions); get state(): _IOperationStateJson | undefined; writeAsync(json: _IOperationStateJson): Promise; tryRestoreAsync(): Promise<_IOperationStateJson | undefined>; } /** * Enumeration defining potential states of an operation * @beta */ export declare enum OperationStatus { /** * The Operation is ready to execute. All its dependencies have succeeded. */ Ready = "READY", /** * The Operation is waiting for one or more dependencies to complete. */ Waiting = "WAITING", /** * The Operation is Queued */ Queued = "QUEUED", /** * The Operation is currently executing */ Executing = "EXECUTING", /** * The Operation completed successfully and did not write to standard output */ Success = "SUCCESS", /** * The Operation completed successfully, but wrote to standard output */ SuccessWithWarning = "SUCCESS WITH WARNINGS", /** * The Operation was skipped via the legacy incremental build logic */ Skipped = "SKIPPED", /** * The Operation had its outputs restored from the build cache */ FromCache = "FROM CACHE", /** * The Operation failed */ Failure = "FAILURE", /** * The Operation could not be executed because one or more of its dependencies failed */ Blocked = "BLOCKED", /** * The Operation was a no-op (for example, it had an empty script) */ NoOp = "NO OP", /** * The Operation was aborted before it could execute. */ Aborted = "ABORTED" } /** * @public */ export declare class PackageJsonDependency { #private; readonly name: string; readonly dependencyType: DependencyType; constructor(name: string, version: string, type: DependencyType, onChange: () => void); get version(): string; setVersion(newVersion: string): void; } /** * @public */ export declare class PackageJsonDependencyMeta { #private; readonly name: string; constructor(name: string, injected: boolean, onChange: () => void); get injected(): boolean; } /** * @public */ export declare class PackageJsonEditor { #private; readonly filePath: string; /** * @internal */ protected constructor(filepath: string, data: IPackageJson); /** * @deprecated Use {@link PackageJsonEditor.loadAsync} method instead. */ static load(filePath: string): PackageJsonEditor; static loadAsync(filePath: string): Promise; static fromObject(object: IPackageJson, filename: string): PackageJsonEditor; get name(): string; get version(): string; /** * The list of dependencies of type DependencyType.Regular, DependencyType.Optional, or DependencyType.Peer. */ get dependencyList(): ReadonlyArray; /** * The list of dependencies of type DependencyType.Dev. */ get devDependencyList(): ReadonlyArray; /** * The list of dependenciesMeta in package.json. */ get dependencyMetaList(): ReadonlyArray; /** * This field is a Yarn-specific feature that allows overriding of package resolution. * * @remarks * See the {@link https://github.com/yarnpkg/rfcs/blob/master/implemented/0000-selective-versions-resolutions.md * | 0000-selective-versions-resolutions.md RFC} for details. */ get resolutionsList(): ReadonlyArray; tryGetDependency(packageName: string): PackageJsonDependency | undefined; tryGetDevDependency(packageName: string): PackageJsonDependency | undefined; addOrUpdateDependency(packageName: string, newVersion: string, dependencyType: DependencyType): void; removeDependency(packageName: string, dependencyType: DependencyType): void; /** * @deprecated Use {@link PackageJsonEditor.saveIfModifiedAsync} method instead. */ saveIfModified(): boolean; saveIfModifiedAsync(): Promise; /** * Get the normalized package.json that represents the current state of the * PackageJsonEditor. This method does not save any changes that were made to the * package.json, but instead returns the object representation of what would be saved * if saveIfModified() is called. */ saveToObject(): IPackageJson; } /** * An abstraction for controlling the supported package managers: PNPM, NPM, and Yarn. * @public */ export declare abstract class PackageManager { /** * The package manager. */ readonly packageManager: PackageManagerName; /** * The SemVer version of the package manager. */ readonly version: string; /** * The filename of the shrinkwrap file that is used by the package manager. * * @remarks * Example: `npm-shrinkwrap.json` or `pnpm-lock.yaml` */ readonly shrinkwrapFilename: string; /** @internal */ protected constructor(version: string, packageManager: PackageManagerName, shrinkwrapFilename: string); } /** * This represents the available Package Manager tools as a string * @public */ export declare type PackageManagerName = 'pnpm' | 'npm' | 'yarn'; /** * Options that all package managers share. * * @public */ export declare abstract class PackageManagerOptionsConfigurationBase implements IPackageManagerOptionsJsonBase { /** * Environment variables for the package manager */ readonly environmentVariables?: IConfigurationEnvironment; /** @internal */ protected constructor(json: IPackageManagerOptionsJsonBase); } /** * A parallelism value, either as an absolute integer count or a scalar fraction of available parallelism. * @beta */ export declare type Parallelism = number | IParallelismScalar; export { parseReporterExtensionEventName } /** * A parsed native phased command, such as build, rebuild or a phased command from command-line.json. * Parsing never runs scripts or changes cwd/process.env. * * @remarks * The initial engine surface deliberately rejects watch/install, build event-hook scripts, .env files, and * external plugins that Rush would initialize for the command or whose command-line.json shapes it, unless * the plugin's manifest (`daemonCompatible`) or the repository (`daemon.compatiblePlugins`) declares that the * plugin supports the engine lifecycle. An engine applies each plugin once and serves many requests: session * hooks, `createOperationsAsync` (with every project and `isWatch` false) and `onGraphCreatedAsync` run once * per engine, operation graph hooks run for each iteration (which can serve several coalesced requests), and * disposal aborts `IOperationGraph.abortController` and then closes every operation runner. Plugins associated * only with other commands are inert and permitted. Native graph/cache plugins are not replaced. * @alpha */ export declare class PhasedCommandEngine { #private; readonly parameterIdentity: string; readonly commandName: string; /** False when every run executes all selected operations: `rebuild`, or `"incremental": false`. */ readonly isIncremental: boolean; /** * Names listed by `daemon.compatiblePlugins` (or `RUSH_DAEMON_COMPATIBLE_PLUGINS`) that match no plugin * configured in rush-plugins.json. They have no effect and are usually misspellings, so hosts should report them. */ readonly unmatchedCompatiblePluginNames: ReadonlyArray; private constructor(); /** * Parses a native phased command line. Throws a {@link PhasedCommandEngineUsageError} for a command line of a * phased command that native Rush rejects as invalid. */ static parseAsync(options: IParsePhasedCommandOptions): Promise; /** * Creates the all-project graph through the native CLI preparation pipeline. * Releases the preparation lock before returning. Hosts must acquire an execution lease around each iteration. * * @param preparationLock - The repository lock that the host already holds. The host keeps it; otherwise the * engine takes the lock itself and releases it before returning. * @param abortSignal - For a host that prepares an engine before any request needs it. Once the signal aborts, the * preparation stops before its next step; a step that has started runs to its end. The partial graph is disposed, * the lock is released unless the host lent it, and the promise rejects with the signal's reason. The parsed * command cannot create an engine again, unless the signal had already aborted when this was called. */ createEngineAsync(preparationLock?: LockFile, abortSignal?: AbortSignal): Promise; /** Resolves native project/phase selection against an existing, compatible graph. */ selectOperationsAsync(graph: IOperationGraph): Promise>; /** Presentation and scheduling settings requested by this command; not part of `parameterIdentity`. */ get requestSettings(): IPhasedCommandEngineRequestSettings; /** * Explains why the engine created by this command cannot serve a request of `request`, or returns undefined if it * can serve it. `rushSession` is the session of an engine created by this command or by `request`. * * @remarks * An engine serves another request of the same command if its graph has the request's operations and the * parameters of the two requests are the same, other than the ones that each request applies to its own iteration * (selection, `requestSettings`, `--ignore-hooks` and `--include-phase-deps`). An engine created by an incremental * command also serves another command, for example `rebuild` on a `build` engine or `build` on a `test` engine, * if: * * - its graph has an operation of every project in each phase that the request selects; * * - the parameters of both commands give the same arguments to the phases that the request can run; * * - the same plugins are associated with both commands, and no plugin taps the `runPhasedCommand` hook of either * command. Rush calls this hook, `initialize` and `runAnyPhasedCommand` once per engine, with the command that * created it, so every tap of `initialize` and `runAnyPhasedCommand` must come from the `apply()` of a plugin * that is declared command-agnostic: its manifest sets `daemonCommandAgnostic`, or the repository lists it in * `daemon.commandAgnosticPlugins` * (or `RUSH_DAEMON_COMMAND_AGNOSTIC_PLUGINS`). * * A request of a command that is not incremental runs each operation that it selects * (`IPhasedCommandEngineRequestSettings.isIncrementalBuildAllowed`). An engine that runs persistent * IPC runners (`daemon.usePersistentIpcRunners`) does not serve it, because those runners serve only * incremental commands. * * If the parameters differ, the reason names each parameter and which command sets it, or that both set it to * different values. `labels` names the two commands in the reason. By default, they are the quoted command names, * or `the engine's "name"` and `the requested "name"` if both commands have the same name. */ getEngineSharingBlocker(request: PhasedCommandEngine, rushSession: RushSession, labels?: IPhasedCommandEngineSharingLabels): string | undefined; /** * Builds the native telemetry entry for one request that this command made of a long-lived engine. * * @remarks * The entry carries this command's own parameters, not those of the command that created the engine, and reports * one initial, non-watch execution, as the native command's entry would. */ createTelemetryData(options: IPhasedCommandEngineTelemetryOptions): ITelemetryData; } /** * Native Rush owns the workspace lock. No engine preparation or iteration has begun. * A later explicit request may retry after that command finishes. * @alpha */ export declare class PhasedCommandEngineBusyError extends Error { constructor(); } /** * A fresh native project configuration no longer matches the engine's graph and cache policy. * The host must recreate the engine before executing more work. * @alpha */ export declare class PhasedCommandEngineConfigurationChangedError extends Error { constructor(); } /** * The engine could not load the native configuration of a project. * * @remarks * An engine loads every project in the workspace, whereas a native command loads only the projects that it * selects. A native command may therefore succeed where the engine cannot, for example after a filtered * install that left the rig package of an unselected project uninstalled. No operation has begun. * @alpha */ export declare class PhasedCommandEngineProjectConfigurationError extends Error { /** The package name of the project whose configuration could not be loaded. */ readonly projectName: string; constructor(projectName: string, cause: unknown); } /** * The command line is not valid for a phased command, for example because it names an unknown parameter. * Native Rush prints the message and exits with {@link PhasedCommandEngineUsageError.exitCode}. * No engine preparation has begun. * @alpha */ export declare class PhasedCommandEngineUsageError extends Error { /** The exit code of native Rush for this command line. */ readonly exitCode: number; /** The usage of the command, which native Rush prints to stdout before the message, if it is known. */ readonly usage: string | undefined; constructor(message: string, exitCode: number, options?: { cause?: unknown; usage?: string; }); } /** * Hooks into the execution process for phased commands. * * Lifecycle: * 1. `createOperationsAsync` - Invoked to populate the set of operations for execution. * 2. `onGraphCreatedAsync` - Invoked after the operation graph is created, allowing plugins to * tap into graph-level hooks (e.g. `configureIteration`, `onIdle`). * See {@link OperationGraphHooks} for the per-iteration lifecycle. * * @alpha */ export declare class PhasedCommandHooks { /** * Hook invoked to create operations for execution. */ readonly createOperationsAsync: AsyncSeriesWaterfallHook<[ Set, ICreateOperationsContext ]>; /** * Hook invoked when the operation graph is created, allowing the plugin to tap into it and interact with it. */ readonly onGraphCreatedAsync: AsyncSeriesHook<[IOperationGraph, IOperationGraphContext]>; } /** * Options that are only used when the PNPM package manager is selected. * Use this class to load "common/config/rush/pnpm-config.json" file, * or, load json from "pnpmOptions" field in "rush.json" for legacy support. * * @remarks * It is valid to define these options in rush.json even if the PNPM package manager * is not being used. * * @public */ export declare class PnpmOptionsConfiguration extends PackageManagerOptionsConfigurationBase { #private; /** * The method used to resolve the store used by PNPM. * * @remarks * Available options: * - local: Use the standard Rush store path: common/temp/pnpm-store * - global: Use PNPM's global store path */ readonly pnpmStore: PnpmStoreLocation; /** * This setting determines how PNPM chooses version numbers during `rush update`. * * @remarks * For example, suppose `lib-x@3.0.0` depends on `"lib-y": "^1.2.3"` whose latest major * releases are `1.8.9` and `2.3.4`. The resolution mode `lowest-direct` might choose * `lib-y@1.2.3`, wheres `highest` will choose 1.8.9, and `time-based` will pick the * highest compatible version at the time when `lib-x@3.0.0` itself was published (ensuring * that the version could have been tested by the maintainer of "lib-x"). For local workspace * projects, `time-based` instead works like `lowest-direct`, avoiding upgrades unless * they are explicitly requested. Although `time-based` is the most robust option, it may be * slightly slower with registries such as npmjs.com that have not implemented an optimization. * * IMPORTANT: Be aware that PNPM 8.0.0 initially defaulted to `lowest-direct` instead of * `highest`, but PNPM reverted this decision in 8.6.12 because it caused confusion for users. * Rush version 5.106.0 and newer avoids this confusion by consistently defaulting to * `highest` when `resolutionMode` is not explicitly set in pnpm-config.json or, for PNPM 10 * and earlier, .npmrc. PNPM 11 and newer ignore this setting in .npmrc. * * PNPM documentation: https://pnpm.io/npmrc#resolution-mode * * Possible values are: `highest`, `time-based`, and `lowest-direct`. * The default is `highest`. */ readonly resolutionMode: PnpmResolutionMode | undefined; /** * The path for PNPM to use as the store directory. * * Will be overridden by environment variable RUSH_PNPM_STORE_PATH */ readonly pnpmStorePath: string; /** * If true, then Rush will add the "--strict-peer-dependencies" option when invoking PNPM. * * @remarks * This causes "rush install" to fail if there are unsatisfied peer dependencies, which is * an invalid state that can cause build failures or incompatible dependency versions. * (For historical reasons, JavaScript package managers generally do not treat this invalid state * as an error.) * * The default value is false. (For now.) */ readonly strictPeerDependencies: boolean; /** * If true, then `rush install` will report an error if manual modifications * were made to the PNPM shrinkwrap file without running `rush update` afterwards. * * @remarks * This feature protects against accidental inconsistencies that may be introduced * if the PNPM shrinkwrap file (`pnpm-lock.yaml`) is manually edited. When this * feature is enabled, `rush update` will write a hash of the shrinkwrap contents to repo-state.json, * and then `rush update` and `rush install` will validate the hash. Note that this does not prohibit * manual modifications, but merely requires `rush update` be run * afterwards, ensuring that PNPM can report or repair any potential inconsistencies. * * To temporarily disable this validation when invoking `rush install`, use the * `--bypass-policy` command-line parameter. * * The default value is false. */ readonly preventManualShrinkwrapChanges: boolean; /** * If true, then Rush will use the workspaces feature to install and link packages when invoking PNPM. * * @remarks * The default value is true. (For now.) */ readonly useWorkspaces: boolean; /** * When true, any missing non-optional peer dependencies are automatically installed. * * @remarks * Rush defaults to false unless explicitly configured. PNPM 10 and earlier can also read * this setting from .npmrc; PNPM 11 and newer require this property instead. */ readonly autoInstallPeers: boolean | undefined; /** * The minimum number of minutes that must pass after a version is published before pnpm will install it. * This setting helps reduce the risk of installing compromised packages, as malicious releases are typically * discovered and removed within a short time frame. * * @remarks * (SUPPORTED ONLY IN PNPM 10.16.0 AND NEWER) * * PNPM documentation: https://pnpm.io/settings#minimumreleaseage * * The default value is 0 (disabled). */ readonly minimumReleaseAgeMinutes: number | undefined; /** * @deprecated Use {@link PnpmOptionsConfiguration.minimumReleaseAgeMinutes} instead. */ get minimumReleaseAge(): number | undefined; /** * List of package names or patterns that are excluded from the minimumReleaseAge check. * These packages will always install the newest version immediately, even if minimumReleaseAgeMinutes is set. * * @remarks * (SUPPORTED ONLY IN PNPM 10.16.0 AND NEWER) * * PNPM documentation: https://pnpm.io/settings#minimumreleaseageexclude * * Example: ["webpack", "react", "\@myorg/*"] */ readonly minimumReleaseAgeExclude: string[] | undefined; /** * The trust policy controls whether pnpm should block installation of package versions where the * trust level has decreased (e.g., a package previously published with provenance is now published * without it). Setting this to `"no-downgrade"` enables the protection. * * @remarks * (SUPPORTED ONLY IN PNPM 10.21.0 AND NEWER) * * PNPM documentation: https://pnpm.io/settings#trustpolicy */ readonly trustPolicy: PnpmTrustPolicy | undefined; /** * List of package names or patterns that are excluded from the trust policy check. * These packages will be allowed to install even if their trust level has decreased. * * @remarks * (SUPPORTED ONLY IN PNPM 10.22.0 AND NEWER) * * PNPM documentation: https://pnpm.io/settings#trustpolicyexclude * * Example: ["webpack", "react", "\@myorg/*"] */ readonly trustPolicyExclude: string[] | undefined; /** * The number of minutes after which pnpm will ignore trust level downgrades. Packages published * longer ago than this threshold will not be blocked even if their trust level has decreased. * * @remarks * (SUPPORTED ONLY IN PNPM 10.27.0 AND NEWER) * * PNPM documentation: https://pnpm.io/settings#trustpolicyignoreafter */ readonly trustPolicyIgnoreAfterMinutes: number | undefined; /** * If true, then `rush update` add injected install options for all cross-subspace * workspace dependencies, to avoid subspace doppelganger issue. * * Here, the injected install refers to PNPM's PNPM's "injected dependencies" * feature. Learn more: https://pnpm.io/package_json#dependenciesmeta * * @remarks * The default value is false. */ readonly alwaysInjectDependenciesFromOtherSubspaces: boolean | undefined; /** * The "globalOverrides" setting provides a simple mechanism for overriding version selections * for all dependencies of all projects in the monorepo workspace. The settings are copied * into the `pnpm.overrides` field of the `common/temp/package.json` file that is generated * by Rush during installation. * * Order of precedence: `.pnpmfile.cjs` has the highest precedence, followed by * `unsupportedPackageJsonSettings`, `globalPeerDependencyRules`, `globalPackageExtensions`, * and `globalOverrides` has lowest precedence. * * PNPM documentation: https://pnpm.io/package_json#pnpmoverrides */ readonly globalOverrides: Record | undefined; /** * The `globalPeerDependencyRules` setting provides various settings for suppressing validation errors * that are reported during installation with `strictPeerDependencies=true`. The settings are copied * into the `pnpm.peerDependencyRules` field of the `common/temp/package.json` file that is generated * by Rush during installation. * * Order of precedence: `.pnpmfile.cjs` has the highest precedence, followed by * `unsupportedPackageJsonSettings`, `globalPeerDependencyRules`, `globalPackageExtensions`, * and `globalOverrides` has lowest precedence. * * https://pnpm.io/package_json#pnpmpeerdependencyrules */ readonly globalPeerDependencyRules: IPnpmPeerDependencyRules | undefined; /** * The `globalPackageExtension` setting provides a way to patch arbitrary package.json fields * for any PNPM dependency of the monorepo. The settings are copied into the `pnpm.packageExtensions` * field of the `common/temp/package.json` file that is generated by Rush during installation. * The `globalPackageExtension` setting has similar capabilities as `.pnpmfile.cjs` but without * the downsides of an executable script (nondeterminism, unreliable caching, performance concerns). * * Order of precedence: `.pnpmfile.cjs` has the highest precedence, followed by * `unsupportedPackageJsonSettings`, `globalPeerDependencyRules`, `globalPackageExtensions`, * and `globalOverrides` has lowest precedence. * * PNPM documentation: https://pnpm.io/package_json#pnpmpackageextensions */ readonly globalPackageExtensions: Record | undefined; /** * The `globalNeverBuiltDependencies` setting suppresses the `preinstall`, `install`, and `postinstall` * lifecycle events for the specified NPM dependencies. This is useful for scripts with poor practices * such as downloading large binaries without retries or attempting to invoke OS tools such as * a C++ compiler. (PNPM's terminology refers to these lifecycle events as "building" a package; * it has nothing to do with build system operations such as `rush build` or `rushx build`.) * The settings are copied into the `pnpm.neverBuiltDependencies` field of the `common/temp/package.json` * file that is generated by Rush during installation. * * PNPM documentation: https://pnpm.io/package_json#pnpmneverbuiltdependencies */ readonly globalNeverBuiltDependencies: string[] | undefined; /** * The `globalOnlyBuiltDependencies` setting specifies an allowlist of dependencies that are permitted * to run build scripts (`preinstall`, `install`, and `postinstall` lifecycle events). This is the inverse * of `globalNeverBuiltDependencies`. In PNPM 10.x, build scripts are disabled by default for security, * so this setting is required to explicitly permit specific packages to run their build scripts. * The settings are copied into the `pnpm.onlyBuiltDependencies` field of the `common/temp/package.json` * file that is generated by Rush during installation. * * (SUPPORTED ONLY IN PNPM 10.1.0 AND NEWER; replaced by `globalAllowBuilds` in PNPM 11.0.0) * * PNPM documentation: https://pnpm.io/package_json#pnpmonlybuiltdependencies */ readonly globalOnlyBuiltDependencies: string[] | undefined; /** * The `globalAllowBuilds` setting controls which packages are allowed to run build scripts * (`preinstall`, `install`, and `postinstall` lifecycle events). A value of `true` means the * package is allowed to run build scripts; `false` means it is explicitly denied. * Packages with build scripts not listed here will cause pnpm to fail with ERR_PNPM_IGNORED_BUILDS. * The settings are written to the `allowBuilds` field of the `pnpm-workspace.yaml` file * that is generated by Rush during installation. * * (SUPPORTED ONLY IN PNPM 11.0.0 AND NEWER) * * PNPM documentation: https://pnpm.io/settings#allowbuilds */ readonly globalAllowBuilds: Record | undefined; /** * The ignoredOptionalDependencies setting allows you to exclude certain optional dependencies from being installed * during the Rush installation process. This can be useful when optional dependencies are not required or are * problematic in specific environments (e.g., dependencies with incompatible binaries or platform-specific requirements). * The listed dependencies will be treated as though they are missing, even if other packages specify them as optional * dependencies. The settings are copied into the pnpm.ignoredOptionalDependencies field of the common/temp/package.json * file that is generated by Rush during installation. * * (SUPPORTED ONLY IN PNPM 9.0.0 AND NEWER) * * PNPM documentation: https://pnpm.io/package_json#pnpmignoredoptionaldependencies */ readonly globalIgnoredOptionalDependencies: string[] | undefined; /** * The `globalAllowedDeprecatedVersions` setting suppresses installation warnings for package * versions that the NPM registry reports as being deprecated. This is useful if the * deprecated package is an indirect dependency of an external package that has not released a fix. * The settings are copied into the `pnpm.allowedDeprecatedVersions` field of the `common/temp/package.json` * file that is generated by Rush during installation. * * PNPM documentation: https://pnpm.io/package_json#pnpmalloweddeprecatedversions * * If you are working to eliminate a deprecated version, it's better to specify `allowedDeprecatedVersions` * in the package.json file for individual Rush projects. */ readonly globalAllowedDeprecatedVersions: Record | undefined; /** * (USE AT YOUR OWN RISK) This is a free-form property bag that will be copied into * the `common/temp/package.json` file that is generated by Rush during installation. * This provides a way to experiment with new PNPM features. These settings will override * any other Rush configuration associated with a given JSON field except for `.pnpmfile.cjs`. * * USAGE OF THIS SETTING IS NOT SUPPORTED BY THE RUSH MAINTAINERS AND MAY CAUSE RUSH * TO MALFUNCTION. If you encounter a missing PNPM setting that you believe should * be supported, please create a GitHub issue or PR. Note that Rush does not aim to * support every possible PNPM setting, but rather to promote a battle-tested installation * strategy that is known to provide a good experience for large teams with lots of projects. */ readonly unsupportedPackageJsonSettings: unknown | undefined; readonly jsonFilename: string | undefined; /** * The `pnpmLockfilePolicies` setting defines the policies that govern the `pnpm-lock.yaml` file. */ readonly pnpmLockfilePolicies: IPnpmLockfilePolicies | undefined; /** * (EXPERIMENTAL) If "true", then filtered installs ("rush install --to my-project") * will be disregarded, instead always performing a full installation of the lockfile. * This setting is primarily useful with Rush subspaces which enable filtering across * multiple lockfiles, if filtering may be inefficient or undesirable for certain lockfiles. * * The default value is false. */ readonly alwaysFullInstall: boolean | undefined; /** * The `globalCatalogs` setting provides named catalogs for organizing dependency versions. * Each catalog can be referenced using the `catalog:catalogName` protocol in package.json files * (e.g., `catalog:react18`). The settings are written to the `catalogs` field of the * `pnpm-workspace.yaml` file that is generated by Rush during installation. * * PNPM documentation: https://pnpm.io/catalogs */ readonly globalCatalogs: Record> | undefined; /** * (GENERATED BY RUSH-PNPM PATCH-COMMIT) When modifying this property, make sure you know what you are doing. * * The `globalPatchedDependencies` is added/updated automatically when you run pnpm patch-commit * command. It is a dictionary where the key should be the package name and exact version. The value * should be a relative path to a patch file. * * PNPM documentation: https://pnpm.io/package_json#pnpmpatcheddependencies */ get globalPatchedDependencies(): Record | undefined; private constructor(); /** @internal */ static loadFromJsonFileOrThrow(jsonFilePath: string, commonTempFolder: string): PnpmOptionsConfiguration; /** @internal */ static loadFromJsonObject(json: _IPnpmOptionsJson, commonTempFolder: string): PnpmOptionsConfiguration; /** * Updates patchedDependencies field of the PNPM options in the common/config/rush/pnpm-config.json file. * * @remarks * When running "pnpm patch-commit"/"pnpm patch-remove" (pnpm 9 and newer), pnpm rewrites the * pre-existing entries using absolute paths pointing into the common/temp folder. Normalize any such * value back to a path relative to the common/temp folder (e.g. "patches/example\@1.0.0.patch") so the location * of the local checkout does not leak into pnpm-config.json. */ updateGlobalPatchedDependencies(patchedDependencies: Record | undefined): void; /** * Updates globalOnlyBuiltDependencies field of the PNPM options in the common/config/rush/pnpm-config.json file. * * @deprecated Use {@link PnpmOptionsConfiguration.updateGlobalOnlyBuiltDependenciesAsync} instead. */ updateGlobalOnlyBuiltDependencies(onlyBuiltDependencies: string[] | undefined): void; /** * Updates globalOnlyBuiltDependencies field of the PNPM options in the common/config/rush/pnpm-config.json file. */ updateGlobalOnlyBuiltDependenciesAsync(onlyBuiltDependencies: string[] | undefined): Promise; /** * Updates globalCatalogs field of the PNPM options in the common/config/rush/pnpm-config.json file. */ updateGlobalCatalogsAsync(catalogs: Record> | undefined): Promise; /** * Updates globalAllowBuilds field of the PNPM options in the common/config/rush/pnpm-config.json file. */ updateGlobalAllowBuilds(allowBuilds: Record | undefined): void; } /** * Possible values for the `resolutionMode` setting in Rush's pnpm-config.json file. * @remarks * These modes correspond to PNPM's `resolution-mode` values, which are documented here: * {@link https://pnpm.io/npmrc#resolution-mode} * * @public */ export declare type PnpmResolutionMode = 'highest' | 'time-based' | 'lowest-direct'; /** * This represents the available PNPM store options * @public */ export declare type PnpmStoreLocation = 'local' | 'global'; /** * @deprecated Use {@link PnpmStoreLocation} instead * @public */ export declare type PnpmStoreOptions = PnpmStoreLocation; /** * Possible values for the `trustPolicy` setting in Rush's pnpm-config.json file. * @remarks * These values correspond to PNPM's `trust-policy` setting, which is documented here: * {@link https://pnpm.io/settings#trustpolicy} * * @public */ export declare type PnpmTrustPolicy = 'no-downgrade' | 'off'; /** * Prints out a report of the status of each project * @internal */ export declare function _printOperationStatus(terminal: ITerminal, result: IExecutionResult): void; /** * @beta */ export declare class ProjectChangeAnalyzer { #private; constructor(rushConfiguration: RushConfiguration); /** * Gets a list of projects that have changed in the current state of the repo * when compared to the specified branch, optionally taking the shrinkwrap and settings in * the rush-project.json file into consideration. */ getChangedProjectsAsync(options: IGetChangedProjectsOptions): Promise>; protected getChangesByProject(lookup: LookupByPath, changedFiles: Map): Map>; /** * Gets a snapshot of the input state of the Rush workspace that can be queried for incremental * build operations and use by the build cache. * * @remarks * If the state cannot be calculated, this writes a warning and continues without a snapshot. With * `throwOnMissingProjectShrinkwrapFile`, a missing project dependency file (shrinkwrap-deps.json) instead * throws its error, whether it is detected when the provider is created or when a snapshot fails. A host that * cannot continue without a snapshot can then report that actionable cause. * * With `reuseUnchangedInputs`, the provider keeps the state of the Git repository between snapshots, and * returns its previous snapshot while the inputs are unchanged. This suits a long-lived host, such as the Rush * daemon, that takes a snapshot for each request. * @internal */ _tryGetSnapshotProviderAsync(projectConfigurations: ReadonlyMap, terminal: ITerminal, projectSelection?: ReadonlySet, options?: { readonly throwOnMissingProjectShrinkwrapFile?: boolean; readonly reuseUnchangedInputs?: boolean; }): Promise; /** * @internal */ _filterProjectDataAsync(project: RushConfigurationProject, unfilteredProjectData: Map, rootDir: string, terminal: ITerminal, getIgnoreGlobsAsync?: IGetChangedProjectsOptions['getIncrementalBuildIgnoredGlobsAsync']): Promise>; } export { ReporterExtensionEventName } export { ReporterJsonValue } export { ReporterPrivacyClassification } /** * This file is used to track the state of various Rush-related features. It is generated * and updated by Rush. * * @public */ export declare class RepoStateFile { #private; /** * Get the absolute file path of the repo-state.json file. */ readonly filePath: string; private constructor(); /** * The hash of the pnpm shrinkwrap file at the end of the last update. */ get pnpmShrinkwrapHash(): string | undefined; /** * The hash of all preferred versions at the end of the last update. */ get preferredVersionsHash(): string | undefined; /** * The hash of all preferred versions at the end of the last update. */ get packageJsonInjectedDependenciesHash(): string | undefined; /** * The hash of the PNPM catalog definitions at the end of the last update. */ get pnpmCatalogsHash(): string | undefined; /** * If false, the repo-state.json file is not valid and its values cannot be relied upon */ get isValid(): boolean; /** * Loads the repo-state.json data from the specified file path. * If the file has not been created yet, then an empty object is returned. * * @param jsonFilename - The path to the repo-state.json file. */ static loadFromFile(jsonFilename: string): RepoStateFile; /** * Refresh the data contained in repo-state.json using the current state * of the Rush repo, and save the file if changes were made. * * @param rushConfiguration - The Rush configuration for the repo. * @param subspace - The subspace that repo-state.json was loaded from, * or `undefined` for the default subspace. * * @returns true if the file was modified, otherwise false. */ refreshState(rushConfiguration: RushConfiguration, subspace: Subspace | undefined, variant?: string): boolean; } /** * Validates and snapshots daemon configuration, using environment, then config, then defaults. * @remarks Warm policies are consumed by generation-owned WorkspaceWarmSet attachments. They do not alter native CLI execution. * @beta */ export declare function resolveDaemonConfiguration(json?: IDaemonConfigurationJson, environment?: Readonly>): Readonly>; /** * General operations for the Rush engine. * * @public */ export declare class Rush { /** * This API is used by the `@microsoft/rush` front end to launch the "rush" command-line. * Third-party tools should not use this API. Instead, they should execute the "rush" binary * and start a new Node.js process. * * @remarks * Earlier versions of the rush frontend used a different API contract. In the old contract, * the second argument was the `isManaged` value of the {@link ILaunchOptions} object. * * Even though this API isn't documented, it is still supported for legacy compatibility. */ static launch(launcherVersion: string, options: ILaunchOptions): void; /** * This API is used by the `@microsoft/rush` front end to launch the "rushx" command-line. * Third-party tools should not use this API. Instead, they should execute the "rushx" binary * and start a new Node.js process. */ static launchRushX(launcherVersion: string, options: ILaunchOptions): void; /** * This API is used by the `@microsoft/rush` front end to launch the "rush-pnpm" command-line. * Third-party tools should not use this API. Instead, they should execute the "rush-pnpm" binary * and start a new Node.js process. */ static launchRushPnpm(launcherVersion: string, options: ILaunchOptions): void; /** * The currently executing version of the "rush-lib" library. * This is the same as the Rush tool version for that release. */ static get version(): string; /** * @internal */ static get _rushLibPackageJson(): IPackageJson; static get _rushLibPackageFolder(): string; } /** * Information about the available CLI commands * * @beta */ export declare class RushCommandLine { static getCliSpec(rushJsonFolder: string): IRushCommandLineSpec; } /** * This represents the Rush configuration for a repository, based on the "rush.json" * configuration file. * @public */ export declare class RushConfiguration { #private; /** * @internal */ _currentVariantJsonLoadingPromise: Promise | undefined; /** * The name of the package manager being used to install dependencies */ readonly packageManager: PackageManagerName; /** * If true, the repository is using PNPM as its package manager. */ readonly isPnpm: boolean; /** * {@inheritdoc PackageManager} * * @privateremarks * In the next major breaking API change, we will rename this property to "packageManager" and eliminate the * old property with that name. * * @beta */ readonly packageManagerWrapper: PackageManager; /** * Gets the JSON data structure for the "rush.json" configuration file. * * @internal */ readonly rushConfigurationJson: IRushConfigurationJson; /** * The absolute path to the "rush.json" configuration file that was loaded to construct this object. */ readonly rushJsonFile: string; /** * The absolute path of the folder that contains rush.json for this project. */ readonly rushJsonFolder: string; /** * The folder that contains all change files. */ readonly changesFolder: string; /** * The fully resolved path for the "common" folder where Rush will store settings that * affect all Rush projects. This is always a subfolder of the folder containing "rush.json". * Example: `C:\MyRepo\common` */ readonly commonFolder: string; /** * The folder where Rush's additional config files are stored. This folder is always a * subfolder called `config\rush` inside the common folder. (The `common\config` folder * is reserved for configuration files used by other tools.) To avoid confusion or mistakes, * Rush will report an error if this this folder contains any unrecognized files. * * Example: `C:\MyRepo\common\config\rush` */ readonly commonRushConfigFolder: string; /** * The folder where temporary files will be stored. This is always a subfolder called "temp" * under the common folder. * Example: `C:\MyRepo\common\temp` */ readonly commonTempFolder: string; /** * The folder where automation scripts are stored. This is always a subfolder called "scripts" * under the common folder. * Example: `C:\MyRepo\common\scripts` */ readonly commonScriptsFolder: string; /** * The local folder that will store the NPM package cache. Rush does not rely on the * npm's default global cache folder, because npm's caching implementation does not * reliably handle multiple processes. (For example, if a build box is running * "rush install" simultaneously for two different working folders, it may fail randomly.) * * Example: `C:\MyRepo\common\temp\npm-cache` */ readonly npmCacheFolder: string; /** * The local folder where npm's temporary files will be written during installation. * Rush does not rely on the global default folder, because it may be on a different * hard disk. * * Example: `C:\MyRepo\common\temp\npm-tmp` */ readonly npmTmpFolder: string; /** * The local folder that will store the Yarn package cache. * * Example: `C:\MyRepo\common\temp\yarn-cache` */ readonly yarnCacheFolder: string; /** * The filename (without any path) of the shrinkwrap file that is used by the package manager. * @remarks * This property merely reports the filename; the file itself may not actually exist. * Example: `npm-shrinkwrap.json` or `pnpm-lock.yaml` */ readonly shrinkwrapFilename: string; /** * The object that specifies subspace configurations if they are provided in the rush workspace. * @beta */ readonly subspacesConfiguration: SubspacesConfiguration | undefined; /** * Returns true if subspaces.json is present with "subspacesEnabled=true". */ readonly subspacesFeatureEnabled: boolean; /** * The filename of the variant dependency data file. By default this is * called 'current-variant.json' and resides in the Rush common folder. * Its data structure is defined by ICurrentVariantJson. * * Example: `C:\MyRepo\common\temp\current-variant.json` */ readonly currentVariantJsonFilePath: string; /** * The version of the locally package manager tool. (Example: "1.2.3") */ readonly packageManagerToolVersion: string; /** * The absolute path to the locally package manager tool. If "rush install" has not * been run, then this file may not exist yet. * Example: `C:\MyRepo\common\temp\npm-local\node_modules\.bin\npm` */ readonly packageManagerToolFilename: string; /** * The minimum allowable folder depth for the projectFolder field in the rush.json file. * This setting provides a way for repository maintainers to discourage nesting of project folders * that makes the directory tree more difficult to navigate. The default value is 2, * which implements a standard 2-level hierarchy of `//package.json`. */ readonly projectFolderMinDepth: number; /** * The maximum allowable folder depth for the projectFolder field in the rush.json file. * This setting provides a way for repository maintainers to discourage nesting of project folders * that makes the directory tree more difficult to navigate. The default value is 2, * which implements on a standard convention of `//package.json`. */ readonly projectFolderMaxDepth: number; /** * Today the npmjs.com registry enforces fairly strict naming rules for packages, but in the early * days there was no standard and hardly any enforcement. A few large legacy projects are still using * nonstandard package names, and private registries sometimes allow it. Set "allowMostlyStandardPackageNames" * to true to relax Rush's enforcement of package names. This allows upper case letters and in the future may * relax other rules, however we want to minimize these exceptions. Many popular tools use certain punctuation * characters as delimiters, based on the assumption that they will never appear in a package name; thus if we relax * the rules too much it is likely to cause very confusing malfunctions. * * The default value is false. */ readonly allowMostlyStandardPackageNames: boolean; /** * The "approvedPackagesPolicy" settings. */ readonly approvedPackagesPolicy: ApprovedPackagesPolicy; /** * [Part of the "gitPolicy" feature.] * A list of regular expressions describing allowable email patterns for Git commits. * They are case-insensitive anchored JavaScript RegExps. * Example: `".*@example\.com"` * This array will never be undefined. */ readonly gitAllowedEmailRegExps: string[]; /** * [Part of the "gitPolicy" feature.] * An example valid email address that conforms to one of the allowedEmailRegExps. * Example: `"foxtrot@example\.com"` * This will never be undefined, and will always be nonempty if gitAllowedEmailRegExps is used. */ readonly gitSampleEmail: string; /** * [Part of the "gitPolicy" feature.] * The commit message to use when committing changes during 'rush publish' */ readonly gitVersionBumpCommitMessage: string | undefined; /** * [Part of the "gitPolicy" feature.] * The commit message to use when committing change log files 'rush version' */ readonly gitChangeLogUpdateCommitMessage: string | undefined; /** * [Part of the "gitPolicy" feature.] * The commit message to use when committing change log files 'rush version' */ readonly gitChangefilesCommitMessage: string | undefined; /** * [Part of the "gitPolicy" feature.] * The separator between package name and version in git tag. */ readonly gitTagSeparator: string | undefined; /** * [Part of the "hotfixChange" feature.] * Enables creating hotfix changes */ readonly hotfixChangeEnabled: boolean; /** * Remote URL(s) of the repository. If a value is provided, \"rush change\" will * use one of these to find the right remote to compare against. Specifying multiple URLs * is useful if a GitHub repository is renamed or for `.visualstudio.com` versus * `dev.azure.com/` URLs. */ readonly repositoryUrls: string[]; /** * The default branch name. This tells "rush change" which remote branch to compare against. */ readonly repositoryDefaultBranch: string; /** * The default remote. This tells "rush change" which remote to compare against if the remote URL is not set * or if a remote matching the provided remote URL is not found. */ readonly repositoryDefaultRemote: string; /** * Odd-numbered major versions of Node.js are experimental. Even-numbered releases * spend six months in a stabilization period before the first Long Term Support (LTS) version. * For example, 8.9.0 was the first LTS version of Node.js 8. Pre-LTS versions are not recommended * for production usage because they frequently have bugs. They may cause Rush itself * to malfunction. * * Rush normally prints a warning if it detects a pre-LTS Node.js version. If you are testing * pre-LTS versions in preparation for supporting the first LTS version, you can use this setting * to disable Rush's warning. */ readonly suppressNodeLtsWarning: boolean; /** * The raw value of `ensureConsistentVersions` from the `rush.json` file. * * @internal */ readonly _ensureConsistentVersionsJsonValue: boolean | undefined; /** * If true, then consistent version specifiers for dependencies will be enforced. * I.e. "rush check" is run before some commands. * * @deprecated * This setting was moved from `rush.json` to `common-versions.json`. * Read it using {@link Subspace.shouldEnsureConsistentVersions} instead. */ readonly ensureConsistentVersions: boolean; /** * Indicates whether telemetry collection is enabled for Rush runs. * @beta */ readonly telemetryEnabled: boolean; /** Validated opt-in daemon settings. Environment overrides config and defaults. @beta */ readonly daemon: Readonly>; /** * Repository settings used by the Rush reporter system. * @beta */ readonly reportingConfiguration: IRushReportingConfiguration; /** * {@inheritDoc NpmOptionsConfiguration} */ readonly npmOptions: NpmOptionsConfiguration; /** * {@inheritDoc PnpmOptionsConfiguration} */ readonly pnpmOptions: PnpmOptionsConfiguration; /** * {@inheritDoc YarnOptionsConfiguration} */ readonly yarnOptions: YarnOptionsConfiguration; /** * The configuration options used by the current package manager. * @remarks * For package manager specific variants, reference {@link RushConfiguration.npmOptions | npmOptions}, * {@link RushConfiguration.pnpmOptions | pnpmOptions}, or {@link RushConfiguration.yarnOptions | yarnOptions}. */ readonly packageManagerOptions: PackageManagerOptionsConfigurationBase; /** * The rush hooks. It allows customized scripts to run at the specified point. * @beta */ readonly eventHooks: EventHooks; /** * The rush hooks. It allows customized scripts to run at the specified point. */ readonly packageNameParser: PackageNameParser; /** * @beta */ readonly versionPolicyConfiguration: VersionPolicyConfiguration; /** * @beta */ readonly versionPolicyConfigurationFilePath: string; /** * Accesses the custom-tips.json configuration. * @beta */ readonly customTipsConfiguration: CustomTipsConfiguration; /** * The absolute path to the custom tips configuration file. * @beta */ readonly customTipsConfigurationFilePath: string; /** * This configuration object contains settings repo maintainers have specified to enable * and disable experimental Rush features. * * @beta */ readonly experimentsConfiguration: ExperimentsConfiguration; /** * @internal */ readonly _rushPluginsConfiguration: RushPluginsConfiguration; /** * The variants specified in the rush.json configuration file. * * @beta */ readonly variants: ReadonlySet; /** * Use RushConfiguration.loadFromConfigurationFile() or Use RushConfiguration.loadFromDefaultLocation() * instead. */ private constructor(); /** * Loads the configuration data from an Rush.json configuration file and returns * an RushConfiguration object. */ static loadFromConfigurationFile(rushJsonFilename: string): RushConfiguration; static tryLoadFromDefaultLocation(options?: ITryFindRushJsonLocationOptions): RushConfiguration | undefined; static loadFromDefaultLocation(options?: ITryFindRushJsonLocationOptions): RushConfiguration; /** * Find the rush.json location and return the path, or undefined if a rush.json can't be found. * * @privateRemarks * Keep this in sync with `findRushJsonLocation` in `rush-sdk/src/index.ts`. */ static tryFindRushJsonLocation(options?: ITryFindRushJsonLocationOptions): string | undefined; /** * The fully resolved path for the "autoinstallers" folder. * Example: `C:\MyRepo\common\autoinstallers` */ get commonAutoinstallersFolder(): string; /** * The folder where rush-plugin options json files are stored. * Example: `C:\MyRepo\common\config\rush-plugins` */ get rushPluginOptionsFolder(): string; /** * The full path of the temporary shrinkwrap file that is used during "rush install". * This file may get rewritten by the package manager during installation. * @remarks * This property merely reports the filename; the file itself may not actually exist. * Example: `C:\MyRepo\common\temp\npm-shrinkwrap.json` or `C:\MyRepo\common\temp\pnpm-lock.yaml` * * @deprecated Introduced with subspaces is subspace specific tempShrinkwrapFilename accessible from the Subspace class. */ get tempShrinkwrapFilename(): string; /** * The full path of a backup copy of tempShrinkwrapFilename. This backup copy is made * before installation begins, and can be compared to determine how the package manager * modified tempShrinkwrapFilename. * @remarks * This property merely reports the filename; the file itself may not actually exist. * Example: `C:\MyRepo\common\temp\npm-shrinkwrap-preinstall.json` * or `C:\MyRepo\common\temp\pnpm-lock-preinstall.yaml` * * @deprecated Introduced with subspaces is subspace specific tempShrinkwrapPreinstallFilename accessible from the Subspace class. */ get tempShrinkwrapPreinstallFilename(): string; /** * Returns an English phrase such as "shrinkwrap file" that can be used in logging messages * to refer to the shrinkwrap file using appropriate terminology for the currently selected * package manager. */ get shrinkwrapFilePhrase(): string; /** * The filename of the build dependency data file. By default this is * called 'rush-link.json' resides in the Rush common folder. * Its data structure is defined by IRushLinkJson. * * Example: `C:\MyRepo\common\temp\rush-link.json` * * @deprecated The "rush-link.json" file was removed in Rush 5.30.0. * Use `RushConfigurationProject.localDependencyProjects` instead. */ get rushLinkJsonFilename(): string; /** * The default fully-qualified git remote branch of the repository. This helps "rush change" find the right branch to compare against. */ get repositoryDefaultFullyQualifiedRemoteBranch(): string; get projects(): RushConfigurationProject[]; /** * @beta */ get defaultSubspace(): Subspace; /** * A list of all the available subspaces in this workspace. * @beta */ get subspaces(): readonly Subspace[]; /** * @beta */ tryGetSubspace(subspaceName: string): Subspace | undefined; /** * @beta */ getSubspace(subspaceName: string): Subspace; /** * Returns the set of subspaces that the given projects belong to * @beta */ getSubspacesForProjects(projects: Iterable): ReadonlySet; /** * @beta */ get projectsByName(): ReadonlyMap; /** * Obtains the mapping from custom tags to projects. * @beta */ get projectsByTag(): ReadonlyMap>; /** * Settings from the common-versions.json config file. * @remarks * If the common-versions.json file is missing, this property will not be undefined. * Instead it will be initialized in an empty state, and calling CommonVersionsConfiguration.save() * will create the file. * * @deprecated Use `getCommonVersions` instead, which gets the correct common version data * for a given active variant. */ get commonVersions(): CommonVersionsConfiguration; /** * Gets the currently-installed variant, if an installation has occurred. * For Rush operations which do not take a --variant parameter, this method * determines which variant, if any, was last specified when performing "rush install" * or "rush update". */ getCurrentlyInstalledVariantAsync(): Promise; /** * @deprecated Use {@link Subspace.getCommonVersionsFilePath} instead */ getCommonVersionsFilePath(subspace?: Subspace, variant?: string): string; /** * @deprecated Use {@link Subspace.getCommonVersions} instead */ getCommonVersions(subspace?: Subspace, variant?: string): CommonVersionsConfiguration; /** * Returns a map of all direct dependencies that only have a single semantic version specifier. * * @param subspace - The subspace to use * @param variant - The name of the current variant in use by the active command. * * @returns A map of dependency name --\> version specifier for implicitly preferred versions. */ getImplicitlyPreferredVersions(subspace?: Subspace, variant?: string): Map; /** * @deprecated Use {@link Subspace.getRepoStateFilePath} instead */ getRepoStateFilePath(subspace?: Subspace): string; /** * @deprecated Use {@link Subspace.getRepoState} instead */ getRepoState(subspace?: Subspace): RepoStateFile; /** * @deprecated Use {@link Subspace.getCommittedShrinkwrapFilePath} instead */ getCommittedShrinkwrapFilename(subspace?: Subspace, variant?: string): string; /** * @deprecated Use {@link Subspace.getPnpmfilePath} instead */ getPnpmfilePath(subspace?: Subspace, variant?: string): string; /** * Looks up a project in the projectsByName map. If the project is not found, * then undefined is returned. */ getProjectByName(projectName: string): RushConfigurationProject | undefined; /** * This is used e.g. by command-line interfaces such as "rush build --to example". * If "example" is not a project name, then it also looks for a scoped name * like `@something/example`. If exactly one project matches this heuristic, it * is returned. Otherwise, undefined is returned. */ findProjectByShorthandName(shorthandProjectName: string): RushConfigurationProject | undefined; /** * Looks up a project by its RushConfigurationProject.tempProjectName field. * @returns The found project, or undefined if no match was found. */ findProjectByTempName(tempProjectName: string): RushConfigurationProject | undefined; /** * @returns An optimized lookup engine to find a project by its path relative to the specified root. * @beta */ getProjectLookupForRoot(rootPath: string): LookupByPath; /** * Returns the project for which the specified path is underneath that project's folder. * If the path is not under any project's folder, returns undefined. */ tryGetProjectForPath(currentFolderPath: string): RushConfigurationProject | undefined; } /** * This represents the configuration of a project that is built by Rush, based on * the Rush.json configuration file. * @public */ export declare class RushConfigurationProject { #private; /** * The name of the NPM package. An error is reported if this name is not * identical to packageJson.name. * * Example: `@scope/MyProject` */ readonly packageName: string; /** * The full path of the folder that contains the project to be built by Rush. * * Example: `C:\MyRepo\libraries\my-project` */ readonly projectFolder: string; /** * The relative path of the folder that contains the project to be built by Rush. * * Example: `libraries/my-project` */ readonly projectRelativeFolder: string; /** * The project-specific Rush configuration folder. * * Example: `C:\MyRepo\libraries\my-project\config\rush` */ readonly projectRushConfigFolder: string; /** * The project-specific Rush temp folder. This folder is used to store Rush-specific temporary files. * * Example: `C:\MyRepo\libraries\my-project\.rush\temp` */ readonly projectRushTempFolder: string; /** * The Rush configuration for the monorepo that the project belongs to. */ readonly rushConfiguration: RushConfiguration; /** * Returns the subspace name that a project belongs to. * If subspaces is not enabled, returns the default subspace. */ readonly subspace: Subspace; /** * The review category name, or undefined if no category was assigned. * This name must be one of the valid choices listed in RushConfiguration.reviewCategories. */ readonly reviewCategory: string | undefined; /** * A list of local projects that appear as devDependencies for this project, but cannot be * locally linked because it would create a cyclic dependency; instead, the last published * version will be installed in the Common folder. * * These are package names that would be found by RushConfiguration.getProjectByName(). */ readonly decoupledLocalDependencies: Set; /** * The parsed NPM "package.json" file from projectFolder. */ get packageJson(): IPackageJson; /** * A useful wrapper around the package.json file for making modifications * @beta */ readonly packageJsonEditor: PackageJsonEditor; /** * The unique name for the temporary project that will be generated in the Common folder. * For example, if the project name is `@scope/MyProject`, the temporary project name * might be `@rush-temp/MyProject-2`. * * Example: `@rush-temp/MyProject-2` */ readonly tempProjectName: string; /** * The unscoped temporary project name * * Example: `my-project-2` */ readonly unscopedTempProjectName: string; /** * If true, then this project will be ignored by the "rush check" command. * The default value is false. */ readonly skipRushCheck: boolean; /** * Name of the version policy used by this project. * @beta */ readonly versionPolicyName: string | undefined; /** * The full path of the folder that will get published by Rush. * * @remarks * By default this is the same as the project folder, but a custom folder can be specified * using the the "publishFolder" setting in rush.json. * * Example: `C:\MyRepo\libraries\my-project\temp\publish` */ readonly publishFolder: string; /** * An optional set of custom tags that can be used to select this project. * * @remarks * For example, adding `my-custom-tag` will allow this project to be selected by the * command `rush list --only tag:my-custom-tag`. The tag name must be one or more words separated * by hyphens, where a word may contain lowercase letters, digits, and the period character. * * @beta */ readonly tags: ReadonlySet; /** * Returns the subspace name specified in the `"subspaceName"` field in `rush.json`. * Note that this field may be undefined, if the `default` subspace is being used, * and this field may be ignored if the subspaces feature is disabled. * * @beta */ readonly configuredSubspaceName: string | undefined; /** @internal */ constructor(options: IRushConfigurationProjectOptions); /** * A list of local projects that appear as devDependencies for this project, but cannot be * locally linked because it would create a cyclic dependency; instead, the last published * version will be installed in the Common folder. * * These are package names that would be found by RushConfiguration.getProjectByName(). * * @deprecated Use `decoupledLocalDependencies` instead, as it better describes the purpose of the data. */ get cyclicDependencyProjects(): Set; /** * An array of projects within the Rush configuration which directly depend on this package. * @deprecated Use `consumingProjectNames` instead, as it has Set semantics, which better reflect the nature * of the data. */ get downstreamDependencyProjects(): string[]; /** * An array of projects within the Rush configuration which this project declares as dependencies. * @deprecated Use `dependencyProjects` instead, as it has Set semantics, which better reflect the nature * of the data. */ get localDependencyProjects(): ReadonlyArray; /** * The set of projects within the Rush configuration which this project declares as dependencies. * * @remarks * Can be used recursively to walk the project dependency graph to find all projects that are directly or indirectly * referenced from this project. */ get dependencyProjects(): ReadonlySet; /** * The set of projects within the Rush configuration which declare this project as a dependency. * Excludes those that declare this project as a `cyclicDependencyProject`. * * @remarks * This field is the counterpart to `dependencyProjects`, and can be used recursively to walk the project dependency * graph to find all projects which will be impacted by changes to this project. */ get consumingProjects(): ReadonlySet; /** * A flag which indicates whether changes to this project should be published. This controls * whether or not the project would show up when running `rush change`, and whether or not it * should be published during `rush publish`. */ get shouldPublish(): boolean; /** * Version policy of the project * @beta */ get versionPolicy(): VersionPolicy | undefined; /** * Indicate whether this project is the main project for the related version policy. * * False if the project is not for publishing. * True if the project is individually versioned or if its lockstep version policy does not specify main project. * False if the project is lockstepped and is not the main project for its version policy. * * @beta */ get isMainProject(): boolean; } /** * Constants used by the Rush tool. * @beta * * @remarks * * These are NOT part of the public API surface for rush-lib. * The rationale is that we don't want people implementing custom parsers for * the Rush config files; instead, they should rely on the official APIs from rush-lib. */ export declare class RushConstants { /** * The filename ("rush.json") for the root-level configuration file. */ static readonly rushJsonFilename: 'rush.json'; /** * The filename ("browser-approved-packages.json") for an optional policy configuration file * that stores a list of NPM packages that have been approved for usage by Rush projects. * This is part of a pair of config files, one for projects that run in a web browser * (e.g. whose approval criteria mostly focuses on licensing and code size), and one for everywhere else * (e.g. tooling projects whose approval criteria mostly focuses on avoiding node_modules sprawl). */ static readonly browserApprovedPackagesFilename: 'browser-approved-packages.json'; /** * The folder name ("changes") where change files will be stored. */ static readonly changeFilesFolderName: 'changes'; /** * The filename ("nonbrowser-approved-packages.json") for an optional policy configuration file * that stores a list of NPM packages that have been approved for usage by Rush projects. * This is part of a pair of config files, one for projects that run in a web browser * (e.g. whose approval criteria mostly focuses on licensing and code size), and one for everywhere else * (e.g. tooling projects whose approval criteria mostly focuses on avoiding node_modules sprawl). */ static readonly nonbrowserApprovedPackagesFilename: 'nonbrowser-approved-packages.json'; /** * The folder name ("common") where Rush's common data will be stored. */ static readonly commonFolderName: 'common'; /** * The NPM scope ("\@rush-temp") that is used for Rush's temporary projects. */ static readonly rushTempNpmScope: '@rush-temp'; /** * The folder name ("variants") under which named variant configurations for * alternate dependency sets may be found. * Example: `C:\MyRepo\common\config\rush\variants` */ static readonly rushVariantsFolderName: 'variants'; /** * The folder name ("temp") under the common folder, or under the .rush folder in each project's directory where * temporary files will be stored. * Example: `C:\MyRepo\common\temp` */ static readonly rushTempFolderName: 'temp'; /** * The folder name ("projects") where temporary projects will be stored. * Example: `C:\MyRepo\common\temp\projects` */ static readonly rushTempProjectsFolderName: 'projects'; /** * The filename ("npm-shrinkwrap.json") used to store an installation plan for the NPM package manger. */ static readonly npmShrinkwrapFilename: 'npm-shrinkwrap.json'; /** * Number of installation attempts */ static readonly defaultMaxInstallAttempts: 1; /** * The filename ("pnpm-lock.yaml") used to store an installation plan for the PNPM package manger * (PNPM version 3.x and later). */ static readonly pnpmV3ShrinkwrapFilename: 'pnpm-lock.yaml'; /** * The filename ("pnpmfile.js") used to add custom configuration to PNPM (PNPM version 1.x and later). */ static readonly pnpmfileV1Filename: 'pnpmfile.js'; /** * The filename (".pnpmfile.cjs") used to add custom configuration to PNPM (PNPM version 6.x and later). */ static readonly pnpmfileV6Filename: '.pnpmfile.cjs'; /** * The filename (".modules.yaml") used by pnpm to specify configurations in the node_modules directory */ static readonly pnpmModulesFilename: '.modules.yaml'; /** * The folder name (".pnpm") used by pnpm to store the code of the dependencies for this subspace */ static readonly pnpmVirtualStoreFolderName: '.pnpm'; /** * The filename ("global-pnpmfile.cjs") used to add custom configuration to subspaces */ static readonly pnpmfileGlobalFilename: 'global-pnpmfile.cjs'; /** * The folder name used to store patch files for pnpm * Example: `C:\MyRepo\common\config\pnpm-patches` * Example: `C:\MyRepo\common\temp\patches` */ static readonly pnpmPatchesFolderName: 'patches'; /** * The folder name under `/common/temp` used to store checked-in patches. * Example: `C:\MyRepo\common\pnpm-patches` */ static readonly pnpmPatchesCommonFolderName: `pnpm-patches`; /** * The filename ("shrinkwrap.yaml") used to store state for pnpm */ static readonly yarnShrinkwrapFilename: 'yarn.lock'; /** * The folder name ("node_modules") where NPM installs its packages. */ static readonly nodeModulesFolderName: 'node_modules'; /** * The filename ("pinned-versions.json") for an old configuration file that * that is no longer supported. * * @deprecated This feature has been superseded by the "preferredVersions" setting * in common-versions.json */ static readonly pinnedVersionsFilename: 'pinned-versions.json'; /** * The filename ("common-versions.json") for an optional configuration file * that stores dependency version information that affects all projects in the repo. * This configuration file should go in the "common/config/rush" folder. */ static readonly commonVersionsFilename: 'common-versions.json'; /** * The filename ("repo-state.json") for a file used by Rush to * store the state of various features as they stand in the repo. */ static readonly repoStateFilename: 'repo-state.json'; /** * The filename ("custom-tips.json") for the file used by Rush to * print user-customized messages. * This configuration file should go in the "common/config/rush" folder. */ static readonly customTipsFilename: 'custom-tips.json'; /** * The name of the per-project folder where project-specific Rush files are stored. For example, * the package-deps files, which are used by commands to determine if a particular project needs to be rebuilt. */ static readonly projectRushFolderName: '.rush'; /** * Custom command line configuration file, which is used by rush for implementing * custom command and options. */ static readonly commandLineFilename: 'command-line.json'; static readonly versionPoliciesFilename: 'version-policies.json'; /** * Experiments configuration file. */ static readonly experimentsFilename: 'experiments.json'; /** * Pnpm configuration file */ static readonly pnpmConfigFilename: 'pnpm-config.json'; /** * Rush plugins configuration file name. */ static readonly rushPluginsConfigFilename: 'rush-plugins.json'; /** * Rush plugin manifest file name. */ static readonly rushPluginManifestFilename: 'rush-plugin-manifest.json'; /** * The artifactory.json configuration file name. */ static readonly artifactoryFilename: 'artifactory.json'; /** * The subspaces.json configuration file name */ static readonly subspacesConfigFilename: 'subspaces.json'; /** * The name of the default subspace if one isn't specified but subspaces is enabled. */ static readonly defaultSubspaceName: 'default'; /** * Build cache configuration file. */ static readonly buildCacheFilename: 'build-cache.json'; /** * Build cache version number, incremented when the logic to create cache entries changes. * Changing this ensures that cache entries generated by an old version will no longer register as a cache hit. */ static readonly buildCacheVersion: 1; /** * Cobuild configuration file. */ static readonly cobuildFilename: 'cobuild.json'; /** * Per-project configuration filename. */ static readonly rushProjectConfigFilename: 'rush-project.json'; /** * The URL ("http://rushjs.io") for the Rush web site. */ static readonly rushWebSiteUrl: 'https://rushjs.io'; /** * The name of the NPM package for the Rush tool ("\@microsoft/rush"). */ static readonly rushPackageName: '@microsoft/rush'; /** * The folder name ("rush-recycler") where Rush moves large folder trees * before asynchronously deleting them. */ static readonly rushRecyclerFolderName: 'rush-recycler'; /** * The name of the file to drop in project-folder/.rush/temp/ containing a listing of the project's direct * and indirect dependencies. This is used to detect if a project's dependencies have changed since the last build. */ static readonly projectShrinkwrapFilename: 'shrinkwrap-deps.json'; /** * The value of the "commandKind" property for a bulk command in command-line.json */ static readonly bulkCommandKind: 'bulk'; /** * The value of the "commandKind" property for a global command in command-line.json */ static readonly globalCommandKind: 'global'; /** * The value of the "commandKind" property for a plugin-only global command in command-line.json. * This command kind can only be used in command-line.json files provided by Rush plugins. */ static readonly globalPluginCommandKind: 'globalPlugin'; /** * The value of the "commandKind" property for a phased command in command-line.json */ static readonly phasedCommandKind: 'phased'; /** * The name of the incremental build command. */ static readonly buildCommandName: 'build'; /** * The name of the non-incremental build command. */ static readonly rebuildCommandName: 'rebuild'; static readonly updateCloudCredentialsCommandName: 'update-cloud-credentials'; /** * When a hash generated that contains multiple input segments, this character may be used * to separate them to avoid issues like * crypto.createHash('sha1').update('a').update('bc').digest('hex') === crypto.createHash('sha1').update('ab').update('c').digest('hex') */ static readonly hashDelimiter: '|'; /** * The name of the per-user Rush configuration data folder. */ static readonly rushUserConfigurationFolderName: '.rush-user'; /** * The name of the project `rush-logs` folder. */ static readonly rushLogsFolderName: 'rush-logs'; /** * The expected prefix for phase names in "common/config/rush/command-line.json" */ static readonly phaseNamePrefix: '_phase:'; /** * The default debounce value for Rush multi-project watch mode. When watching, controls * how long to wait after the last encountered file system event before execution. If another * file system event occurs in this interval, the timeout will reset. */ static readonly defaultWatchDebounceMs: 1000; /** * The name of the parameter that can be used to bypass policies. */ static readonly bypassPolicyFlagLongName: '--bypass-policy'; /** * Merge Queue ignore configuration file. */ static readonly mergeQueueIgnoreFileName: '.mergequeueignore'; /** * The filename ("project-impact-graph.yaml") for the project impact graph file. */ static readonly projectImpactGraphFilename: 'project-impact-graph.yaml'; /** * The filename for the last link flag */ static readonly lastLinkFlagFilename: 'last-link'; /** * The filename for the Rush alerts config file. */ static readonly rushAlertsConfigFilename: 'rush-alerts.json'; /** * The filename for the file that tracks which variant is currently installed. */ static readonly currentVariantsFilename: 'current-variants.json'; /** * The filename ("rush-hotlink-state.json") used to store information about packages connected via * "rush link-package" and "rush bridge-package" commands. */ static readonly rushHotlinkStateFilename: 'rush-hotlink-state.json'; /** * The filename ("pnpm-sync.json") used to store the state of the pnpm sync command. */ static readonly pnpmSyncFilename: '.pnpm-sync.json'; /** * The filename ("pnpm-workspace.yaml") used to store the state of the pnpm workspace configuration. */ static readonly pnpmWorkspaceFileName: 'pnpm-workspace.yaml'; } /** * This class provides global folders that are used for rush's internal install locations. * * @internal */ export declare class _RushGlobalFolder { /** * The global folder where Rush stores temporary files. * * @remarks * * Most of the temporary files created by Rush are stored separately for each monorepo working folder, * to avoid issues of concurrency and compatibility between tool versions. However, a small set * of files (e.g. installations of the `@microsoft/rush-lib` engine and the package manager) are stored * in a global folder to speed up installations. The default location is `~/.rush` on POSIX-like * operating systems or `C:\Users\YourName` on Windows. * * You can use the {@link EnvironmentVariableNames.RUSH_GLOBAL_FOLDER} environment variable to specify * a different folder path. This is useful for example if a Windows group policy forbids executing scripts * installed in a user's home directory. * * POSIX is a registered trademark of the Institute of Electrical and Electronic Engineers, Inc. */ readonly path: string; /** * The absolute path to Rush's storage in the home directory for the current user and node version. * On Windows, it would be something like `C:\Users\YourName\.rush\node-v3.4.5`. */ readonly nodeSpecificPath: string; constructor(); } /** * Used by rush-sdk to access internals of rush-lib. * @internal */ export declare class _RushInternals { /** * Used by rush-sdk to load an internal API specified by its module path. * * @param srcImportPath - The module path to load. For example, to refer to `src/api/ChangeFile.ts`, * the `srcImportPath` would be `"api/ChangeFile"`. * @returns the module object as would be returned by `require()` */ static loadModule(srcImportPath: string): unknown; } /** * Hooks into the lifecycle of the Rush process invocation that plugins may tap into. * * @beta */ export declare class RushLifecycleHooks { /** * The hook to run before executing any Rush CLI Command. */ readonly initialize: AsyncSeriesHook; /** * The hook to run before executing any global Rush CLI Command (defined in command-line.json). */ readonly runAnyGlobalCustomCommand: AsyncSeriesHook; /** * A hook map to allow plugins to hook specific named global commands (defined in command-line.json) before execution. */ readonly runGlobalCustomCommand: HookMap>; /** * The hook to run before executing any phased Rush CLI Command (defined in command-line.json, or the default "build" or "rebuild"). */ readonly runAnyPhasedCommand: AsyncSeriesHook; /** * A hook map to allow plugins to hook specific named phased commands (defined in command-line.json) before execution. */ readonly runPhasedCommand: HookMap>; /** * The hook to run between preparing the common/temp folder and invoking the package manager during "rush install" or "rush update". */ readonly beforeInstall: AsyncSeriesHook<[ command: IRushCommand, subspace: Subspace, variant: string | undefined ]>; /** * The hook to run after a successful install. */ readonly afterInstall: AsyncSeriesHook<[ command: IRushCommand, subspace: Subspace, variant: string | undefined ]>; /** * A hook to allow plugins to hook custom logic to process telemetry data. */ readonly flushTelemetry: AsyncParallelHook<[ReadonlyArray]>; } declare class RushPluginsConfiguration { #private; readonly configuration: Readonly; constructor(jsonFilename: string); } /** * Use this class to load the "config/rush-project.json" config file. * * This file provides project-specific configuration options. * @alpha */ export declare class RushProjectConfiguration { #private; readonly project: RushConfigurationProject; /** * {@inheritdoc _IRushProjectJson.incrementalBuildIgnoredGlobs} */ readonly incrementalBuildIgnoredGlobs: ReadonlyArray; /** * {@inheritdoc _IRushProjectJson.disableBuildCacheForProject} */ readonly disableBuildCacheForProject: boolean; readonly operationSettingsByOperationName: ReadonlyMap>; private constructor(); /** @internal */ _getJsonForFingerprint(): string; /** * Validates that the requested phases are compatible. * Deferral of this logic to its own method means that Rush no longer eagerly validates * all defined commands in command-line.json. As such, while validation will be run for a given * command upon invoking that command, defining overlapping phases in "rush custom-command" * that are not used by "rush build" will not cause "rush build" to exit with an error. */ validatePhaseConfiguration(phases: Iterable, terminal: ITerminal): void; /** * Examines the list of source files for the project and the target phase and returns a reason * why the project cannot enable the build cache for that phase, or undefined if it is safe to so do. */ getCacheDisabledReason(trackedFileNames: Iterable, phaseName: string, isNoOp: boolean): string | undefined; /** * Source of truth for whether a project is unable to use the build cache for a given phase. * No-op operations and explicitly outputless plugin operations do not require a rush-project.json file. */ static getCacheDisabledReasonForProject(options: { projectConfiguration: RushProjectConfiguration | undefined; trackedFileNames: Iterable; phaseName: string; isNoOp: boolean; project?: RushConfigurationProject; operationSettings?: Readonly; }): string | undefined; /** * Loads the rush-project.json data for the specified project. */ static tryLoadForProjectAsync(project: RushConfigurationProject, terminal: ITerminal): Promise; /** * Loads a native configuration snapshot of the current files without reading or modifying the process-wide * project, inherited-file, or rig caches of other loads. The loaders are owned only by this invocation. * * @remarks * Throws a {@link PhasedCommandEngineProjectConfigurationError} that names a project whose * configuration could not be loaded. * * A project's merged configuration is reused from an earlier call only if every input of its load is * unchanged: the stamps (identity, size, mtime and ctime) of its `config/rig.json`, its own * `config/rush-project.json`, and each file of the `extends` chain that was loaded; the path each `extends` * value resolves to; and, for a configuration that comes from a rig, the real path of the rig profile folder * that the project's `node_modules` reaches. A configuration is recorded only if each of its files had * already been unchanged for a few seconds when it was examined, and only after a load that succeeded; the * warnings are reported again by every call. * @internal */ static _tryLoadForProjectsUncachedAsync(projects: Iterable, terminal: ITerminal): Promise>; /** * Load only the `incrementalBuildIgnoredGlobs` property from the rush-project.json file, skipping * validation of other parts of the config file. * * @remarks * This function exists to allow the ProjectChangeAnalyzer to load just the ignore globs without * having to validate the rest of the `rush-project.json` file against the repo's command-line configuration. */ static tryLoadIgnoreGlobsForProjectAsync(project: RushConfigurationProject, terminal: ITerminal): Promise | undefined>; /** * Load the rush-project.json data for all selected projects. * Validate compatibility of output folders across all selected phases. */ static tryLoadForProjectsAsync(projects: Iterable, terminal: ITerminal): Promise>; } /** * @beta */ export declare class RushSession { readonly hooks: RushLifecycleHooks; constructor(options: IRushSessionOptions); getLogger(name: string): ILogger; get terminalProvider(): ITerminalProvider; /** * Creates a structured reporter bound to this producer and the specified scope. * * @remarks * Returns `undefined` when the frontend did not provide a reporter event sink. * The returned API cannot access concrete reporters or override the session and * source identity bound by Rush. */ getReporter(scope?: IReporterEventScope): IScopedReporter | undefined; /** * Creates a structured logger bound to this producer and the specified scope. * * @remarks * Returns `undefined` when the frontend did not provide a reporter event sink. * This API is additive; {@link RushSession.getLogger} and terminal output remain * available during the pre-major compatibility period. */ getScopedLogger(scope?: IReporterEventScope): IScopedLogger | undefined; registerCloudBuildCacheProviderFactory(cacheProviderName: string, factory: CloudBuildCacheProviderFactory): void; getCloudBuildCacheProviderFactory(cacheProviderName: string): CloudBuildCacheProviderFactory | undefined; registerCobuildLockProviderFactory(cobuildLockProviderName: string, factory: CobuildLockProviderFactory): void; getCobuildLockProviderFactory(cobuildLockProviderName: string): CobuildLockProviderFactory | undefined; } /** * Rush per-user configuration data. * * @beta */ export declare class RushUserConfiguration { /** * If provided, store build cache in the specified folder. Must be an absolute path. */ readonly buildCacheFolder: string | undefined; private constructor(); static initializeAsync(): Promise; static getRushUserFolderPath(): string; } /** * Native Rushx parsing and script execution with explicit request-local process state. * * @remarks * The caller owns dotenv initialization, cwd confinement and child lifetime. Active hooks require in-process execution. * This helper never changes process cwd, environment or exitCode. * @beta */ export declare class RushXCommand { static parseArguments(argv: ReadonlyArray, environment: Readonly): IRushXCommandLineArguments; static getPackageFolder(cwd: string): string; /** Loads repository then user dotenv files into a copy, without consulting cached user state. */ static prepareEnvironment(cwd: string, environment: Readonly, rushJsonFilePath: string): NodeJS.ProcessEnv; /** Returns a pre-execution boundary, never a reason to replay an executed script. */ static getInProcessReason(args: IRushXCommandLineArguments, environment: Readonly, configuration: RushConfiguration): string | undefined; static executeAsync(options: IRushXCommandOptions): Promise; } /** * This represents the subspace configurations for a repository, based on the "subspaces.json" * configuration file. * @public */ export declare class Subspace { #private; readonly subspaceName: string; constructor(options: ISubspaceOptions); /** * Returns the list of projects belonging to this subspace. * @beta */ getProjects(): RushConfigurationProject[]; /** * Returns the parsed contents of the pnpm-config.json config file. * @beta */ getPnpmOptions(): PnpmOptionsConfiguration | undefined; /** * Returns the full path of the folder containing this subspace's variant-dependent configuration files * such as `pnpm-lock.yaml`. * * Example (variants): `C:\MyRepo\common\config\rush\variants\my-variant` * Example (variants and subspaces): `C:\MyRepo\common\config\subspaces\my-subspace\variants\my-variant` * Example (subspaces): `C:\MyRepo\common\config\subspaces\my-subspace` * Example (neither): `C:\MyRepo\common\config\rush` * @beta * * @remarks * The following files may be variant-dependent: * - Lockfiles: (i.e. - `pnpm-lock.yaml`, `npm-shrinkwrap.json`, `yarn.lock`, etc) * - 'common-versions.json' * - 'pnpmfile.js'/'.pnpmfile.cjs' */ getVariantDependentSubspaceConfigFolderPath(variant: string | undefined): string; /** * Returns the full path of the folder containing this subspace's configuration files such as `pnpm-lock.yaml`. * * Example (subspaces feature enabled): `C:\MyRepo\common\config\subspaces\my-subspace` * Example (subspaces feature disabled): `C:\MyRepo\common\config\rush` * @beta */ getSubspaceConfigFolderPath(): string; /** * Returns the full path of the folder containing this subspace's configuration files such as `pnpm-lock.yaml`. * * Example (subspaces feature enabled): `C:\MyRepo\common\config\subspaces\my-subspace\pnpm-patches` * Example (subspaces feature disabled): `C:\MyRepo\common\pnpm-patches` * @beta */ getSubspacePnpmPatchesFolderPath(): string; /** * The full path of the folder where the subspace's node_modules and other temporary files will be stored. * * Example (subspaces feature enabled): `C:\MyRepo\common\temp\subspaces\my-subspace` * Example (subspaces feature disabled): `C:\MyRepo\common\temp` * @beta */ getSubspaceTempFolderPath(): string; /** * Returns full path of the temporary shrinkwrap file for a specific subspace and returns the common workspace * shrinkwrap if no subspaceName is provided. * @remarks * This function takes the subspace name, and returns the full path for the subspace's shrinkwrap file. * This function also consults the deprecated option to allow for shrinkwraps to be stored under a package folder. * This shrinkwrap file is used during "rush install", and may be rewritten by the package manager during installation * This property merely reports the filename, the file itself may not actually exist. * example: `C:\MyRepo\common\\pnpm-lock.yaml` * @beta */ getTempShrinkwrapFilename(): string; /** * @deprecated - Use {@link Subspace.getTempShrinkwrapPreinstallFilePath} instead. */ getTempShrinkwrapPreinstallFilename(subspaceName?: string | undefined): string; /** * The full path of a backup copy of tempShrinkwrapFilename. This backup copy is made * before installation begins, and can be compared to determine how the package manager * modified tempShrinkwrapFilename. * @remarks * This property merely reports the filename; the file itself may not actually exist. * Example: `C:\MyRepo\common\temp\npm-shrinkwrap-preinstall.json` * or `C:\MyRepo\common\temp\pnpm-lock-preinstall.yaml` * @beta */ getTempShrinkwrapPreinstallFilePath(): string; /** * Gets the full path to the common-versions.json config file for this subspace. * * Example (subspaces feature enabled): `C:\MyRepo\common\config\subspaces\my-subspace\common-versions.json` * Example (subspaces feature disabled): `C:\MyRepo\common\config\rush\common-versions.json` * @beta */ getCommonVersionsFilePath(variant?: string): string; /** * Gets the full path to the pnpm-config.json config file for this subspace. * * Example (subspaces feature enabled): `C:\MyRepo\common\config\subspaces\my-subspace\pnpm-config.json` * Example (subspaces feature disabled): `C:\MyRepo\common\config\rush\pnpm-config.json` * @beta */ getPnpmConfigFilePath(): string; /** * Gets the settings from the common-versions.json config file. * @beta */ getCommonVersions(variant?: string): CommonVersionsConfiguration; /** * Gets the ensureConsistentVersions property from the common-versions.json config file, * or from the rush.json file if it isn't defined in common-versions.json * @beta */ shouldEnsureConsistentVersions(variant?: string): boolean; /** * Gets the path to the repo-state.json file. * @beta */ getRepoStateFilePath(): string; /** * Gets the contents from the repo-state.json file. * @param subspaceName - The name of the subspace in use by the active command. * @beta */ getRepoState(): RepoStateFile; /** * @deprecated - Use {@link Subspace.getCommittedShrinkwrapFilePath} instead. */ getCommittedShrinkwrapFilename(): string; /** * Gets the committed shrinkwrap file name for a specific variant. * @param variant - The name of the current variant in use by the active command. * @beta */ getCommittedShrinkwrapFilePath(variant?: string): string; /** * Gets the absolute path for "pnpmfile.js" for a specific subspace. * @param subspace - The name of the current subspace in use by the active command. * @remarks * The file path is returned even if PNPM is not configured as the package manager. * @beta */ getPnpmfilePath(variant?: string): string; /** * Returns true if the specified project belongs to this subspace. * @beta */ contains(project: RushConfigurationProject): boolean; /** @internal */ _addProject(project: RushConfigurationProject): void; /** * Computes a hash of the PNPM catalog definitions for this subspace. * Returns undefined if no catalogs are defined. */ getPnpmCatalogsHash(): string | undefined; /** * Returns hash value of injected dependencies in related package.json. * @beta */ getPackageJsonInjectedDependenciesHash(variant?: string): string | undefined; } /** * This represents the subspace configurations for a repository, based on the "subspaces.json" * configuration file. * @beta */ export declare class SubspacesConfiguration { /** * The absolute path to the "subspaces.json" configuration file that was loaded to construct this object. */ readonly subspaceJsonFilePath: string; readonly subspacesEnabled: boolean; /** * This determines if the subspaces feature supports adding configuration files under the project folder itself */ readonly splitWorkspaceCompatibility: boolean; /** * This determines if selectors are required when installing and building */ readonly preventSelectingAllSubspaces: boolean; /** * A set of the available subspaces */ readonly subspaceNames: ReadonlySet; private constructor(); /** * Checks whether the provided string could be used as a subspace name. * Returns `undefined` if the name is valid; otherwise returns an error message. * @remarks * This is a syntax check only; it does not test whether the subspace is actually defined in the Rush configuration. */ static explainIfInvalidSubspaceName(subspaceName: string, splitWorkspaceCompatibility?: boolean): string | undefined; /** * Checks whether the provided string could be used as a subspace name. * If not, an exception is thrown. * @remarks * This is a syntax check only; it does not test whether the subspace is actually defined in the Rush configuration. */ static requireValidSubspaceName(subspaceName: string, splitWorkspaceCompatibility?: boolean): void; static tryLoadFromConfigurationFile(subspaceJsonFilePath: string): SubspacesConfiguration | undefined; static tryLoadFromDefaultLocation(rushConfiguration: RushConfiguration): SubspacesConfiguration | undefined; } /** * @public */ declare type VersionFormatForCommit = 'wildcard' | 'original'; /** * @public */ declare type VersionFormatForPublish = 'original' | 'exact'; /** * This is the base class for version policy which controls how versions get bumped. * @public */ export declare abstract class VersionPolicy { #private; /** * Serialized json for the policy * * @internal */ readonly _json: IVersionPolicyJson; /** * Version policy name */ get policyName(): string; /** * Version policy definition name */ get definitionName(): VersionPolicyDefinitionName; /** * Determines if a version policy wants to opt out of changelog files. */ get exemptFromRushChange(): boolean; /** * Determines if a version policy wants to opt in to including email. */ get includeEmailInChangeFile(): boolean; /** * @internal */ constructor(versionPolicyJson: IVersionPolicyJson); /** * Loads from version policy json * * @param versionPolicyJson - version policy Json * * @internal */ static load(versionPolicyJson: IVersionPolicyJson): VersionPolicy | undefined; /** * Whether it is a lockstepped version policy */ get isLockstepped(): boolean; /** * Returns an updated package json that satisfies the policy. * * @param project - package json * @param force - force update even when the project version is higher than the policy version. */ abstract ensure(project: IPackageJson, force?: boolean): IPackageJson | undefined; /** * Bumps version based on the policy * * @param bumpType - (optional) override bump type * @param identifier - (optional) override prerelease Id */ abstract bump(bumpType?: BumpType, identifier?: string): void; /** * Validates the specified version and throws if the version does not satisfy the policy. * * @param versionString - version string * @param packageName - package name */ abstract validate(versionString: string, packageName: string): void; /** * @deprecated Use {@link VersionPolicy.setDependenciesBeforePublishAsync} method instead. */ setDependenciesBeforePublish(packageName: string, configuration: RushConfiguration): void; /** * Tells the version policy to modify any dependencies in the target package * to values used for publishing. */ setDependenciesBeforePublishAsync(packageName: string, configuration: RushConfiguration): Promise; /** * @deprecated Use {@link VersionPolicy.setDependenciesBeforeCommitAsync} method instead. */ setDependenciesBeforeCommit(packageName: string, configuration: RushConfiguration): void; /** * Tells the version policy to modify any dependencies in the target package * to values used for checked-in source. */ setDependenciesBeforeCommitAsync(packageName: string, configuration: RushConfiguration): Promise; } /** * Use this class to load and save the "common/config/rush/version-policies.json" config file. * This config file configures how different groups of projects will be published by Rush, * and how their version numbers will be determined. * @public */ export declare class VersionPolicyConfiguration { #private; /** * Gets all the version policies */ readonly versionPolicies: Map; /** * @internal */ constructor(jsonFileName: string); /** * Validate the version policy configuration against the rush config */ validate(projectsByName: ReadonlyMap): void; /** * Gets the version policy by its name. * Throws error if the version policy is not found. * @param policyName - Name of the version policy */ getVersionPolicy(policyName: string): VersionPolicy; /** * Bumps up versions for the specified version policy or all version policies * * @param versionPolicyName - version policy name * @param bumpType - bump type to override what policy has defined. * @param identifier - prerelease identifier to override what policy has defined. * @param shouldCommit - should save to disk */ bump(versionPolicyName?: string, bumpType?: BumpType, identifier?: string, shouldCommit?: boolean): void; /** * Updates the version directly for the specified version policy * @param versionPolicyName - version policy name * @param newVersion - new version */ update(versionPolicyName: string, newVersion: string, shouldCommit?: boolean): void; } /** * Version policy base type names * @public */ export declare enum VersionPolicyDefinitionName { 'lockStepVersion' = 0, 'individualVersion' = 1 } /** * Environment variable names that are excluded from {@link IWorkspaceInputFingerprint.environmentHash}. * * @remarks * These variables are maintained per shell, terminal, remote session, service unit, agent session or client * invocation. Rush never reads them to configure the engine, construct the operation graph or compute operation * hashes, so a difference must not discard a warm workspace: * * - shell bookkeeping: `_`, `PWD`, `OLDPWD`, `SHLVL`, `PS1`, `HISTFILE`, `HISTSIZE` * (a child shell recomputes `PWD`/`SHLVL`/`_` for its own working directory) * - terminal presentation: `TERM`, `TERM_PROGRAM`, `TERM_PROGRAM_VERSION`, `TERM_SESSION_ID`, `COLORTERM`, * `COLUMNS`, `LINES`, `LS_COLORS`, `WINDOWID`, and the per-window handles of terminal emulators: * `WT_SESSION`, `WT_PROFILE_ID`, `ITERM_SESSION_ID` * - session and multiplexer handles: `WSL_INTEROP`, `WSLENV`, `SSH_CLIENT`, `SSH_CONNECTION`, `SSH_TTY`, * `SSH_AUTH_SOCK`, `TMUX`, `TMUX_PANE`, `STY`, `XDG_SESSION_ID`, `XDG_SESSION_TYPE`, `DBUS_SESSION_BUS_ADDRESS` * - service manager metadata that systemd assigns to every unit and scope: `INVOCATION_ID`, `JOURNAL_STREAM`, * `MANAGERPID`, `SYSTEMD_EXEC_PID`, `MEMORY_PRESSURE_WATCH`, `MEMORY_PRESSURE_WRITE` * - editor and credential-prompt handles of an integrated terminal: `VSCODE_IPC_HOOK_CLI`, * `VSCODE_GIT_IPC_HANDLE`, `VSCODE_GIT_ASKPASS_MAIN`, `VSCODE_GIT_ASKPASS_NODE`, * `VSCODE_GIT_ASKPASS_EXTRA_ARGS`, `VSCODE_INJECTION`, `VSCODE_NONCE`, `GIT_ASKPASS`, `SSH_ASKPASS` * - coding agent session markers: `COPILOT_CLI`, `COPILOT_AGENT_SESSION_ID`, `COPILOT_LOADER_PID`, * `COPILOT_CLI_BINARY_VERSION`, `COPILOT_CLI_RESOLVED_DIST_DIR`, `CLAUDECODE`, `CLAUDE_CODE_ENTRYPOINT` * - the values that Claude Code sets in each command its Bash tool runs: `CLAUDE_CODE_CHILD_SESSION`, * `CLAUDE_CODE_SESSION_ID`, `CLAUDE_EFFORT` (the session's effort level, which can change within a session), * `CLAUDE_PID`, and, when the session has the feature, `CLAUDE_CODE_BRIDGE_SESSION_ID` (Remote Control), * `CLAUDE_CODE_MESSAGING_SOCKET` and `CLAUDE_CODE_MESSAGING_TOKEN` (cross-session messaging) and * `CLAUDE_JOB_DIR` (background sessions) * - W3C trace context for one command: `TRACEPARENT` and `TRACESTATE`, which a traced caller such as Claude Code * sets to the span of that command * - `RUSHD_TELEMETRY_TAG`, which tags the telemetry entry of one command with its caller's label * - `INIT_CWD`, which Rush removes from every lifecycle script environment and sets explicitly where needed, * and `RUSH_INVOKED_FOLDER`, which Rush assigns for each invocation * - client routing and presentation: `RUSH_DAEMON` and `RUSH_DAEMON_AUTO_START` only select and start a daemon, * `RUSH_DAEMON_QUEUE_TIMEOUT_SECONDS` is sent as each request's admission deadline, `RUSHD_OUTPUT` selects * the client's output mode, and `RUSH_DAEMON_EXPERIMENTAL` is read from each request rather than from the process * - `RUSH_PARALLELISM`, which a long-lived host applies to each request as its `--parallelism` default * - temporary and runtime folders, which are often set per session, job or sandbox: `TMPDIR`, `TMP`, `TEMP` and * `XDG_RUNTIME_DIR`, and `RUSHD_RUNTIME_DIR`, which only selects the folder where a client meets its daemon * - `RUSHD_OPERATION_GROUPS`, which a daemon on Linux sets in its own environment after it starts, to mark the * processes that it starts, so that a later daemon can tell which process groups the daemon left running * * Every other variable remains a process-bound input, including the remaining `RUSH_*` settings (such as * `RUSH_BUILD_CACHE_*` and the daemon's own `RUSH_DAEMON_*` resource settings), `NODE_*`, npm/pnpm * configuration, credentials, `PATH` and `HOME`. On Windows, names are matched case-insensitively. * `PATH` is compared without repeated entries, because a later duplicate can never change which executable * a lookup finds. * * A long-lived host that ignores these variables must not give the processes it launches the values of the * client that started it. Each operation instead takes every one of these variables from the request that it * serves ({@link getWorkspaceRequestOperationEnvironment}), and does not receive the variable when that * request does not define it, except `RUSHD_OPERATION_GROUPS`, which names the host and is taken from it. The * host's own process also drops {@link workspaceRequestScopedEnvironmentVariables}, because code running inside * it reads them from `process.env`. * * @alpha */ export declare const workspaceFingerprintIgnoredEnvironmentVariables: ReadonlySet; /** The strongest action required by a workspace input change. @alpha */ export declare enum WorkspaceInputChangeTier { Reuse = 0, Reload = 1, Restart = 2 } /** * The subset of {@link workspaceFingerprintIgnoredEnvironmentVariables} whose value belongs to one request. * * @remarks * A long-lived host must not inherit these variables from the client that started it: it applies * `RUSH_PARALLELISM` from each request's own environment, and code running inside the host that reads a session * identifier such as `COPILOT_AGENT_SESSION_ID` or `CLAUDE_CODE_SESSION_ID`, a telemetry label such as * `RUSHD_TELEMETRY_TAG` or a trace context such as `TRACEPARENT` from `process.env` would otherwise attribute every * later session's work to the first one. `CLAUDE_PID` names the first client's agent process, and * `CLAUDE_CODE_MESSAGING_TOKEN` is that session's own credential. Likewise, the first client's `TMPDIR`, * `XDG_RUNTIME_DIR`, `CLAUDE_JOB_DIR` or `CLAUDE_CODE_MESSAGING_SOCKET` may be removed when that client's session * or job ends, while the host lives on. (`TMP` and `TEMP` stay, because Windows has no usable default for them.) * A client that an operation of another daemon runs has that daemon's `RUSHD_OPERATION_GROUPS`, which a host must * not pass on as its own. On Windows, names are matched case-insensitively. * * @alpha */ export declare const workspaceRequestScopedEnvironmentVariables: ReadonlySet; /** * Memoizes runtime content digests behind file identity, size, nanosecond mtime and ctime checks. * Changes to metadata alone still produce the same content fingerprint. * * @remarks * Embedding hosts create one cache per workspace lifetime and pass it to * {@link captureWorkspaceInputFingerprintAsync} through `runtimeCache`. The capture function * updates the cache; hosts can inspect {@link WorkspaceRuntimeFingerprintCache.changedPaths} and * {@link WorkspaceRuntimeFingerprintCache.changedInstallationPaths} when reporting why a process restart * is required. * * The cache also memoizes the digests of workspace definition and installation files, which users edit while * a host is running. Such a digest is recorded only if the file's ctime and mtime were at least 3 seconds old * when the file was examined, and it is reused only while the file's identity, size, mtime and ctime are * unchanged. A file that changed more recently is read again by every capture. Every write updates a file's * ctime, which userspace can't set, so a later write can't keep the recorded stamp even on a filesystem whose * timestamps are coarse, provided that the filesystem's clock agrees with the host's to within that margin. * * Like the runtime digests, a memoized entry keeps the file's resolved path while the identity of the file it * reaches is unchanged. A symbolic link that is retargeted to another hard link of the same file, or a parent * folder that is moved without changing the file, keeps the previous resolved path. * * @alpha */ export declare class WorkspaceRuntimeFingerprintCache { #private; /** * Implementation paths whose content or existence differs from the first capture using this cache. * Updated by each capture; metadata-only changes do not appear in this list. */ get changedPaths(): ReadonlyArray; /** * Installation files, such as lockfiles and the flags that an install writes, whose content or existence * differs from the first capture using this cache. Updated by each capture; metadata-only changes do not * appear in this list. */ get changedInstallationPaths(): ReadonlyArray; /** @internal */ _hashPaths(paths: ReadonlyArray): string; /** * Hashes workspace definition or installation files by content, as `[filename, realpath, sha256]` entries or * `[filename, 'missing']`. See the remarks of {@link WorkspaceRuntimeFingerprintCache} for when a digest is reused. * @internal */ _hashInputFilesAsync(filenames: Iterable): Promise; /** * Hashes installation files as {@link WorkspaceRuntimeFingerprintCache._hashInputFilesAsync} does, and * updates {@link WorkspaceRuntimeFingerprintCache.changedInstallationPaths}. * @internal */ _hashInstallationFilesAsync(filenames: Iterable): Promise; } /** * Options that are only used when the yarn package manager is selected. * * @remarks * It is valid to define these options in rush.json even if the yarn package manager * is not being used. * * @public */ export declare class YarnOptionsConfiguration extends PackageManagerOptionsConfigurationBase { /** * If true, then Rush will add the "--ignore-engines" option when invoking Yarn. * This allows "rush install" to succeed if there are dependencies with engines defined in * package.json which do not match the current environment. * * The default value is false. */ readonly ignoreEngines: boolean; /** @internal */ constructor(json: _IYarnOptionsJson); } export { }