@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.
Files changed (37) hide show
  1. package/dist/rush-lib.d.ts +132 -457
  2. package/lib-commonjs/{logic/operations → cli/parsing}/ParseParallelism.js +1 -2
  3. package/lib-commonjs/index.js +0 -1
  4. package/lib-commonjs/logic/operations/OperationExecutionManager.js +3 -0
  5. package/lib-commonjs/logic/operations/OperationStatus.js +0 -1
  6. package/lib-commonjs/logic/operations/WeightedOperationPlugin.js +3 -0
  7. package/lib-dts/api/CommandLineConfiguration.d.ts +0 -7
  8. package/lib-dts/api/CommandLineJson.d.ts +0 -1
  9. package/lib-dts/api/EventHooks.d.ts +1 -1
  10. package/lib-dts/cli/parsing/ParseParallelism.d.ts +17 -0
  11. package/lib-dts/cli/parsing/SelectionParameterSet.d.ts +1 -1
  12. package/lib-dts/cli/scriptActions/PhasedScriptAction.d.ts +12 -2
  13. package/lib-dts/index.d.ts +4 -7
  14. package/lib-dts/logic/ProjectWatcher.d.ts +42 -64
  15. package/lib-dts/logic/buildCache/OperationBuildCache.d.ts +2 -2
  16. package/lib-dts/logic/operations/IOperationExecutionResult.d.ts +16 -57
  17. package/lib-dts/logic/operations/IOperationRunner.d.ts +2 -32
  18. package/lib-dts/logic/operations/IPCOperationRunner.d.ts +8 -8
  19. package/lib-dts/logic/operations/Operation.d.ts +14 -50
  20. package/lib-dts/logic/operations/OperationExecutionManager.d.ts +60 -0
  21. package/lib-dts/logic/operations/OperationExecutionRecord.d.ts +9 -21
  22. package/lib-dts/logic/operations/OperationStatus.d.ts +0 -4
  23. package/lib-dts/logic/operations/ShellOperationRunner.d.ts +5 -6
  24. package/lib-dts/logic/operations/ShellOperationRunnerPlugin.d.ts +1 -2
  25. package/lib-dts/logic/operations/ValidateOperationsPlugin.d.ts +3 -1
  26. package/lib-dts/logic/operations/WeightedOperationPlugin.d.ts +10 -0
  27. package/lib-dts/pluginFramework/PhasedCommandHooks.d.ts +98 -32
  28. package/lib-dts/utilities/Stopwatch.d.ts +2 -2
  29. package/lib-shim/index.js +0 -1
  30. package/package.json +8 -8
  31. package/lib-commonjs/logic/operations/IOperationGraph.js +0 -2
  32. package/lib-commonjs/logic/operations/OperationGraph.js +0 -3
  33. package/lib-commonjs/pluginFramework/OperationGraphHooks.js +0 -3
  34. package/lib-dts/logic/operations/IOperationGraph.d.ts +0 -137
  35. package/lib-dts/logic/operations/OperationGraph.d.ts +0 -125
  36. package/lib-dts/logic/operations/ParseParallelism.d.ts +0 -33
  37. package/lib-dts/pluginFramework/OperationGraphHooks.d.ts +0 -129
@@ -0,0 +1,60 @@
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 { IEnvironment } from '../../utilities/Utilities';
7
+ import type { IInputsSnapshot } from '../incremental/InputsSnapshot';
8
+ export interface IOperationExecutionManagerOptions {
9
+ quietMode: boolean;
10
+ debugMode: boolean;
11
+ parallelism: number;
12
+ allowOversubscription: boolean;
13
+ inputsSnapshot?: IInputsSnapshot;
14
+ destination?: TerminalWritable;
15
+ beforeExecuteOperationAsync?: (operation: OperationExecutionRecord) => Promise<OperationStatus | undefined>;
16
+ afterExecuteOperationAsync?: (operation: OperationExecutionRecord) => Promise<void>;
17
+ createEnvironmentForOperation?: (operation: OperationExecutionRecord) => IEnvironment;
18
+ onOperationStatusChangedAsync?: (record: OperationExecutionRecord) => void;
19
+ beforeExecuteOperationsAsync?: (records: Map<Operation, OperationExecutionRecord>) => Promise<void>;
20
+ }
21
+ /**
22
+ * A class which manages the execution of a set of tasks with interdependencies.
23
+ * Initially, and at the end of each task execution, all unblocked tasks
24
+ * are added to a ready queue which is then executed. This is done continually until all
25
+ * tasks are complete, or prematurely fails if any of the tasks fail.
26
+ */
27
+ export declare class OperationExecutionManager {
28
+ private readonly _executionRecords;
29
+ private readonly _quietMode;
30
+ private readonly _parallelism;
31
+ private readonly _allowOversubscription;
32
+ private readonly _totalOperations;
33
+ private readonly _outputWritable;
34
+ private readonly _colorsNewlinesTransform;
35
+ private readonly _streamCollator;
36
+ private readonly _terminal;
37
+ private readonly _beforeExecuteOperation?;
38
+ private readonly _afterExecuteOperation?;
39
+ private readonly _onOperationStatusChanged?;
40
+ private readonly _beforeExecuteOperations?;
41
+ private readonly _createEnvironmentForOperation?;
42
+ private _hasAnyFailures;
43
+ private _hasAnyNonAllowedWarnings;
44
+ private _hasAnyAborted;
45
+ private _completedOperations;
46
+ private _executionQueue;
47
+ constructor(operations: Set<Operation>, options: IOperationExecutionManagerOptions);
48
+ private _streamCollator_onWriterActive;
49
+ /**
50
+ * Executes all operations which have been registered, returning a promise which is resolved when all the
51
+ * operations are completed successfully, or rejects when any operation fails.
52
+ */
53
+ executeAsync(abortController: AbortController): Promise<IExecutionResult>;
54
+ private _reportOperationErrorIfAny;
55
+ /**
56
+ * Handles the result of the operation and propagates any relevant effects.
57
+ */
58
+ private _onOperationComplete;
59
+ }
60
+ //# sourceMappingURL=OperationExecutionManager.d.ts.map
@@ -7,7 +7,7 @@ import { Stopwatch } from '../../utilities/Stopwatch';
7
7
  import { OperationMetadataManager } from './OperationMetadataManager';
8
8
  import type { IPhase } from '../../api/CommandLineConfiguration';
9
9
  import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
10
- import type { IOperationExecutionResult, IOperationStateHashComponents } from './IOperationExecutionResult';
10
+ import type { IOperationExecutionResult } from './IOperationExecutionResult';
11
11
  import type { IInputsSnapshot } from '../incremental/InputsSnapshot';
12
12
  import type { IEnvironment } from '../../utilities/Utilities';
13
13
  import { type ILogFilePaths } from './ProjectLogWritable';
@@ -16,22 +16,12 @@ import { type ILogFilePaths } from './ProjectLogWritable';
16
16
  */
17
17
  export interface IOperationExecutionRecordContext {
18
18
  streamCollator: StreamCollator;
19
- onOperationStateChanged?: (record: OperationExecutionRecord) => void;
19
+ onOperationStatusChanged?: (record: OperationExecutionRecord) => void;
20
20
  createEnvironment?: (record: OperationExecutionRecord) => IEnvironment;
21
- invalidate?: (operations: Iterable<Operation>, reason: string) => void;
22
21
  inputsSnapshot: IInputsSnapshot | undefined;
23
- maxParallelism: number;
24
22
  debugMode: boolean;
25
23
  quietMode: boolean;
26
24
  }
27
- /**
28
- * Context object for the executeAsync() method.
29
- * @internal
30
- */
31
- export interface IOperationExecutionContext {
32
- onStartAsync: (record: OperationExecutionRecord) => Promise<OperationStatus | undefined>;
33
- onResultAsync: (record: OperationExecutionRecord) => Promise<void>;
34
- }
35
25
  /**
36
26
  * Internal class representing everything about executing an operation
37
27
  *
@@ -47,10 +37,6 @@ export declare class OperationExecutionRecord implements IOperationRunnerContext
47
37
  * it later (for example to re-print errors at end of execution).
48
38
  */
49
39
  error: Error | undefined;
50
- /**
51
- * If true, this operation should be executed. If false, it should be skipped.
52
- */
53
- enabled: boolean;
54
40
  /**
55
41
  * This number represents how far away this Operation is from the furthest "root" operation (i.e.
56
42
  * an operation with no consumers). This helps us to calculate the critical path (i.e. the
@@ -95,7 +81,6 @@ export declare class OperationExecutionRecord implements IOperationRunnerContext
95
81
  readonly stdioSummarizer: StdioSummarizer;
96
82
  readonly problemCollector: ProblemCollector;
97
83
  readonly runner: IOperationRunner;
98
- readonly weight: number;
99
84
  readonly associatedPhase: IPhase;
100
85
  readonly associatedProject: RushConfigurationProject;
101
86
  readonly _operationMetadataManager: OperationMetadataManager;
@@ -107,14 +92,14 @@ export declare class OperationExecutionRecord implements IOperationRunnerContext
107
92
  private _stateHashComponents;
108
93
  constructor(operation: Operation, context: IOperationExecutionRecordContext);
109
94
  get name(): string;
95
+ get weight(): number;
110
96
  get debugMode(): boolean;
111
97
  get quietMode(): boolean;
112
98
  get collatedWriter(): CollatedWriter;
113
99
  get nonCachedDurationMs(): number | undefined;
114
100
  get cobuildRunnerId(): string | undefined;
115
101
  get environment(): IEnvironment | undefined;
116
- getInvalidateCallback(): (reason: string) => void;
117
- get metadataFolderPath(): string;
102
+ get metadataFolderPath(): string | undefined;
118
103
  get isTerminal(): boolean;
119
104
  /**
120
105
  * The current execution status of an operation. Operations start in the 'ready' state,
@@ -126,7 +111,7 @@ export declare class OperationExecutionRecord implements IOperationRunnerContext
126
111
  set status(newStatus: OperationStatus);
127
112
  get silent(): boolean;
128
113
  getStateHash(): string;
129
- getStateHashComponents(): IOperationStateHashComponents;
114
+ getStateHashComponents(): ReadonlyArray<string>;
130
115
  /**
131
116
  * {@inheritdoc IOperationRunnerContext.runWithTerminalAsync}
132
117
  */
@@ -134,6 +119,9 @@ export declare class OperationExecutionRecord implements IOperationRunnerContext
134
119
  createLogFile: boolean;
135
120
  logFileSuffix: string;
136
121
  }): Promise<T>;
137
- executeAsync(lastState: OperationExecutionRecord | undefined, executeContext: IOperationExecutionContext): Promise<void>;
122
+ executeAsync({ onStart, onResult }: {
123
+ onStart: (record: OperationExecutionRecord) => Promise<OperationStatus | undefined>;
124
+ onResult: (record: OperationExecutionRecord) => Promise<void>;
125
+ }): Promise<void>;
138
126
  }
139
127
  //# sourceMappingURL=OperationExecutionRecord.d.ts.map
@@ -57,8 +57,4 @@ export declare enum OperationStatus {
57
57
  * @alpha
58
58
  */
59
59
  export declare const TERMINAL_STATUSES: Set<OperationStatus>;
60
- /**
61
- * The set of statuses that are considered successful and don't trigger a rebuild if current.
62
- */
63
- export declare const SUCCESS_STATUSES: Set<OperationStatus>;
64
60
  //# sourceMappingURL=OperationStatus.d.ts.map
@@ -1,13 +1,12 @@
1
1
  import type { IPhase } from '../../api/CommandLineConfiguration';
2
2
  import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
3
- import type { IOperationRunner, IOperationRunnerContext, IOperationLastState } from './IOperationRunner';
3
+ import type { IOperationRunner, IOperationRunnerContext } from './IOperationRunner';
4
4
  import { OperationStatus } from './OperationStatus';
5
5
  export interface IShellOperationRunnerOptions {
6
6
  phase: IPhase;
7
7
  rushProject: RushConfigurationProject;
8
8
  displayName: string;
9
- initialCommand: string;
10
- incrementalCommand: string | undefined;
9
+ commandToRun: string;
11
10
  commandForHash: string;
12
11
  ignoredParameterValues: ReadonlyArray<string>;
13
12
  }
@@ -22,18 +21,18 @@ export declare class ShellOperationRunner implements IOperationRunner {
22
21
  readonly silent: boolean;
23
22
  readonly cacheable: boolean;
24
23
  readonly warningsAreAllowed: boolean;
24
+ readonly commandToRun: string;
25
25
  /**
26
26
  * The creator is expected to use a different runner if the command is known to be a noop.
27
27
  */
28
28
  readonly isNoOp: boolean;
29
29
  private readonly _commandForHash;
30
- private readonly _initialCommand;
31
- private readonly _incrementalCommand;
32
30
  private readonly _rushProject;
33
31
  private readonly _ignoredParameterValues;
34
32
  constructor(options: IShellOperationRunnerOptions);
35
- executeAsync(context: IOperationRunnerContext, lastState?: IOperationLastState): Promise<OperationStatus>;
33
+ executeAsync(context: IOperationRunnerContext): Promise<OperationStatus>;
36
34
  getConfigHash(): string;
35
+ private _executeAsync;
37
36
  }
38
37
  /**
39
38
  * When running a command from the "scripts" block in package.json, if the command
@@ -16,8 +16,7 @@ export declare function initializeShellOperationRunner(options: {
16
16
  project: RushConfigurationProject;
17
17
  displayName: string;
18
18
  rushConfiguration: RushConfiguration;
19
- initialCommand: string | undefined;
20
- incrementalCommand: string | undefined;
19
+ commandToRun: string | undefined;
21
20
  commandForHash?: string;
22
21
  customParameterValues: ReadonlyArray<string>;
23
22
  ignoredParameterValues: ReadonlyArray<string>;
@@ -1,11 +1,13 @@
1
1
  import type { ITerminal } from '@rushstack/terminal';
2
2
  import type { IPhasedCommandPlugin, PhasedCommandHooks } from '../../pluginFramework/PhasedCommandHooks';
3
3
  /**
4
- * Core phased command plugin that verifies correctness of the entries in rush-project.json
4
+ * Core phased command plugin that provides the functionality for generating a base operation graph
5
+ * from the set of selected projects and phases.
5
6
  */
6
7
  export declare class ValidateOperationsPlugin implements IPhasedCommandPlugin {
7
8
  private readonly _terminal;
8
9
  constructor(terminal: ITerminal);
9
10
  apply(hooks: PhasedCommandHooks): void;
11
+ private _validateOperations;
10
12
  }
11
13
  //# sourceMappingURL=ValidateOperationsPlugin.d.ts.map
@@ -0,0 +1,10 @@
1
+ import type { IPhasedCommandPlugin, PhasedCommandHooks } from '../../pluginFramework/PhasedCommandHooks';
2
+ /**
3
+ * Add weights to operations based on the operation settings in rush-project.json.
4
+ *
5
+ * This also sets the weight of no-op operations to 0.
6
+ */
7
+ export declare class WeightedOperationPlugin implements IPhasedCommandPlugin {
8
+ apply(hooks: PhasedCommandHooks): void;
9
+ }
10
+ //# sourceMappingURL=WeightedOperationPlugin.d.ts.map
@@ -1,15 +1,18 @@
1
- import { AsyncSeriesHook, AsyncSeriesWaterfallHook } from 'tapable';
1
+ import { AsyncParallelHook, AsyncSeriesBailHook, AsyncSeriesHook, AsyncSeriesWaterfallHook, SyncHook, SyncWaterfallHook } from 'tapable';
2
2
  import type { CommandLineParameter } from '@rushstack/ts-command-line';
3
3
  import type { BuildCacheConfiguration } from '../api/BuildCacheConfiguration';
4
4
  import type { IPhase } from '../api/CommandLineConfiguration';
5
5
  import type { RushConfiguration } from '../api/RushConfiguration';
6
6
  import type { RushConfigurationProject } from '../api/RushConfigurationProject';
7
7
  import type { Operation } from '../logic/operations/Operation';
8
+ import type { IExecutionResult, IOperationExecutionResult } from '../logic/operations/IOperationExecutionResult';
8
9
  import type { CobuildConfiguration } from '../api/CobuildConfiguration';
9
10
  import type { RushProjectConfiguration } from '../api/RushProjectConfiguration';
10
- import type { Parallelism } from '../logic/operations/ParseParallelism';
11
+ import type { IOperationRunnerContext } from '../logic/operations/IOperationRunner';
12
+ import type { ITelemetryData } from '../logic/Telemetry';
13
+ import type { OperationStatus } from '../logic/operations/OperationStatus';
11
14
  import type { IInputsSnapshot } from '../logic/incremental/InputsSnapshot';
12
- import type { IOperationGraph } from '../logic/operations/IOperationGraph';
15
+ import type { IEnvironment } from '../utilities/Utilities';
13
16
  /**
14
17
  * A plugin that interacts with a phased commands.
15
18
  * @alpha
@@ -44,15 +47,16 @@ export interface ICreateOperationsContext {
44
47
  * Maps from the `longName` field in command-line.json to the parser configuration in ts-command-line.
45
48
  */
46
49
  readonly customParameters: ReadonlyMap<string, CommandLineParameter>;
47
- /**
48
- * If true, dependencies of the selected phases will be automatically enabled in the execution.
49
- */
50
- readonly includePhaseDeps: boolean;
51
50
  /**
52
51
  * If true, projects may read their output from cache or be skipped if already up to date.
53
52
  * If false, neither of the above may occur, e.g. "rush rebuild"
54
53
  */
55
54
  readonly isIncrementalBuildAllowed: boolean;
55
+ /**
56
+ * If true, this is the initial run of the command.
57
+ * If false, this execution is in response to changes.
58
+ */
59
+ readonly isInitial: boolean;
56
60
  /**
57
61
  * If true, the command is running in watch mode.
58
62
  */
@@ -60,62 +64,124 @@ export interface ICreateOperationsContext {
60
64
  /**
61
65
  * The currently configured maximum parallelism for the command.
62
66
  */
63
- readonly parallelism: Parallelism;
67
+ readonly parallelism: number;
64
68
  /**
65
- * The set of phases selected for execution.
69
+ * The set of phases original for the current command execution.
66
70
  */
67
- readonly phaseSelection: ReadonlySet<IPhase>;
71
+ readonly phaseOriginal: ReadonlySet<IPhase>;
68
72
  /**
69
- * All successfully loaded rush-project.json data for selected projects.
73
+ * The set of phases selected for the current command execution.
70
74
  */
71
- readonly projectConfigurations: ReadonlyMap<RushConfigurationProject, RushProjectConfiguration>;
75
+ readonly phaseSelection: ReadonlySet<IPhase>;
72
76
  /**
73
- * The set of Rush projects selected for execution.
77
+ * The set of Rush projects selected for the current command execution.
74
78
  */
75
79
  readonly projectSelection: ReadonlySet<RushConfigurationProject>;
76
80
  /**
77
- * If true, the operation graph should include all projects in the repository (watch broad graph mode).
78
- * Only the projects in projectSelection should start enabled; others are present but disabled.
81
+ * All successfully loaded rush-project.json data for selected projects.
82
+ */
83
+ readonly projectConfigurations: ReadonlyMap<RushConfigurationProject, RushProjectConfiguration>;
84
+ /**
85
+ * The set of Rush projects that have not been built in the current process since they were last modified.
86
+ * When `isInitial` is true, this will be an exact match of `projectSelection`.
79
87
  */
80
- readonly generateFullGraph?: boolean;
88
+ readonly projectsInUnknownState: ReadonlySet<RushConfigurationProject>;
81
89
  /**
82
90
  * The Rush configuration
83
91
  */
84
92
  readonly rushConfiguration: RushConfiguration;
93
+ /**
94
+ * If true, Rush will automatically include the dependent phases for the specified set of phases.
95
+ * @remarks
96
+ * If the selection of projects was "unsafe" (i.e. missing some dependencies), this will add the
97
+ * minimum number of phases required to make it safe.
98
+ */
99
+ readonly includePhaseDeps: boolean;
100
+ /**
101
+ * Marks an operation's result as invalid, potentially triggering a new build. Only applicable in watch mode.
102
+ * @param operation - The operation to invalidate
103
+ * @param reason - The reason for invalidating the operation
104
+ */
105
+ readonly invalidateOperation?: ((operation: Operation, reason: string) => void) | undefined;
85
106
  }
86
107
  /**
87
- * Context used for configuring the operation graph.
108
+ * Context used for executing operations.
88
109
  * @alpha
89
110
  */
90
- export interface IOperationGraphContext extends ICreateOperationsContext {
111
+ export interface IExecuteOperationsContext extends ICreateOperationsContext {
91
112
  /**
92
113
  * The current state of the repository, if available.
93
114
  * Not part of the creation context to avoid the overhead of Git calls when initializing the graph.
94
115
  */
95
- readonly initialSnapshot?: IInputsSnapshot;
116
+ readonly inputsSnapshot?: IInputsSnapshot;
117
+ /**
118
+ * An abort controller that can be used to abort the current set of queued operations.
119
+ */
120
+ readonly abortController: AbortController;
96
121
  }
97
122
  /**
98
- * Hooks into the execution process for phased commands.
99
- *
100
- * Lifecycle:
101
- * 1. `createOperationsAsync` - Invoked to populate the set of operations for execution.
102
- * 2. `onGraphCreatedAsync` - Invoked after the operation graph is created, allowing plugins to
103
- * tap into graph-level hooks (e.g. `configureIteration`, `onIdle`).
104
- * See {@link OperationGraphHooks} for the per-iteration lifecycle.
105
- *
123
+ * Hooks into the execution process for phased commands
106
124
  * @alpha
107
125
  */
108
126
  export declare class PhasedCommandHooks {
109
127
  /**
110
128
  * Hook invoked to create operations for execution.
129
+ * Use the context to distinguish between the initial run and phased runs.
130
+ */
131
+ readonly createOperations: AsyncSeriesWaterfallHook<[Set<Operation>, ICreateOperationsContext]>;
132
+ /**
133
+ * Hook invoked before operation start
134
+ * Hook is series for stable output.
111
135
  */
112
- readonly createOperationsAsync: AsyncSeriesWaterfallHook<[
113
- Set<Operation>,
114
- ICreateOperationsContext
136
+ readonly beforeExecuteOperations: AsyncSeriesHook<[
137
+ Map<Operation, IOperationExecutionResult>,
138
+ IExecuteOperationsContext
115
139
  ]>;
116
140
  /**
117
- * Hook invoked when the operation graph is created, allowing the plugin to tap into it and interact with it.
141
+ * Hook invoked when operation status changed
142
+ * Hook is series for stable output.
143
+ */
144
+ readonly onOperationStatusChanged: SyncHook<[IOperationExecutionResult]>;
145
+ /**
146
+ * Hook invoked after executing a set of operations.
147
+ * Use the context to distinguish between the initial run and phased runs.
148
+ * Hook is series for stable output.
149
+ */
150
+ readonly afterExecuteOperations: AsyncSeriesHook<[IExecutionResult, IExecuteOperationsContext]>;
151
+ /**
152
+ * Hook invoked before executing a operation.
153
+ */
154
+ readonly beforeExecuteOperation: AsyncSeriesBailHook<[
155
+ IOperationRunnerContext & IOperationExecutionResult
156
+ ], OperationStatus | undefined>;
157
+ /**
158
+ * Hook invoked to define environment variables for an operation.
159
+ * May be invoked by the runner to get the environment for the operation.
160
+ */
161
+ readonly createEnvironmentForOperation: SyncWaterfallHook<[
162
+ IEnvironment,
163
+ IOperationRunnerContext & IOperationExecutionResult
164
+ ]>;
165
+ /**
166
+ * Hook invoked after executing a operation.
167
+ */
168
+ readonly afterExecuteOperation: AsyncSeriesHook<[
169
+ IOperationRunnerContext & IOperationExecutionResult
170
+ ]>;
171
+ /**
172
+ * Hook invoked to shutdown long-lived work in plugins.
173
+ */
174
+ readonly shutdownAsync: AsyncParallelHook<void>;
175
+ /**
176
+ * Hook invoked after a run has finished and the command is watching for changes.
177
+ * May be used to display additional relevant data to the user.
178
+ * Only relevant when running in watch mode.
179
+ */
180
+ readonly waitingForChanges: SyncHook<void>;
181
+ /**
182
+ * Hook invoked after executing operations and before waitingForChanges. Allows the caller
183
+ * to augment or modify the log entry about to be written.
118
184
  */
119
- readonly onGraphCreatedAsync: AsyncSeriesHook<[IOperationGraph, IOperationGraphContext]>;
185
+ readonly beforeLog: SyncHook<ITelemetryData, void>;
120
186
  }
121
187
  //# sourceMappingURL=PhasedCommandHooks.d.ts.map
@@ -44,13 +44,13 @@ export declare class Stopwatch implements IStopwatchResult {
44
44
  /**
45
45
  * Static helper function which creates a stopwatch which is immediately started
46
46
  */
47
- static start(startTimeOverride?: number): Stopwatch;
47
+ static start(): Stopwatch;
48
48
  get state(): StopwatchState;
49
49
  /**
50
50
  * Starts the stopwatch. Note that if end() has been called,
51
51
  * reset() should be called before calling start() again.
52
52
  */
53
- start(startTimeOverride?: number): Stopwatch;
53
+ start(): Stopwatch;
54
54
  /**
55
55
  * Stops executing the stopwatch and saves the current timestamp
56
56
  */
package/lib-shim/index.js CHANGED
@@ -1305,7 +1305,6 @@ exports.LockStepVersionPolicy = module.exports.LockStepVersionPolicy;
1305
1305
  exports.LookupByPath = module.exports.LookupByPath;
1306
1306
  exports.NpmOptionsConfiguration = module.exports.NpmOptionsConfiguration;
1307
1307
  exports.Operation = module.exports.Operation;
1308
- exports.OperationGraphHooks = module.exports.OperationGraphHooks;
1309
1308
  exports.OperationStatus = module.exports.OperationStatus;
1310
1309
  exports.PackageJsonDependency = module.exports.PackageJsonDependency;
1311
1310
  exports.PackageJsonDependencyMeta = module.exports.PackageJsonDependencyMeta;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/rush-sdk",
3
- "version": "5.170.1-pr5378.0",
3
+ "version": "5.171.0",
4
4
  "description": "An API for interacting with the Rush engine",
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,23 +40,23 @@
40
40
  "@pnpm/lockfile.types-900": "npm:@pnpm/lockfile.types@~900.0.0",
41
41
  "tapable": "2.2.1",
42
42
  "@rushstack/credential-cache": "0.2.7",
43
- "@rushstack/node-core-library": "5.20.3",
44
43
  "@rushstack/lookup-by-path": "0.9.7",
44
+ "@rushstack/terminal": "0.22.3",
45
45
  "@rushstack/package-deps-hash": "4.7.7",
46
- "@rushstack/terminal": "0.22.3"
46
+ "@rushstack/node-core-library": "5.20.3"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/semver": "7.5.0",
50
50
  "@types/webpack-env": "1.18.8",
51
51
  "eslint": "~9.37.0",
52
52
  "webpack": "~5.105.2",
53
- "@microsoft/rush-lib": "5.170.1-pr5378.0",
53
+ "@microsoft/rush-lib": "5.171.0",
54
54
  "@rushstack/heft": "1.2.7",
55
- "@rushstack/stream-collator": "4.2.7",
56
- "@rushstack/ts-command-line": "5.3.3",
57
55
  "@rushstack/heft-webpack5-plugin": "1.3.7",
58
- "local-node-rig": "1.0.0",
59
- "@rushstack/webpack-preserve-dynamic-require-plugin": "0.12.8"
56
+ "@rushstack/ts-command-line": "5.3.3",
57
+ "@rushstack/stream-collator": "4.2.7",
58
+ "@rushstack/webpack-preserve-dynamic-require-plugin": "0.12.8",
59
+ "local-node-rig": "1.0.0"
60
60
  },
61
61
  "sideEffects": false,
62
62
  "scripts": {
@@ -1,2 +0,0 @@
1
- const _m = require("../../../lib-shim/index.js")._rushSdk_loadInternalModule("logic/operations/IOperationGraph");
2
- module.exports = _m;
@@ -1,3 +0,0 @@
1
- const _m = require("../../../lib-shim/index.js")._rushSdk_loadInternalModule("logic/operations/OperationGraph");
2
- module.exports = _m;
3
- exports.OperationGraph = _m.OperationGraph;
@@ -1,3 +0,0 @@
1
- const _m = require("../../lib-shim/index.js")._rushSdk_loadInternalModule("pluginFramework/OperationGraphHooks");
2
- module.exports = _m;
3
- exports.OperationGraphHooks = _m.OperationGraphHooks;
@@ -1,137 +0,0 @@
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