@rushstack/rush-sdk 5.169.3 → 5.170.1-pr5378.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 +470 -133
- package/dist/tsdoc-metadata.json +1 -1
- package/lib-commonjs/index.js +1 -0
- package/lib-commonjs/logic/operations/IOperationGraph.js +2 -0
- package/lib-commonjs/logic/operations/OperationGraph.js +3 -0
- package/lib-commonjs/logic/operations/OperationStatus.js +1 -0
- package/lib-commonjs/logic/operations/ParseParallelism.js +6 -0
- package/lib-commonjs/pluginFramework/OperationGraphHooks.js +3 -0
- package/lib-dts/api/CommandLineConfiguration.d.ts +7 -0
- package/lib-dts/api/CommandLineJson.d.ts +1 -0
- package/lib-dts/api/EnvironmentConfiguration.d.ts +12 -0
- package/lib-dts/api/EventHooks.d.ts +1 -1
- package/lib-dts/api/RushProjectConfiguration.d.ts +1 -1
- package/lib-dts/cli/parsing/SelectionParameterSet.d.ts +1 -1
- package/lib-dts/cli/scriptActions/PhasedScriptAction.d.ts +2 -12
- package/lib-dts/index.d.ts +7 -4
- package/lib-dts/logic/ProjectWatcher.d.ts +64 -42
- package/lib-dts/logic/buildCache/OperationBuildCache.d.ts +2 -2
- package/lib-dts/logic/operations/IOperationExecutionResult.d.ts +57 -16
- package/lib-dts/logic/operations/IOperationGraph.d.ts +137 -0
- package/lib-dts/logic/operations/IOperationRunner.d.ts +32 -2
- package/lib-dts/logic/operations/IPCOperationRunner.d.ts +8 -8
- package/lib-dts/logic/operations/Operation.d.ts +50 -14
- package/lib-dts/logic/operations/OperationExecutionRecord.d.ts +21 -9
- package/lib-dts/logic/operations/OperationGraph.d.ts +125 -0
- package/lib-dts/logic/operations/OperationStatus.d.ts +4 -0
- package/lib-dts/logic/operations/ParseParallelism.d.ts +33 -0
- package/lib-dts/logic/operations/ShellOperationRunner.d.ts +6 -5
- package/lib-dts/logic/operations/ShellOperationRunnerPlugin.d.ts +2 -1
- package/lib-dts/logic/operations/ValidateOperationsPlugin.d.ts +1 -3
- package/lib-dts/pluginFramework/OperationGraphHooks.d.ts +129 -0
- package/lib-dts/pluginFramework/PhasedCommandHooks.d.ts +32 -98
- package/lib-dts/utilities/Stopwatch.d.ts +2 -2
- package/lib-shim/index.js +32 -2
- package/lib-shim/index.js.map +1 -1
- package/package.json +13 -13
- package/lib-commonjs/cli/parsing/ParseParallelism.js +0 -3
- package/lib-commonjs/logic/operations/OperationExecutionManager.js +0 -3
- package/lib-commonjs/logic/operations/WeightedOperationPlugin.js +0 -3
- package/lib-dts/cli/parsing/ParseParallelism.d.ts +0 -6
- package/lib-dts/logic/operations/OperationExecutionManager.d.ts +0 -60
- package/lib-dts/logic/operations/WeightedOperationPlugin.d.ts +0 -10
package/dist/tsdoc-metadata.json
CHANGED
package/lib-commonjs/index.js
CHANGED
|
@@ -25,6 +25,7 @@ exports.LockStepVersionPolicy = _m.LockStepVersionPolicy;
|
|
|
25
25
|
exports.LookupByPath = _m.LookupByPath;
|
|
26
26
|
exports.NpmOptionsConfiguration = _m.NpmOptionsConfiguration;
|
|
27
27
|
exports.Operation = _m.Operation;
|
|
28
|
+
exports.OperationGraphHooks = _m.OperationGraphHooks;
|
|
28
29
|
exports.OperationStatus = _m.OperationStatus;
|
|
29
30
|
exports.PackageJsonDependency = _m.PackageJsonDependency;
|
|
30
31
|
exports.PackageJsonDependencyMeta = _m.PackageJsonDependencyMeta;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const _m = require("../../../lib-shim/index.js")._rushSdk_loadInternalModule("logic/operations/OperationStatus");
|
|
2
2
|
module.exports = _m;
|
|
3
3
|
exports.OperationStatus = _m.OperationStatus;
|
|
4
|
+
exports.SUCCESS_STATUSES = _m.SUCCESS_STATUSES;
|
|
4
5
|
exports.TERMINAL_STATUSES = _m.TERMINAL_STATUSES;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const _m = require("../../../lib-shim/index.js")._rushSdk_loadInternalModule("logic/operations/ParseParallelism");
|
|
2
|
+
module.exports = _m;
|
|
3
|
+
exports.coerceParallelism = _m.coerceParallelism;
|
|
4
|
+
exports.getNumberOfCores = _m.getNumberOfCores;
|
|
5
|
+
exports.parseParallelism = _m.parseParallelism;
|
|
6
|
+
exports.parseParallelismPercent = _m.parseParallelismPercent;
|
|
@@ -85,6 +85,13 @@ export interface IPhasedCommandConfig extends IPhasedCommandWithoutPhasesJson, I
|
|
|
85
85
|
* How many milliseconds to wait after receiving a file system notification before executing in watch mode.
|
|
86
86
|
*/
|
|
87
87
|
watchDebounceMs?: number;
|
|
88
|
+
/**
|
|
89
|
+
* If true, when running this command in watch mode the operation graph will include every project
|
|
90
|
+
* in the repository (respecting phase selection), but only the projects selected by the user's
|
|
91
|
+
* CLI project selection parameters will be initially enabled. Other projects will remain disabled
|
|
92
|
+
* unless they become required or are explicitly selected in a subsequent pass.
|
|
93
|
+
*/
|
|
94
|
+
includeAllProjectsInWatchGraph?: boolean;
|
|
88
95
|
/**
|
|
89
96
|
* If set to `true`, then this phased command will always perform an install before executing, regardless of CLI flags.
|
|
90
97
|
* If set to `false`, then Rush will define a built-in "--install" CLI flag for this command.
|
|
@@ -211,6 +211,12 @@ export declare const EnvironmentVariableNames: {
|
|
|
211
211
|
* if Rush did not explicitly pass along command-line parameters to their process.
|
|
212
212
|
*/
|
|
213
213
|
readonly RUSH_INVOKED_ARGS: "RUSH_INVOKED_ARGS";
|
|
214
|
+
/**
|
|
215
|
+
* When set to `1` or `true`, this environment variable is equivalent to passing the `--quiet` flag
|
|
216
|
+
* to `rush`, `rushx`, and `install-run-rush.ts`. It suppresses informational startup messages
|
|
217
|
+
* while preserving error output.
|
|
218
|
+
*/
|
|
219
|
+
readonly RUSH_QUIET_MODE: "RUSH_QUIET_MODE";
|
|
214
220
|
};
|
|
215
221
|
/**
|
|
216
222
|
* Provides Rush-specific environment variable data. All Rush environment variables must start with "RUSH_". This class
|
|
@@ -239,6 +245,7 @@ export declare class EnvironmentConfiguration {
|
|
|
239
245
|
private static _cobuildLeafProjectLogOnlyAllowed;
|
|
240
246
|
private static _gitBinaryPath;
|
|
241
247
|
private static _tarBinaryPath;
|
|
248
|
+
private static _quietMode;
|
|
242
249
|
/**
|
|
243
250
|
* If true, the environment configuration has been validated and initialized.
|
|
244
251
|
*/
|
|
@@ -331,6 +338,11 @@ export declare class EnvironmentConfiguration {
|
|
|
331
338
|
* See {@link EnvironmentVariableNames.RUSH_TAR_BINARY_PATH}
|
|
332
339
|
*/
|
|
333
340
|
static get tarBinaryPath(): string | undefined;
|
|
341
|
+
/**
|
|
342
|
+
* If `true`, Rush will suppress informational startup messages, equivalent to passing `--quiet`.
|
|
343
|
+
* See {@link EnvironmentVariableNames.RUSH_QUIET_MODE}
|
|
344
|
+
*/
|
|
345
|
+
static get quietMode(): boolean;
|
|
334
346
|
/**
|
|
335
347
|
* The front-end RushVersionSelector relies on `RUSH_GLOBAL_FOLDER`, so its value must be read before
|
|
336
348
|
* `EnvironmentConfiguration` is initialized (and actually before the correct version of `EnvironmentConfiguration`
|
|
@@ -131,7 +131,7 @@ export interface IOperationSettings {
|
|
|
131
131
|
* How many concurrency units this operation should take up during execution. The maximum concurrent units is
|
|
132
132
|
* determined by the -p flag.
|
|
133
133
|
*/
|
|
134
|
-
weight?: number
|
|
134
|
+
weight?: number | `${number}%`;
|
|
135
135
|
/**
|
|
136
136
|
* If true, this operation can use cobuilds for orchestration without restoring build cache entries.
|
|
137
137
|
*/
|
|
@@ -46,7 +46,7 @@ export declare class SelectionParameterSet {
|
|
|
46
46
|
*
|
|
47
47
|
* If no parameters are specified, returns all projects in the Rush config file.
|
|
48
48
|
*/
|
|
49
|
-
getSelectedProjectsAsync(terminal: ITerminal): Promise<Set<RushConfigurationProject>>;
|
|
49
|
+
getSelectedProjectsAsync(terminal: ITerminal, allowEmptySelection?: boolean): Promise<Set<RushConfigurationProject>>;
|
|
50
50
|
/**
|
|
51
51
|
* Represents the selection as `--filter` parameters to pnpm.
|
|
52
52
|
*
|
|
@@ -13,6 +13,7 @@ export interface IPhasedScriptActionOptions extends IBaseScriptActionOptions<IPh
|
|
|
13
13
|
originalPhases: Set<IPhase>;
|
|
14
14
|
initialPhases: Set<IPhase>;
|
|
15
15
|
watchPhases: Set<IPhase>;
|
|
16
|
+
includeAllProjectsInWatchGraph: boolean;
|
|
16
17
|
phases: Map<string, IPhase>;
|
|
17
18
|
alwaysWatch: boolean;
|
|
18
19
|
alwaysInstall: boolean | undefined;
|
|
@@ -44,10 +45,9 @@ export declare class PhasedScriptAction extends BaseScriptAction<IPhasedCommandC
|
|
|
44
45
|
private readonly _watchDebounceMs;
|
|
45
46
|
private readonly _alwaysWatch;
|
|
46
47
|
private readonly _alwaysInstall;
|
|
48
|
+
private readonly _includeAllProjectsInWatchGraph;
|
|
47
49
|
private readonly _knownPhases;
|
|
48
50
|
private readonly _terminal;
|
|
49
|
-
private _changedProjectsOnly;
|
|
50
|
-
private _executionAbortController;
|
|
51
51
|
private readonly _changedProjectsOnlyParameter;
|
|
52
52
|
private readonly _selectionParameters;
|
|
53
53
|
private readonly _verboseParameter;
|
|
@@ -64,16 +64,6 @@ export declare class PhasedScriptAction extends BaseScriptAction<IPhasedCommandC
|
|
|
64
64
|
private readonly _includePhaseDeps;
|
|
65
65
|
constructor(options: IPhasedScriptActionOptions);
|
|
66
66
|
runAsync(): Promise<void>;
|
|
67
|
-
private _runInitialPhasesAsync;
|
|
68
|
-
private _registerWatchModeInterface;
|
|
69
|
-
/**
|
|
70
|
-
* Runs the command in watch mode. Fundamentally is a simple loop:
|
|
71
|
-
* 1) Wait for a change to one or more projects in the selection
|
|
72
|
-
* 2) Invoke the command on the changed projects, and, if applicable, impacted projects
|
|
73
|
-
* Uses the same algorithm as --impacted-by
|
|
74
|
-
* 3) Goto (1)
|
|
75
|
-
*/
|
|
76
|
-
private _runWatchPhasesAsync;
|
|
77
67
|
/**
|
|
78
68
|
* Runs a set of operations and reports the results.
|
|
79
69
|
*/
|
package/lib-dts/index.d.ts
CHANGED
|
@@ -40,14 +40,17 @@ export { ExperimentsConfiguration, type IExperimentsJson } from './api/Experimen
|
|
|
40
40
|
export { CustomTipsConfiguration, CustomTipId, type ICustomTipsJson, type ICustomTipInfo, type ICustomTipItemJson, CustomTipSeverity, CustomTipType } from './api/CustomTipsConfiguration';
|
|
41
41
|
export { ProjectChangeAnalyzer, type IGetChangedProjectsOptions } from './logic/ProjectChangeAnalyzer';
|
|
42
42
|
export type { IInputsSnapshot, GetInputsSnapshotAsyncFn as GetInputsSnapshotAsyncFn, IRushConfigurationProjectForSnapshot } from './logic/incremental/InputsSnapshot';
|
|
43
|
-
export type { IOperationRunner, IOperationRunnerContext } from './logic/operations/IOperationRunner';
|
|
44
|
-
export type { IExecutionResult, IOperationExecutionResult } from './logic/operations/IOperationExecutionResult';
|
|
45
|
-
export { type IOperationOptions, Operation } from './logic/operations/Operation';
|
|
43
|
+
export type { IOperationRunner, IOperationRunnerContext, IOperationLastState } from './logic/operations/IOperationRunner';
|
|
44
|
+
export type { IConfigurableOperation, IBaseOperationExecutionResult, IExecutionResult, IOperationExecutionResult, IOperationStateHashComponents } from './logic/operations/IOperationExecutionResult';
|
|
45
|
+
export { type IOperationOptions, type OperationEnabledState, Operation } from './logic/operations/Operation';
|
|
46
|
+
export { type IParallelismScalar, type Parallelism } from './logic/operations/ParseParallelism';
|
|
46
47
|
export { OperationStatus } from './logic/operations/OperationStatus';
|
|
47
48
|
export type { ILogFilePaths } from './logic/operations/ProjectLogWritable';
|
|
48
49
|
export { RushSession, type IRushSessionOptions, type CloudBuildCacheProviderFactory, type CobuildLockProviderFactory } from './pluginFramework/RushSession';
|
|
49
50
|
export { type IRushCommand, type IGlobalCommand, type IPhasedCommand, RushLifecycleHooks } from './pluginFramework/RushLifeCycle';
|
|
50
|
-
export { type ICreateOperationsContext, type
|
|
51
|
+
export { type ICreateOperationsContext, type IOperationGraphContext, type IPhasedCommandPlugin, PhasedCommandHooks } from './pluginFramework/PhasedCommandHooks';
|
|
52
|
+
export type { IOperationGraph, IOperationGraphIterationOptions } from './logic/operations/IOperationGraph';
|
|
53
|
+
export { OperationGraphHooks } from './pluginFramework/OperationGraphHooks';
|
|
51
54
|
export type { IRushPlugin } from './pluginFramework/IRushPlugin';
|
|
52
55
|
export type { IBuiltInPluginConfiguration as _IBuiltInPluginConfiguration } from './pluginFramework/PluginLoader/BuiltInPluginLoader';
|
|
53
56
|
export type { IRushPluginConfigurationBase as _IRushPluginConfigurationBase } from './api/RushPluginsConfiguration';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { type ITerminal } from '@rushstack/terminal';
|
|
2
|
-
import type { IInputsSnapshot
|
|
2
|
+
import type { IInputsSnapshot } from './incremental/InputsSnapshot';
|
|
3
3
|
import type { RushConfiguration } from '../api/RushConfiguration';
|
|
4
4
|
import type { RushConfigurationProject } from '../api/RushConfigurationProject';
|
|
5
|
+
import type { IOperationGraph } from './operations/IOperationGraph';
|
|
5
6
|
export interface IProjectWatcherOptions {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
debounceMs?: number;
|
|
7
|
+
graph: IOperationGraph;
|
|
8
|
+
debounceMs: number;
|
|
9
9
|
rushConfiguration: RushConfiguration;
|
|
10
|
-
projectsToWatch: ReadonlySet<RushConfigurationProject>;
|
|
11
10
|
terminal: ITerminal;
|
|
12
|
-
|
|
11
|
+
/** Initial inputs snapshot; required so watcher can enumerate nested folders immediately */
|
|
12
|
+
initialSnapshot: IInputsSnapshot;
|
|
13
13
|
}
|
|
14
14
|
export interface IProjectChangeResult {
|
|
15
15
|
/**
|
|
@@ -25,59 +25,81 @@ export interface IPromptGeneratorFunction {
|
|
|
25
25
|
(isPaused: boolean): Iterable<string>;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* Watches a set of projects in the repository for file changes and triggers
|
|
29
|
+
* rebuild iterations on the operation graph.
|
|
29
30
|
*
|
|
30
|
-
*
|
|
31
|
-
* signal
|
|
32
|
-
* is responsible for change detection in all incremental builds) to determine what actually chanaged.
|
|
33
|
-
*
|
|
34
|
-
* Calling `waitForChange()` will return a promise that resolves when the package-deps of one or
|
|
35
|
-
* more projects differ from the value the previous time it was invoked. The first time will always resolve with the full selection.
|
|
31
|
+
* Uses `fs.watch()` rather than `chokidar` because only a boolean "something changed"
|
|
32
|
+
* signal is needed; actual change detection is deferred to `getInputsSnapshotAsync`.
|
|
36
33
|
*/
|
|
37
34
|
export declare class ProjectWatcher {
|
|
38
|
-
private readonly _abortSignal;
|
|
39
|
-
private readonly _getInputsSnapshotAsync;
|
|
40
35
|
private readonly _debounceMs;
|
|
41
|
-
private readonly _repoRoot;
|
|
42
36
|
private readonly _rushConfiguration;
|
|
43
|
-
private readonly _projectsToWatch;
|
|
44
37
|
private readonly _terminal;
|
|
45
|
-
private
|
|
46
|
-
private
|
|
47
|
-
private
|
|
48
|
-
private
|
|
49
|
-
private
|
|
50
|
-
private
|
|
38
|
+
private readonly _graph;
|
|
39
|
+
private _repoRoot;
|
|
40
|
+
private _watchers;
|
|
41
|
+
private _closePromises;
|
|
42
|
+
private _debounceHandle;
|
|
43
|
+
private _isWatching;
|
|
51
44
|
private _lastStatus;
|
|
52
45
|
private _renderedStatusLines;
|
|
53
|
-
|
|
46
|
+
private _lastSnapshot;
|
|
47
|
+
private _stdinListening;
|
|
48
|
+
private _stdinHadRawMode;
|
|
49
|
+
private _onStdinDataBound;
|
|
54
50
|
constructor(options: IProjectWatcherOptions);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Resets the rendered line count so the next status update does not attempt
|
|
53
|
+
* to overwrite previously rendered lines.
|
|
54
|
+
*/
|
|
59
55
|
clearStatus(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Re-renders the most recent status line (or a default) in place.
|
|
58
|
+
*/
|
|
60
59
|
rerenderStatus(): void;
|
|
61
|
-
setPromptGenerator(promptGenerator: IPromptGeneratorFunction): void;
|
|
62
60
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* `waitForChange` is not allowed to be called multiple times concurrently.
|
|
61
|
+
* Renders the given status message to the terminal, preceded by mode indicators
|
|
62
|
+
* and keybind help when stdin is active. Overwrites previously rendered status lines
|
|
63
|
+
* when not mid-execution.
|
|
67
64
|
*/
|
|
68
|
-
waitForChangeAsync(onWatchingFiles?: () => void): Promise<IProjectChangeResult>;
|
|
69
65
|
private _setStatus;
|
|
70
66
|
/**
|
|
71
|
-
*
|
|
67
|
+
* Begins watching the file system for changes in all tracked project folders.
|
|
68
|
+
* On platforms without native recursive watch support (Linux), enumerates nested
|
|
69
|
+
* folders from the last snapshot to set up individual watchers.
|
|
70
|
+
*/
|
|
71
|
+
private _startWatching;
|
|
72
|
+
/**
|
|
73
|
+
* Closes all active file system watchers and waits for their close events to settle.
|
|
74
|
+
*/
|
|
75
|
+
private _stopWatchingAsync;
|
|
76
|
+
/**
|
|
77
|
+
* Handles a raw file system event by debouncing and scheduling an iteration.
|
|
78
|
+
* Ignores changes to `.git` and `node_modules`.
|
|
79
|
+
*/
|
|
80
|
+
private _onFsEvent;
|
|
81
|
+
/**
|
|
82
|
+
* Schedules a new execution iteration on the graph in response to detected file changes.
|
|
83
|
+
*/
|
|
84
|
+
private _scheduleIteration;
|
|
85
|
+
/**
|
|
86
|
+
* Sets up a raw-mode stdin listener so the user can interact with the watch session
|
|
87
|
+
* via single-key keybinds. Captures the previous raw-mode state for restoration on dispose.
|
|
88
|
+
*/
|
|
89
|
+
private _ensureStdin;
|
|
90
|
+
/**
|
|
91
|
+
* Removes the stdin listener and restores the previous raw-mode state.
|
|
92
|
+
*/
|
|
93
|
+
private _disposeStdin;
|
|
94
|
+
/**
|
|
95
|
+
* Processes a chunk of stdin data, dispatching each character to the appropriate
|
|
96
|
+
* keybind action on the operation graph.
|
|
72
97
|
*/
|
|
73
|
-
private
|
|
74
|
-
private _commitChanges;
|
|
98
|
+
private _onStdinData;
|
|
75
99
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* @returns `true` if the maps are different, `false` otherwise
|
|
100
|
+
* Adjusts the parallelism on the operation graph by the given delta
|
|
101
|
+
* and reports the result.
|
|
79
102
|
*/
|
|
80
|
-
private
|
|
81
|
-
private static _enumeratePathsToWatch;
|
|
103
|
+
private _adjustParallelism;
|
|
82
104
|
}
|
|
83
105
|
//# sourceMappingURL=ProjectWatcher.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ITerminal } from '@rushstack/terminal';
|
|
2
2
|
import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
|
|
3
3
|
import type { BuildCacheConfiguration } from '../../api/BuildCacheConfiguration';
|
|
4
|
-
import type {
|
|
4
|
+
import type { IBaseOperationExecutionResult } from '../operations/IOperationExecutionResult';
|
|
5
5
|
/**
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
@@ -58,7 +58,7 @@ export declare class OperationBuildCache {
|
|
|
58
58
|
private static _tryGetTarUtility;
|
|
59
59
|
get cacheId(): string | undefined;
|
|
60
60
|
static getOperationBuildCache(options: IProjectBuildCacheOptions): OperationBuildCache;
|
|
61
|
-
static forOperation(executionResult:
|
|
61
|
+
static forOperation(executionResult: IBaseOperationExecutionResult, options: IOperationBuildCacheOptions): OperationBuildCache;
|
|
62
62
|
tryRestoreFromCacheAsync(terminal: ITerminal, specifiedCacheId?: string): Promise<boolean>;
|
|
63
63
|
trySetCacheEntryAsync(terminal: ITerminal, specifiedCacheId?: string): Promise<boolean>;
|
|
64
64
|
/**
|
|
@@ -1,17 +1,68 @@
|
|
|
1
1
|
import type { StdioSummarizer, IProblemCollector } from '@rushstack/terminal';
|
|
2
2
|
import type { OperationStatus } from './OperationStatus';
|
|
3
|
+
import type { IOperationLastState } from './IOperationRunner';
|
|
3
4
|
import type { Operation } from './Operation';
|
|
4
5
|
import type { IStopwatchResult } from '../../utilities/Stopwatch';
|
|
5
6
|
import type { ILogFilePaths } from './ProjectLogWritable';
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* Structured components of the state hash for an operation.
|
|
9
|
+
* @alpha
|
|
10
|
+
*/
|
|
11
|
+
export interface IOperationStateHashComponents {
|
|
12
|
+
/**
|
|
13
|
+
* The state hashes of operation dependencies, sorted by name.
|
|
14
|
+
* Each entry is of the form `{dependencyName}={hash}`.
|
|
15
|
+
*/
|
|
16
|
+
readonly dependencies: readonly string[];
|
|
17
|
+
/**
|
|
18
|
+
* The hash of the operation's own local inputs (e.g. tracked files, environment variables).
|
|
19
|
+
*/
|
|
20
|
+
readonly local: string;
|
|
21
|
+
/**
|
|
22
|
+
* The hash of the operation's configuration (e.g. CLI parameters).
|
|
23
|
+
*/
|
|
24
|
+
readonly config: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
8
27
|
* @alpha
|
|
9
28
|
*/
|
|
10
|
-
export interface
|
|
29
|
+
export interface IBaseOperationExecutionResult {
|
|
11
30
|
/**
|
|
12
31
|
* The operation itself
|
|
13
32
|
*/
|
|
14
33
|
readonly operation: Operation;
|
|
34
|
+
/**
|
|
35
|
+
* The relative path to the folder that contains operation metadata. This folder will be automatically included in cache entries.
|
|
36
|
+
*/
|
|
37
|
+
readonly metadataFolderPath: string;
|
|
38
|
+
/**
|
|
39
|
+
* Gets the hash of the state of all registered inputs to this operation.
|
|
40
|
+
* Calling this method will throw if Git is not available.
|
|
41
|
+
*/
|
|
42
|
+
getStateHash(): string;
|
|
43
|
+
/**
|
|
44
|
+
* Gets the structured components of the state hash. This is useful for debugging and
|
|
45
|
+
* incremental change detection.
|
|
46
|
+
* Calling this method will throw if Git is not available.
|
|
47
|
+
*/
|
|
48
|
+
getStateHashComponents(): IOperationStateHashComponents;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The `IConfigurableOperation` interface represents an {@link Operation} whose
|
|
52
|
+
* execution can be configured before running.
|
|
53
|
+
* @alpha
|
|
54
|
+
*/
|
|
55
|
+
export interface IConfigurableOperation extends IBaseOperationExecutionResult {
|
|
56
|
+
/**
|
|
57
|
+
* True if the operation should execute in this iteration, false otherwise.
|
|
58
|
+
*/
|
|
59
|
+
enabled: boolean;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The `IOperationExecutionResult` interface represents the results of executing an {@link Operation}.
|
|
63
|
+
* @alpha
|
|
64
|
+
*/
|
|
65
|
+
export interface IOperationExecutionResult extends IBaseOperationExecutionResult, IOperationLastState {
|
|
15
66
|
/**
|
|
16
67
|
* The current execution status of an operation. Operations start in the 'ready' state,
|
|
17
68
|
* but can be 'blocked' if an upstream operation failed. It is 'executing' when
|
|
@@ -28,6 +79,10 @@ export interface IOperationExecutionResult {
|
|
|
28
79
|
* If this operation is only present in the graph to maintain dependency relationships, this flag will be set to true.
|
|
29
80
|
*/
|
|
30
81
|
readonly silent: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* True if the operation should execute in this iteration, false otherwise.
|
|
84
|
+
*/
|
|
85
|
+
readonly enabled: boolean;
|
|
31
86
|
/**
|
|
32
87
|
* Object tracking execution timing.
|
|
33
88
|
*/
|
|
@@ -44,24 +99,10 @@ export interface IOperationExecutionResult {
|
|
|
44
99
|
* The value indicates the duration of the same operation without cache hit.
|
|
45
100
|
*/
|
|
46
101
|
readonly nonCachedDurationMs: number | undefined;
|
|
47
|
-
/**
|
|
48
|
-
* The relative path to the folder that contains operation metadata. This folder will be automatically included in cache entries.
|
|
49
|
-
*/
|
|
50
|
-
readonly metadataFolderPath: string | undefined;
|
|
51
102
|
/**
|
|
52
103
|
* The paths to the log files, if applicable.
|
|
53
104
|
*/
|
|
54
105
|
readonly logFilePaths: ILogFilePaths | undefined;
|
|
55
|
-
/**
|
|
56
|
-
* Gets the hash of the state of all registered inputs to this operation.
|
|
57
|
-
* Calling this method will throw if Git is not available.
|
|
58
|
-
*/
|
|
59
|
-
getStateHash(): string;
|
|
60
|
-
/**
|
|
61
|
-
* Gets the components of the state hash. This is useful for debugging purposes.
|
|
62
|
-
* Calling this method will throw if Git is not available.
|
|
63
|
-
*/
|
|
64
|
-
getStateHashComponents(): ReadonlyArray<string>;
|
|
65
106
|
}
|
|
66
107
|
/**
|
|
67
108
|
* The `IExecutionResult` interface represents the results of executing a set of {@link Operation}s.
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import type { TerminalWritable } from '@rushstack/terminal';
|
|
2
|
+
import type { Operation } from './Operation';
|
|
3
|
+
import type { IOperationExecutionResult } from './IOperationExecutionResult';
|
|
4
|
+
import type { Parallelism } from './ParseParallelism';
|
|
5
|
+
import type { OperationStatus } from './OperationStatus';
|
|
6
|
+
import type { IInputsSnapshot } from '../incremental/InputsSnapshot';
|
|
7
|
+
import type { OperationGraphHooks } from '../../pluginFramework/OperationGraphHooks';
|
|
8
|
+
/**
|
|
9
|
+
* Options for a single iteration of operation execution.
|
|
10
|
+
* @alpha
|
|
11
|
+
*/
|
|
12
|
+
export interface IOperationGraphIterationOptions {
|
|
13
|
+
inputsSnapshot?: IInputsSnapshot;
|
|
14
|
+
/**
|
|
15
|
+
* The time when the iteration was scheduled, if available, as returned by `performance.now()`.
|
|
16
|
+
*/
|
|
17
|
+
startTime?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Public API for the operation graph.
|
|
21
|
+
* @alpha
|
|
22
|
+
*/
|
|
23
|
+
export interface IOperationGraph {
|
|
24
|
+
/**
|
|
25
|
+
* Hooks into the execution process for operations
|
|
26
|
+
*/
|
|
27
|
+
readonly hooks: OperationGraphHooks;
|
|
28
|
+
/**
|
|
29
|
+
* The set of operations in the graph.
|
|
30
|
+
*/
|
|
31
|
+
readonly operations: ReadonlySet<Operation>;
|
|
32
|
+
/**
|
|
33
|
+
* A map from each `Operation` in the graph to its current result record.
|
|
34
|
+
* The map is updated in real time as operations execute during an iteration.
|
|
35
|
+
* Only statuses representing a completed execution (e.g. `Success`, `Failure`,
|
|
36
|
+
* `SuccessWithWarning`) write to this map; statuses such as `Skipped` or `Aborted` —
|
|
37
|
+
* which indicate that an operation did not actually run — do not update it.
|
|
38
|
+
* For operations that have not yet run in the current iteration, the map retains the
|
|
39
|
+
* result from whichever prior iteration the operation last ran in.
|
|
40
|
+
* An entry with status `Ready` indicates that the operation is considered stale and
|
|
41
|
+
* has been queued to run again.
|
|
42
|
+
* Empty until at least one operation has completed execution.
|
|
43
|
+
*/
|
|
44
|
+
readonly resultByOperation: ReadonlyMap<Operation, IOperationExecutionResult>;
|
|
45
|
+
/**
|
|
46
|
+
* The maximum allowed parallelism for this operation graph.
|
|
47
|
+
* Reads as a concrete integer. Accepts a `Parallelism` value and coerces it on write.
|
|
48
|
+
*/
|
|
49
|
+
get parallelism(): number;
|
|
50
|
+
set parallelism(value: Parallelism);
|
|
51
|
+
/**
|
|
52
|
+
* If additional debug information should be printed during execution.
|
|
53
|
+
*/
|
|
54
|
+
debugMode: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* If true, operations will be executed in "quiet mode" where only errors are reported.
|
|
57
|
+
*/
|
|
58
|
+
quietMode: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* If true, allow operations to oversubscribe the CPU. Defaults to true.
|
|
61
|
+
*/
|
|
62
|
+
allowOversubscription: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* When true, the operation graph will pause before running the next iteration (manual mode).
|
|
65
|
+
* When false, iterations run automatically when scheduled.
|
|
66
|
+
*/
|
|
67
|
+
pauseNextIteration: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* The current overall status of the execution.
|
|
70
|
+
*/
|
|
71
|
+
readonly status: OperationStatus;
|
|
72
|
+
/**
|
|
73
|
+
* The current set of terminal destinations.
|
|
74
|
+
*/
|
|
75
|
+
readonly terminalDestinations: ReadonlySet<TerminalWritable>;
|
|
76
|
+
/**
|
|
77
|
+
* True if there is a scheduled (but not yet executing) iteration.
|
|
78
|
+
* This will be false while an iteration is actively executing, or when no work is scheduled.
|
|
79
|
+
*/
|
|
80
|
+
readonly hasScheduledIteration: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* AbortController controlling the lifetime of the overall session (e.g. watch mode).
|
|
83
|
+
* Aborting this controller should signal all listeners (such as file system watchers) to dispose
|
|
84
|
+
* and prevent further iterations from being scheduled.
|
|
85
|
+
*/
|
|
86
|
+
readonly abortController: AbortController;
|
|
87
|
+
/**
|
|
88
|
+
* Abort the current execution iteration, if any. Operations that have already started
|
|
89
|
+
* will run to completion; only operations that have not yet begun will be aborted.
|
|
90
|
+
*/
|
|
91
|
+
abortCurrentIterationAsync(): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* Cleans up any resources used by the operation runners, if applicable.
|
|
94
|
+
* @param operations - The operations whose runners should be closed, or undefined to close all runners.
|
|
95
|
+
*/
|
|
96
|
+
closeRunnersAsync(operations?: Iterable<Operation>): Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* Executes a single iteration of the operations.
|
|
99
|
+
* @param options - Options for this execution iteration.
|
|
100
|
+
* @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.
|
|
101
|
+
*/
|
|
102
|
+
scheduleIterationAsync(options: IOperationGraphIterationOptions): Promise<boolean>;
|
|
103
|
+
/**
|
|
104
|
+
* Executes all operations in the currently scheduled iteration, if any.
|
|
105
|
+
* @returns A promise which is resolved when all operations have been processed to a final state.
|
|
106
|
+
*/
|
|
107
|
+
executeScheduledIterationAsync(): Promise<boolean>;
|
|
108
|
+
/**
|
|
109
|
+
* Invalidates the specified operations, causing them to be re-executed.
|
|
110
|
+
* @param operations - The operations to invalidate, or undefined to invalidate all operations.
|
|
111
|
+
* @param reason - Optional reason for invalidation.
|
|
112
|
+
*/
|
|
113
|
+
invalidateOperations(operations?: Iterable<Operation>, reason?: string): void;
|
|
114
|
+
/**
|
|
115
|
+
* Sets the enabled state for a collection of operations.
|
|
116
|
+
*
|
|
117
|
+
* @param operations - The operations whose enabled state should be updated.
|
|
118
|
+
* @param targetState - The target enabled state to apply.
|
|
119
|
+
* @param mode - 'unsafe' to directly mutate only the provided operations, 'safe' to also enable
|
|
120
|
+
* transitive dependencies of enabled operations and disable transitive dependents of disabled operations.
|
|
121
|
+
* @returns true if any operation's enabled state changed, false otherwise.
|
|
122
|
+
*/
|
|
123
|
+
setEnabledStates(operations: Iterable<Operation>, targetState: Operation['enabled'], mode: 'safe' | 'unsafe'): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Adds a terminal destination for output. Only new output will be sent to the destination.
|
|
126
|
+
* @param destination - The destination to add.
|
|
127
|
+
*/
|
|
128
|
+
addTerminalDestination(destination: TerminalWritable): void;
|
|
129
|
+
/**
|
|
130
|
+
* Removes a terminal destination for output. Optionally closes the stream.
|
|
131
|
+
* New output will no longer be sent to the destination.
|
|
132
|
+
* @param destination - The destination to remove.
|
|
133
|
+
* @param close - Whether to close the stream. Defaults to `true`.
|
|
134
|
+
*/
|
|
135
|
+
removeTerminalDestination(destination: TerminalWritable, close?: boolean): boolean;
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=IOperationGraph.d.ts.map
|