Skip to content

Commit b3afaa1

Browse files
committed
Fix API.md
1 parent 9ef62e3 commit b3afaa1

File tree

1 file changed

+106
-36
lines changed

1 file changed

+106
-36
lines changed

common/reviews/api/rush-lib.api.md

Lines changed: 106 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,14 @@ export type GetCacheEntryIdFunction = (options: IGenerateCacheEntryIdOptions) =>
342342
// @beta
343343
export type GetInputsSnapshotAsyncFn = () => Promise<IInputsSnapshot | undefined>;
344344

345+
// @alpha (undocumented)
346+
export interface IBaseOperationExecutionResult {
347+
getStateHash(): string;
348+
getStateHashComponents(): ReadonlyArray<string>;
349+
readonly metadataFolderPath: string | undefined;
350+
readonly operation: Operation;
351+
}
352+
345353
// @internal (undocumented)
346354
export interface _IBuiltInPluginConfiguration extends _IRushPluginConfigurationBase {
347355
// (undocumented)
@@ -402,6 +410,11 @@ export interface ICobuildLockProvider {
402410
setCompletedStateAsync(context: Readonly<ICobuildContext>, state: ICobuildCompletedState): Promise<void>;
403411
}
404412

413+
// @alpha
414+
export interface IConfigurableOperation extends IBaseOperationExecutionResult {
415+
enabled: boolean;
416+
}
417+
405418
// @public
406419
export interface IConfigurationEnvironment {
407420
[environmentVariableName: string]: IConfigurationEnvironmentVariable;
@@ -419,17 +432,14 @@ export interface ICreateOperationsContext {
419432
readonly changedProjectsOnly: boolean;
420433
readonly cobuildConfiguration: CobuildConfiguration | undefined;
421434
readonly customParameters: ReadonlyMap<string, CommandLineParameter>;
435+
readonly generateFullGraph?: boolean;
422436
readonly includePhaseDeps: boolean;
423-
readonly invalidateOperation?: ((operation: Operation, reason: string) => void) | undefined;
424437
readonly isIncrementalBuildAllowed: boolean;
425-
readonly isInitial: boolean;
426438
readonly isWatch: boolean;
427439
readonly parallelism: number;
428-
readonly phaseOriginal: ReadonlySet<IPhase>;
429440
readonly phaseSelection: ReadonlySet<IPhase>;
430441
readonly projectConfigurations: ReadonlyMap<RushConfigurationProject, RushProjectConfiguration>;
431442
readonly projectSelection: ReadonlySet<RushConfigurationProject>;
432-
readonly projectsInUnknownState: ReadonlySet<RushConfigurationProject>;
433443
readonly rushConfiguration: RushConfiguration;
434444
}
435445

@@ -476,12 +486,6 @@ export interface IEnvironmentConfigurationInitializeOptions {
476486
doNotNormalizePaths?: boolean;
477487
}
478488

479-
// @alpha
480-
export interface IExecuteOperationsContext extends ICreateOperationsContext {
481-
readonly abortController: AbortController;
482-
readonly inputsSnapshot?: IInputsSnapshot;
483-
}
484-
485489
// @alpha
486490
export interface IExecutionResult {
487491
readonly operationResults: ReadonlyMap<Operation, IOperationExecutionResult>;
@@ -614,14 +618,43 @@ export interface _IOperationBuildCacheOptions {
614618
}
615619

616620
// @alpha
617-
export interface IOperationExecutionResult {
621+
export interface IOperationExecutionManager {
622+
readonly abortController: AbortController;
623+
abortCurrentPassAsync(): Promise<void>;
624+
closeRunnersAsync(operations?: Iterable<Operation>): Promise<void>;
625+
debugMode: boolean;
626+
executeQueuedPassAsync(): Promise<boolean>;
627+
readonly hasQueuedPass: boolean;
628+
readonly hooks: OperationExecutionHooks;
629+
invalidateOperations(operations?: Iterable<Operation>, reason?: string): void;
630+
readonly lastExecutionResults: ReadonlyMap<Operation, IOperationExecutionResult>;
631+
readonly operations: ReadonlySet<Operation>;
632+
parallelism: number;
633+
queuePassAsync(options: IOperationExecutionPassOptions): Promise<boolean>;
634+
quietMode: boolean;
635+
runNextPassBehavior: RunNextPassBehavior;
636+
setEnabledStates(operations: Iterable<Operation>, targetState: Operation['enabled'], mode: 'safe' | 'unsafe'): boolean;
637+
readonly status: OperationStatus;
638+
}
639+
640+
// @alpha
641+
export interface IOperationExecutionManagerContext extends ICreateOperationsContext {
642+
readonly initialSnapshot?: IInputsSnapshot;
643+
}
644+
645+
// @alpha
646+
export interface IOperationExecutionPassOptions {
647+
// (undocumented)
648+
inputsSnapshot?: IInputsSnapshot;
649+
startTime?: number;
650+
}
651+
652+
// @alpha
653+
export interface IOperationExecutionResult extends IBaseOperationExecutionResult {
654+
readonly enabled: boolean;
618655
readonly error: Error | undefined;
619-
getStateHash(): string;
620-
getStateHashComponents(): ReadonlyArray<string>;
621656
readonly logFilePaths: ILogFilePaths | undefined;
622-
readonly metadataFolderPath: string | undefined;
623657
readonly nonCachedDurationMs: number | undefined;
624-
readonly operation: Operation;
625658
readonly problemCollector: IProblemCollector;
626659
readonly silent: boolean;
627660
readonly status: OperationStatus;
@@ -653,6 +686,7 @@ export interface _IOperationMetadataManagerOptions {
653686

654687
// @alpha
655688
export interface IOperationOptions {
689+
enabled?: OperationEnabledState;
656690
logFilenameIdentifier: string;
657691
phase: IPhase;
658692
project: RushConfigurationProject;
@@ -663,8 +697,10 @@ export interface IOperationOptions {
663697
// @beta
664698
export interface IOperationRunner {
665699
cacheable: boolean;
666-
executeAsync(context: IOperationRunnerContext): Promise<OperationStatus>;
700+
closeAsync?(): Promise<void>;
701+
executeAsync(context: IOperationRunnerContext, lastState?: {}): Promise<OperationStatus>;
667702
getConfigHash(): string;
703+
readonly isActive?: boolean;
668704
readonly isNoOp?: boolean;
669705
readonly name: string;
670706
reportTiming: boolean;
@@ -751,6 +787,11 @@ export interface IPhasedCommand extends IRushCommand {
751787
readonly sessionAbortController: AbortController;
752788
}
753789

790+
// @alpha
791+
export interface IPhasedCommandPlugin {
792+
apply(hooks: PhasedCommandHooks): void;
793+
}
794+
754795
// @public
755796
export interface IPnpmLockfilePolicies {
756797
disallowInsecureSha1?: {
@@ -994,7 +1035,7 @@ export class Operation {
9941035
readonly consumers: ReadonlySet<Operation>;
9951036
deleteDependency(dependency: Operation): void;
9961037
readonly dependencies: ReadonlySet<Operation>;
997-
enabled: boolean;
1038+
enabled: OperationEnabledState;
9981039
get isNoOp(): boolean;
9991040
logFilenameIdentifier: string;
10001041
get name(): string;
@@ -1008,7 +1049,7 @@ export class _OperationBuildCache {
10081049
// (undocumented)
10091050
get cacheId(): string | undefined;
10101051
// (undocumented)
1011-
static forOperation(executionResult: IOperationExecutionResult, options: _IOperationBuildCacheOptions): _OperationBuildCache;
1052+
static forOperation(executionResult: IBaseOperationExecutionResult, options: _IOperationBuildCacheOptions): _OperationBuildCache;
10121053
// (undocumented)
10131054
static getOperationBuildCache(options: _IProjectBuildCacheOptions): _OperationBuildCache;
10141055
// (undocumented)
@@ -1017,6 +1058,43 @@ export class _OperationBuildCache {
10171058
trySetCacheEntryAsync(terminal: ITerminal, specifiedCacheId?: string): Promise<boolean>;
10181059
}
10191060

1061+
// @alpha
1062+
export type OperationEnabledState = boolean | 'ignore-dependency-changes';
1063+
1064+
// @alpha
1065+
export class OperationExecutionHooks {
1066+
readonly afterExecuteOperationAsync: AsyncSeriesHook<[
1067+
IOperationRunnerContext & IOperationExecutionResult
1068+
]>;
1069+
readonly afterExecuteOperationsAsync: AsyncSeriesWaterfallHook<[
1070+
OperationStatus,
1071+
ReadonlyMap<Operation, IOperationExecutionResult>,
1072+
IOperationExecutionPassOptions
1073+
]>;
1074+
readonly beforeExecuteOperationAsync: AsyncSeriesBailHook<[
1075+
IOperationRunnerContext & IOperationExecutionResult
1076+
], OperationStatus | undefined>;
1077+
readonly beforeExecuteOperationsAsync: AsyncSeriesBailHook<[
1078+
ReadonlyMap<Operation, IOperationExecutionResult>,
1079+
IOperationExecutionPassOptions
1080+
], OperationStatus | undefined | void>;
1081+
readonly configureRun: SyncHook<[
1082+
ReadonlyMap<Operation, IConfigurableOperation>,
1083+
ReadonlyMap<Operation, IOperationExecutionResult>,
1084+
IOperationExecutionPassOptions
1085+
]>;
1086+
readonly createEnvironmentForOperation: SyncWaterfallHook<[
1087+
IEnvironment,
1088+
IOperationRunnerContext & IOperationExecutionResult
1089+
]>;
1090+
readonly onEnableStatesChanged: SyncHook<[ReadonlySet<Operation>]>;
1091+
readonly onExecutionStatesUpdated: SyncHook<[ReadonlySet<IOperationExecutionResult>]>;
1092+
readonly onInvalidateOperations: SyncHook<[Iterable<Operation>, string | undefined]>;
1093+
readonly onManagerStateChanged: SyncHook<[IOperationExecutionManager]>;
1094+
readonly onPassQueued: SyncHook<[ReadonlyMap<Operation, IOperationExecutionResult>]>;
1095+
readonly onWaitingForChanges: SyncHook<void>;
1096+
}
1097+
10201098
// @internal
10211099
export class _OperationMetadataManager {
10221100
constructor(options: _IOperationMetadataManagerOptions);
@@ -1146,26 +1224,15 @@ export abstract class PackageManagerOptionsConfigurationBase implements IPackage
11461224

11471225
// @alpha
11481226
export class PhasedCommandHooks {
1149-
readonly afterExecuteOperation: AsyncSeriesHook<[
1150-
IOperationRunnerContext & IOperationExecutionResult
1151-
]>;
1152-
readonly afterExecuteOperations: AsyncSeriesHook<[IExecutionResult, IExecuteOperationsContext]>;
1153-
readonly beforeExecuteOperation: AsyncSeriesBailHook<[
1154-
IOperationRunnerContext & IOperationExecutionResult
1155-
], OperationStatus | undefined>;
1156-
readonly beforeExecuteOperations: AsyncSeriesHook<[
1157-
Map<Operation, IOperationExecutionResult>,
1158-
IExecuteOperationsContext
1159-
]>;
11601227
readonly beforeLog: SyncHook<ITelemetryData, void>;
1161-
readonly createEnvironmentForOperation: SyncWaterfallHook<[
1162-
IEnvironment,
1163-
IOperationRunnerContext & IOperationExecutionResult
1228+
readonly createOperationsAsync: AsyncSeriesWaterfallHook<[
1229+
Set<Operation>,
1230+
ICreateOperationsContext
1231+
]>;
1232+
readonly executionManagerAsync: AsyncSeriesHook<[
1233+
IOperationExecutionManager,
1234+
IOperationExecutionManagerContext
11641235
]>;
1165-
readonly createOperations: AsyncSeriesWaterfallHook<[Set<Operation>, ICreateOperationsContext]>;
1166-
readonly onOperationStatusChanged: SyncHook<[IOperationExecutionResult]>;
1167-
readonly shutdownAsync: AsyncParallelHook<void>;
1168-
readonly waitingForChanges: SyncHook<void>;
11691236
}
11701237

11711238
// @public
@@ -1229,6 +1296,9 @@ export class RepoStateFile {
12291296
refreshState(rushConfiguration: RushConfiguration, subspace: Subspace | undefined, variant?: string): boolean;
12301297
}
12311298

1299+
// @alpha (undocumented)
1300+
export type RunNextPassBehavior = 'manual' | 'automatic';
1301+
12321302
// @public
12331303
export class Rush {
12341304
static launch(launcherVersion: string, options: ILaunchOptions): void;

0 commit comments

Comments
 (0)