@rushstack/rush-sdk 5.170.1-pr5378.0 → 5.171.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rush-lib.d.ts +132 -457
- package/lib-commonjs/{logic/operations → cli/parsing}/ParseParallelism.js +1 -2
- package/lib-commonjs/index.js +0 -1
- package/lib-commonjs/logic/operations/OperationExecutionManager.js +3 -0
- package/lib-commonjs/logic/operations/OperationStatus.js +0 -1
- package/lib-commonjs/logic/operations/WeightedOperationPlugin.js +3 -0
- package/lib-dts/api/CommandLineConfiguration.d.ts +0 -7
- package/lib-dts/api/CommandLineJson.d.ts +0 -1
- package/lib-dts/api/EventHooks.d.ts +1 -1
- package/lib-dts/cli/parsing/ParseParallelism.d.ts +17 -0
- package/lib-dts/cli/parsing/SelectionParameterSet.d.ts +1 -1
- package/lib-dts/cli/scriptActions/PhasedScriptAction.d.ts +12 -2
- package/lib-dts/index.d.ts +4 -7
- package/lib-dts/logic/ProjectWatcher.d.ts +42 -64
- package/lib-dts/logic/buildCache/OperationBuildCache.d.ts +2 -2
- package/lib-dts/logic/operations/IOperationExecutionResult.d.ts +16 -57
- package/lib-dts/logic/operations/IOperationRunner.d.ts +2 -32
- package/lib-dts/logic/operations/IPCOperationRunner.d.ts +8 -8
- package/lib-dts/logic/operations/Operation.d.ts +14 -50
- package/lib-dts/logic/operations/OperationExecutionManager.d.ts +60 -0
- package/lib-dts/logic/operations/OperationExecutionRecord.d.ts +9 -21
- package/lib-dts/logic/operations/OperationStatus.d.ts +0 -4
- package/lib-dts/logic/operations/ShellOperationRunner.d.ts +5 -6
- package/lib-dts/logic/operations/ShellOperationRunnerPlugin.d.ts +1 -2
- package/lib-dts/logic/operations/ValidateOperationsPlugin.d.ts +3 -1
- package/lib-dts/logic/operations/WeightedOperationPlugin.d.ts +10 -0
- package/lib-dts/pluginFramework/PhasedCommandHooks.d.ts +98 -32
- package/lib-dts/utilities/Stopwatch.d.ts +2 -2
- package/lib-shim/index.js +0 -1
- package/package.json +8 -8
- package/lib-commonjs/logic/operations/IOperationGraph.js +0 -2
- package/lib-commonjs/logic/operations/OperationGraph.js +0 -3
- package/lib-commonjs/pluginFramework/OperationGraphHooks.js +0 -3
- package/lib-dts/logic/operations/IOperationGraph.d.ts +0 -137
- package/lib-dts/logic/operations/OperationGraph.d.ts +0 -125
- package/lib-dts/logic/operations/ParseParallelism.d.ts +0 -33
- package/lib-dts/pluginFramework/OperationGraphHooks.d.ts +0 -129
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { type TerminalWritable } from '@rushstack/terminal';
|
|
2
|
-
import type { Operation } from './Operation';
|
|
3
|
-
import { OperationStatus } from './OperationStatus';
|
|
4
|
-
import { OperationExecutionRecord } from './OperationExecutionRecord';
|
|
5
|
-
import type { IExecutionResult } from './IOperationExecutionResult';
|
|
6
|
-
import type { IInputsSnapshot } from '../incremental/InputsSnapshot';
|
|
7
|
-
import type { IOperationGraph, IOperationGraphIterationOptions } from './IOperationGraph';
|
|
8
|
-
import { OperationGraphHooks } from '../../pluginFramework/OperationGraphHooks';
|
|
9
|
-
import { type Parallelism } from './ParseParallelism';
|
|
10
|
-
import type { ITelemetryData } from '../Telemetry';
|
|
11
|
-
export interface IOperationGraphTelemetry {
|
|
12
|
-
initialExtraData: Record<string, unknown>;
|
|
13
|
-
changedProjectsOnlyKey: string | undefined;
|
|
14
|
-
nameForLog: string;
|
|
15
|
-
log: (telemetry: ITelemetryData) => void;
|
|
16
|
-
}
|
|
17
|
-
export interface IOperationGraphOptions {
|
|
18
|
-
quietMode: boolean;
|
|
19
|
-
debugMode: boolean;
|
|
20
|
-
parallelism: Parallelism;
|
|
21
|
-
allowOversubscription: boolean;
|
|
22
|
-
destinations: Iterable<TerminalWritable>;
|
|
23
|
-
/** Optional maximum allowed parallelism. Defaults to `getNumberOfCores()`. */
|
|
24
|
-
maxParallelism?: number;
|
|
25
|
-
/**
|
|
26
|
-
* Controller used to signal abortion of the entire execution session (e.g. terminating watch mode).
|
|
27
|
-
* Consumers (e.g. ProjectWatcher) can subscribe to this to perform cleanup.
|
|
28
|
-
*/
|
|
29
|
-
abortController: AbortController;
|
|
30
|
-
isWatch?: boolean;
|
|
31
|
-
pauseNextIteration?: boolean;
|
|
32
|
-
telemetry?: IOperationGraphTelemetry;
|
|
33
|
-
getInputsSnapshotAsync?: () => Promise<IInputsSnapshot | undefined>;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* A class which manages the execution of a set of tasks with interdependencies.
|
|
37
|
-
*/
|
|
38
|
-
export declare class OperationGraph implements IOperationGraph {
|
|
39
|
-
readonly hooks: OperationGraphHooks;
|
|
40
|
-
readonly operations: Set<Operation>;
|
|
41
|
-
readonly abortController: AbortController;
|
|
42
|
-
private readonly _sortedOperations;
|
|
43
|
-
resultByOperation: Map<Operation, OperationExecutionRecord>;
|
|
44
|
-
private _parallelism;
|
|
45
|
-
private _maxParallelism;
|
|
46
|
-
private _debugMode;
|
|
47
|
-
private _quietMode;
|
|
48
|
-
private _allowOversubscription;
|
|
49
|
-
private _pauseNextIteration;
|
|
50
|
-
private readonly _isWatch;
|
|
51
|
-
private readonly _telemetry;
|
|
52
|
-
private readonly _getInputsSnapshotAsync;
|
|
53
|
-
/**
|
|
54
|
-
* Records invalidated during the current iteration that could not be marked `Ready` immediately
|
|
55
|
-
* because their record object is shared between `resultByOperation` and the active iteration's
|
|
56
|
-
* `records` map (mutating it mid-iteration would corrupt the summarizer's view of results).
|
|
57
|
-
* Maps each record to the invalidation reason; applied once the iteration completes.
|
|
58
|
-
*/
|
|
59
|
-
private readonly _deferredInvalidations;
|
|
60
|
-
private _currentIteration;
|
|
61
|
-
private _scheduledIteration;
|
|
62
|
-
private _terminalSplitter;
|
|
63
|
-
private _idleTimeout;
|
|
64
|
-
/** Tracks if a graph state change notification has been scheduled for next tick. */
|
|
65
|
-
private _graphStateChangeScheduled;
|
|
66
|
-
private _status;
|
|
67
|
-
constructor(operations: Set<Operation>, options: IOperationGraphOptions);
|
|
68
|
-
/**
|
|
69
|
-
* {@inheritDoc IOperationGraph.setEnabledStates}
|
|
70
|
-
*/
|
|
71
|
-
setEnabledStates(operations: Iterable<Operation>, targetState: Operation['enabled'], mode: 'safe' | 'unsafe'): boolean;
|
|
72
|
-
get parallelism(): number;
|
|
73
|
-
set parallelism(value: Parallelism);
|
|
74
|
-
get debugMode(): boolean;
|
|
75
|
-
set debugMode(value: boolean);
|
|
76
|
-
get quietMode(): boolean;
|
|
77
|
-
set quietMode(value: boolean);
|
|
78
|
-
get allowOversubscription(): boolean;
|
|
79
|
-
set allowOversubscription(value: boolean);
|
|
80
|
-
get pauseNextIteration(): boolean;
|
|
81
|
-
set pauseNextIteration(value: boolean);
|
|
82
|
-
get hasScheduledIteration(): boolean;
|
|
83
|
-
get status(): OperationStatus;
|
|
84
|
-
get terminalDestinations(): ReadonlySet<TerminalWritable>;
|
|
85
|
-
private _setStatus;
|
|
86
|
-
private _setScheduledIteration;
|
|
87
|
-
closeRunnersAsync(operations?: Operation[]): Promise<void>;
|
|
88
|
-
invalidateOperations(operations?: Iterable<Operation>, reason?: string): void;
|
|
89
|
-
/**
|
|
90
|
-
* Shorthand for scheduling an iteration then executing it.
|
|
91
|
-
* Call `abortCurrentIterationAsync()` to cancel the execution of any operations that have not yet begun execution.
|
|
92
|
-
* @param iterationOptions - Options for this execution iteration.
|
|
93
|
-
* @returns A promise which is resolved when all operations have been processed to a final state.
|
|
94
|
-
*/
|
|
95
|
-
executeAsync(iterationOptions: IOperationGraphIterationOptions): Promise<IExecutionResult>;
|
|
96
|
-
/**
|
|
97
|
-
* Queues a new execution iteration.
|
|
98
|
-
* @param iterationOptions - Options for this execution iteration.
|
|
99
|
-
* @returns A promise that resolves to true if the iteration was successfully queued, or false if it was not.
|
|
100
|
-
*/
|
|
101
|
-
scheduleIterationAsync(iterationOptions: IOperationGraphIterationOptions): Promise<boolean>;
|
|
102
|
-
/**
|
|
103
|
-
* Executes all operations which have been registered, returning a promise which is resolved when all operations have been processed to a final state.
|
|
104
|
-
* Aborts the current iteration first, if any.
|
|
105
|
-
*/
|
|
106
|
-
executeScheduledIterationAsync(): Promise<boolean>;
|
|
107
|
-
abortCurrentIterationAsync(): Promise<void>;
|
|
108
|
-
addTerminalDestination(destination: TerminalWritable): void;
|
|
109
|
-
removeTerminalDestination(destination: TerminalWritable, close?: boolean): boolean;
|
|
110
|
-
private _setIdleTimeout;
|
|
111
|
-
private _onIdle;
|
|
112
|
-
private _scheduleIterationAsync;
|
|
113
|
-
/**
|
|
114
|
-
* Debounce configuration change notifications so that multiple property setters invoked within the same tick
|
|
115
|
-
* only trigger the hook once. This avoids redundant re-computation in listeners (e.g. UI refresh) while preserving
|
|
116
|
-
* ordering guarantees that the notification occurs after the initiating state changes are fully applied.
|
|
117
|
-
*/
|
|
118
|
-
private _scheduleManagerStateChanged;
|
|
119
|
-
/**
|
|
120
|
-
* Executes all operations which have been registered, returning a promise which is resolved when all operations have been processed to a final state.
|
|
121
|
-
* The abortController can be used to cancel the execution of any operations that have not yet begun execution.
|
|
122
|
-
*/
|
|
123
|
-
private _executeInnerAsync;
|
|
124
|
-
}
|
|
125
|
-
//# sourceMappingURL=OperationGraph.d.ts.map
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export declare function getNumberOfCores(): number;
|
|
2
|
-
/**
|
|
3
|
-
* A parallelism value expressed as a fraction of total available concurrency slots.
|
|
4
|
-
* @beta
|
|
5
|
-
*/
|
|
6
|
-
export interface IParallelismScalar {
|
|
7
|
-
readonly scalar: number;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* A parallelism value, either as an absolute integer count or a scalar fraction of available parallelism.
|
|
11
|
-
* @beta
|
|
12
|
-
*/
|
|
13
|
-
export type Parallelism = number | IParallelismScalar;
|
|
14
|
-
/**
|
|
15
|
-
* Since the JSON value is a string, it must be a percentage like "50%",
|
|
16
|
-
* which we parse into a scalar in the range (0, 1].
|
|
17
|
-
* The caller is responsible for multiplying by the available parallelism.
|
|
18
|
-
*/
|
|
19
|
-
export declare function parseParallelismPercent(weight: string): number;
|
|
20
|
-
/**
|
|
21
|
-
* Coerces a `Parallelism` value to a concrete integer number of concurrency units, given the
|
|
22
|
-
* maximum number of available slots.
|
|
23
|
-
*
|
|
24
|
-
* - Raw numeric values are clamped to `[minimum, maxParallelism]`.
|
|
25
|
-
* - Scalar values are multiplied by `maxParallelism`, floored, and clamped to `[Math.max(1, minimum), maxParallelism]`.
|
|
26
|
-
*/
|
|
27
|
-
export declare function coerceParallelism(parallelism: Parallelism, maxParallelism: number, minimum?: number): number;
|
|
28
|
-
/**
|
|
29
|
-
* Parses a command line specification for desired parallelism.
|
|
30
|
-
* Factored out to enable unit tests
|
|
31
|
-
*/
|
|
32
|
-
export declare function parseParallelism(rawParallelism: string | undefined): Parallelism;
|
|
33
|
-
//# sourceMappingURL=ParseParallelism.d.ts.map
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { AsyncSeriesBailHook, AsyncSeriesHook, AsyncSeriesWaterfallHook, SyncHook, SyncWaterfallHook } from 'tapable';
|
|
2
|
-
import type { Operation } from '../logic/operations/Operation';
|
|
3
|
-
import type { IOperationExecutionResult, IConfigurableOperation } from '../logic/operations/IOperationExecutionResult';
|
|
4
|
-
import type { OperationStatus } from '../logic/operations/OperationStatus';
|
|
5
|
-
import type { IOperationRunnerContext } from '../logic/operations/IOperationRunner';
|
|
6
|
-
import type { ITelemetryData } from '../logic/Telemetry';
|
|
7
|
-
import type { IEnvironment } from '../utilities/Utilities';
|
|
8
|
-
import type { IOperationGraph, IOperationGraphIterationOptions } from '../logic/operations/IOperationGraph';
|
|
9
|
-
/**
|
|
10
|
-
* Hooks into the execution process for operations within the graph.
|
|
11
|
-
*
|
|
12
|
-
* Per-iteration lifecycle:
|
|
13
|
-
* 1. `configureIteration` - Synchronously decide which operations to enable for the next iteration.
|
|
14
|
-
* 2. `onIterationScheduled` - Fires after the iteration is prepared but before execution begins, if it has any enabled operations.
|
|
15
|
-
* 3. `beforeExecuteIterationAsync` - Async hook that can bail out the iteration entirely.
|
|
16
|
-
* 4. Operations execute (status changes reported via `onExecutionStatesUpdated`).
|
|
17
|
-
* 5. `afterExecuteIterationAsync` - Fires after all operations in the iteration have settled.
|
|
18
|
-
* 6. `onIdle` - Fires when the graph enters idle state awaiting changes (watch mode only).
|
|
19
|
-
*
|
|
20
|
-
* Additional hooks:
|
|
21
|
-
* - `onEnableStatesChanged` - Fires when `setEnabledStates` mutates operation enabled flags.
|
|
22
|
-
* - `onInvalidateOperations` - Fires when operations are invalidated (e.g. by file watchers).
|
|
23
|
-
* - `onGraphStateChanged` - Fires on any observable graph state change.
|
|
24
|
-
*
|
|
25
|
-
* @alpha
|
|
26
|
-
*/
|
|
27
|
-
export declare class OperationGraphHooks {
|
|
28
|
-
/**
|
|
29
|
-
* Hook invoked to decide what work a potential new iteration contains.
|
|
30
|
-
* Use the `lastExecutedRecords` to determine which operations are new or have had their inputs changed.
|
|
31
|
-
* Set the `enabled` states on the values in `initialRecords` to control which operations will be executed.
|
|
32
|
-
*
|
|
33
|
-
* @remarks
|
|
34
|
-
* This hook is synchronous to guarantee that the `lastExecutedRecords` map remains stable for the
|
|
35
|
-
* duration of configuration. This hook often executes while an execution iteration is currently running, so
|
|
36
|
-
* operations could complete if there were async ticks during the configuration phase.
|
|
37
|
-
*
|
|
38
|
-
* If no operations are marked for execution, the iteration will not be scheduled.
|
|
39
|
-
* If there is an existing scheduled iteration, it will remain.
|
|
40
|
-
*/
|
|
41
|
-
readonly configureIteration: SyncHook<[
|
|
42
|
-
ReadonlyMap<Operation, IConfigurableOperation>,
|
|
43
|
-
ReadonlyMap<Operation, IOperationExecutionResult>,
|
|
44
|
-
IOperationGraphIterationOptions
|
|
45
|
-
]>;
|
|
46
|
-
/**
|
|
47
|
-
* Hook invoked before operation start for an iteration. Allows a plugin to perform side-effects or
|
|
48
|
-
* short-circuit the entire iteration.
|
|
49
|
-
*
|
|
50
|
-
* If any tap returns an {@link OperationStatus}, the remaining taps are skipped and the iteration will
|
|
51
|
-
* end immediately with that status. All operations which have not yet executed will be marked
|
|
52
|
-
* Aborted.
|
|
53
|
-
*/
|
|
54
|
-
readonly beforeExecuteIterationAsync: AsyncSeriesBailHook<[
|
|
55
|
-
ReadonlyMap<Operation, IOperationExecutionResult>,
|
|
56
|
-
IOperationGraphIterationOptions
|
|
57
|
-
], OperationStatus | undefined | void>;
|
|
58
|
-
/**
|
|
59
|
-
* Batched hook invoked when one or more operation statuses have changed during the same microtask.
|
|
60
|
-
* The hook receives an array of the operation execution results that changed status.
|
|
61
|
-
* @remarks
|
|
62
|
-
* This hook is batched to reduce noise when updating many operations synchronously in quick succession.
|
|
63
|
-
*/
|
|
64
|
-
readonly onExecutionStatesUpdated: SyncHook<[ReadonlySet<IOperationExecutionResult>]>;
|
|
65
|
-
/**
|
|
66
|
-
* Hook invoked when one or more operations have their enabled state mutated via
|
|
67
|
-
* {@link IOperationGraph.setEnabledStates}. Provides the set of operations whose
|
|
68
|
-
* enabled state actually changed.
|
|
69
|
-
*/
|
|
70
|
-
readonly onEnableStatesChanged: SyncHook<[ReadonlySet<Operation>]>;
|
|
71
|
-
/**
|
|
72
|
-
* Hook invoked immediately after a new execution iteration is scheduled (i.e. operations selected and prepared),
|
|
73
|
-
* before any operations in that iteration have started executing. Can be used to snapshot planned work,
|
|
74
|
-
* drive UIs, or pre-compute auxiliary data.
|
|
75
|
-
*/
|
|
76
|
-
readonly onIterationScheduled: SyncHook<[ReadonlyMap<Operation, IOperationExecutionResult>]>;
|
|
77
|
-
/**
|
|
78
|
-
* Hook invoked when any observable state on the operation graph changes.
|
|
79
|
-
* This includes configuration mutations (parallelism, quiet/debug modes, pauseNextIteration)
|
|
80
|
-
* as well as dynamic state (status transitions, scheduled iteration availability, etc.).
|
|
81
|
-
* Hook is series for stable output.
|
|
82
|
-
*/
|
|
83
|
-
readonly onGraphStateChanged: SyncHook<[IOperationGraph]>;
|
|
84
|
-
/**
|
|
85
|
-
* Hook invoked when operations are invalidated for any reason.
|
|
86
|
-
*/
|
|
87
|
-
readonly onInvalidateOperations: SyncHook<[Iterable<Operation>, string | undefined]>;
|
|
88
|
-
/**
|
|
89
|
-
* Hook invoked after an iteration has finished and the command is watching for changes.
|
|
90
|
-
* May be used to display additional relevant data to the user.
|
|
91
|
-
* Only relevant when running in watch mode.
|
|
92
|
-
*/
|
|
93
|
-
readonly onIdle: SyncHook<void>;
|
|
94
|
-
/**
|
|
95
|
-
* Hook invoked after executing a set of operations.
|
|
96
|
-
* Hook is series for stable output.
|
|
97
|
-
*/
|
|
98
|
-
readonly afterExecuteIterationAsync: AsyncSeriesWaterfallHook<[
|
|
99
|
-
OperationStatus,
|
|
100
|
-
ReadonlyMap<Operation, IOperationExecutionResult>,
|
|
101
|
-
IOperationGraphIterationOptions
|
|
102
|
-
]>;
|
|
103
|
-
/**
|
|
104
|
-
* Hook invoked after executing an iteration, before the telemetry entry is written.
|
|
105
|
-
* Allows the caller to augment or modify the log entry.
|
|
106
|
-
*/
|
|
107
|
-
readonly beforeLog: SyncHook<ITelemetryData, void>;
|
|
108
|
-
/**
|
|
109
|
-
* Hook invoked before executing a operation.
|
|
110
|
-
*/
|
|
111
|
-
readonly beforeExecuteOperationAsync: AsyncSeriesBailHook<[
|
|
112
|
-
IOperationRunnerContext & IOperationExecutionResult
|
|
113
|
-
], OperationStatus | undefined>;
|
|
114
|
-
/**
|
|
115
|
-
* Hook invoked to define environment variables for an operation.
|
|
116
|
-
* May be invoked by the runner to get the environment for the operation.
|
|
117
|
-
*/
|
|
118
|
-
readonly createEnvironmentForOperation: SyncWaterfallHook<[
|
|
119
|
-
IEnvironment,
|
|
120
|
-
IOperationRunnerContext & IOperationExecutionResult
|
|
121
|
-
]>;
|
|
122
|
-
/**
|
|
123
|
-
* Hook invoked after executing a operation.
|
|
124
|
-
*/
|
|
125
|
-
readonly afterExecuteOperationAsync: AsyncSeriesHook<[
|
|
126
|
-
IOperationRunnerContext & IOperationExecutionResult
|
|
127
|
-
]>;
|
|
128
|
-
}
|
|
129
|
-
//# sourceMappingURL=OperationGraphHooks.d.ts.map
|