@rushstack/rush-sdk 5.147.2 → 5.149.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.
@@ -24,6 +24,7 @@ import { LookupByPath } from '@rushstack/lookup-by-path';
24
24
  import { PackageNameParser } from '@rushstack/node-core-library';
25
25
  import type { StdioSummarizer } from '@rushstack/terminal';
26
26
  import { SyncHook } from 'tapable';
27
+ import { SyncWaterfallHook } from 'tapable';
27
28
  import { Terminal } from '@rushstack/terminal';
28
29
 
29
30
  /**
@@ -1476,6 +1477,14 @@ export declare interface IExperimentsJson {
1476
1477
  * When this toggle is enabled, Rush will only scan specific paths, significantly speeding up Git operations.
1477
1478
  */
1478
1479
  enableSubpathScan?: boolean;
1480
+ /**
1481
+ * Rush has a policy that normally requires Rush projects to specify `workspace:*` in package.json when depending
1482
+ * on other projects in the workspace, unless they are explicitly declared as `decoupledLocalDependencies`
1483
+ * in rush.json. Enabling this experiment will remove that requirement for dependencies belonging to a different
1484
+ * subspace. This is useful for large product groups who work in separate subspaces and generally prefer to consume
1485
+ * each other's packages via the NPM registry.
1486
+ */
1487
+ exemptDecoupledDependenciesBetweenSubspaces?: boolean;
1479
1488
  }
1480
1489
 
1481
1490
  /**
@@ -1902,6 +1911,11 @@ export declare interface IOperationRunnerContext {
1902
1911
  * 'failure'.
1903
1912
  */
1904
1913
  status: OperationStatus;
1914
+ /**
1915
+ * The environment in which the operation is being executed.
1916
+ * A return value of `undefined` indicates that it should inherit the environment from the parent process.
1917
+ */
1918
+ environment: IEnvironment | undefined;
1905
1919
  /**
1906
1920
  * Error which occurred while executing this operation, this is stored in case we need
1907
1921
  * it later (for example to re-print errors at end of execution).
@@ -3088,6 +3102,14 @@ export declare class PhasedCommandHooks {
3088
3102
  readonly beforeExecuteOperation: AsyncSeriesBailHook<[
3089
3103
  IOperationRunnerContext & IOperationExecutionResult
3090
3104
  ], OperationStatus | undefined>;
3105
+ /**
3106
+ * Hook invoked to define environment variables for an operation.
3107
+ * May be invoked by the runner to get the environment for the operation.
3108
+ */
3109
+ readonly createEnvironmentForOperation: SyncWaterfallHook<[
3110
+ IEnvironment,
3111
+ IOperationRunnerContext & IOperationExecutionResult
3112
+ ]>;
3091
3113
  /**
3092
3114
  * Hook invoked after executing a operation.
3093
3115
  */
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.48.1"
8
+ "packageVersion": "7.50.0"
9
9
  }
10
10
  ]
11
11
  }
@@ -94,6 +94,14 @@ export interface IExperimentsJson {
94
94
  * When this toggle is enabled, Rush will only scan specific paths, significantly speeding up Git operations.
95
95
  */
96
96
  enableSubpathScan?: boolean;
97
+ /**
98
+ * Rush has a policy that normally requires Rush projects to specify `workspace:*` in package.json when depending
99
+ * on other projects in the workspace, unless they are explicitly declared as `decoupledLocalDependencies`
100
+ * in rush.json. Enabling this experiment will remove that requirement for dependencies belonging to a different
101
+ * subspace. This is useful for large product groups who work in separate subspaces and generally prefer to consume
102
+ * each other's packages via the NPM registry.
103
+ */
104
+ exemptDecoupledDependenciesBetweenSubspaces?: boolean;
97
105
  }
98
106
  /**
99
107
  * Use this class to load the "common/config/rush/experiments.json" config file.
@@ -53,6 +53,7 @@ export declare class PhasedScriptAction extends BaseScriptAction<IPhasedCommandC
53
53
  private readonly _installParameter;
54
54
  private readonly _variantParameter;
55
55
  private readonly _noIPCParameter;
56
+ private readonly _nodeDiagnosticDirParameter;
56
57
  constructor(options: IPhasedScriptActionOptions);
57
58
  runAsync(): Promise<void>;
58
59
  private _runInitialPhasesAsync;
@@ -1,32 +1,35 @@
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
- export interface IProjectBuildCacheOptions {
4
+ import type { OperationExecutionRecord } from '../operations/OperationExecutionRecord';
5
+ export interface IOperationBuildCacheOptions {
5
6
  /**
6
7
  * The repo-wide configuration for the build cache.
7
8
  */
8
9
  buildCacheConfiguration: BuildCacheConfiguration;
9
10
  /**
10
- * The project to be cached.
11
+ * The terminal to use for logging.
11
12
  */
12
- project: RushConfigurationProject;
13
+ terminal: ITerminal;
14
+ }
15
+ export type IProjectBuildCacheOptions = IOperationBuildCacheOptions & {
13
16
  /**
14
17
  * Value from rush-project.json
15
18
  */
16
19
  projectOutputFolderNames: ReadonlyArray<string>;
17
20
  /**
18
- * The hash of all relevant inputs and configuration that uniquely identifies this execution.
21
+ * The project to be cached.
19
22
  */
20
- operationStateHash: string;
23
+ project: RushConfigurationProject;
21
24
  /**
22
- * The terminal to use for logging.
25
+ * The hash of all relevant inputs and configuration that uniquely identifies this execution.
23
26
  */
24
- terminal: ITerminal;
27
+ operationStateHash: string;
25
28
  /**
26
29
  * The name of the phase that is being cached.
27
30
  */
28
31
  phaseName: string;
29
- }
32
+ };
30
33
  export declare class ProjectBuildCache {
31
34
  private static _tarUtilityPromise;
32
35
  private readonly _project;
@@ -40,6 +43,7 @@ export declare class ProjectBuildCache {
40
43
  private static _tryGetTarUtility;
41
44
  get cacheId(): string | undefined;
42
45
  static getProjectBuildCache(options: IProjectBuildCacheOptions): ProjectBuildCache;
46
+ static forOperation(operation: OperationExecutionRecord, options: IOperationBuildCacheOptions): ProjectBuildCache;
43
47
  tryRestoreFromCacheAsync(terminal: ITerminal, specifiedCacheId?: string): Promise<boolean>;
44
48
  trySetCacheEntryAsync(terminal: ITerminal, specifiedCacheId?: string): Promise<boolean>;
45
49
  /**
@@ -3,6 +3,7 @@ import type { CollatedWriter } from '@rushstack/stream-collator';
3
3
  import type { OperationStatus } from './OperationStatus';
4
4
  import type { OperationMetadataManager } from './OperationMetadataManager';
5
5
  import type { IStopwatchResult } from '../../utilities/Stopwatch';
6
+ import type { IEnvironment } from '../../utilities/Utilities';
6
7
  /**
7
8
  * Information passed to the executing `IOperationRunner`
8
9
  *
@@ -38,6 +39,11 @@ export interface IOperationRunnerContext {
38
39
  * 'failure'.
39
40
  */
40
41
  status: OperationStatus;
42
+ /**
43
+ * The environment in which the operation is being executed.
44
+ * A return value of `undefined` indicates that it should inherit the environment from the parent process.
45
+ */
46
+ environment: IEnvironment | undefined;
41
47
  /**
42
48
  * Error which occurred while executing this operation, this is stored in case we need
43
49
  * it later (for example to re-print errors at end of execution).
@@ -6,7 +6,8 @@ export interface IIPCOperationRunnerOptions {
6
6
  phase: IPhase;
7
7
  project: RushConfigurationProject;
8
8
  name: string;
9
- shellCommand: string;
9
+ commandToRun: string;
10
+ commandForHash: string;
10
11
  persist: boolean;
11
12
  requestRun: (requestor?: string) => void;
12
13
  }
@@ -19,9 +20,9 @@ export declare class IPCOperationRunner implements IOperationRunner {
19
20
  readonly reportTiming: boolean;
20
21
  readonly silent: boolean;
21
22
  readonly warningsAreAllowed: boolean;
22
- private readonly _rushConfiguration;
23
- private readonly _shellCommand;
24
- private readonly _workingDirectory;
23
+ private readonly _rushProject;
24
+ private readonly _commandToRun;
25
+ private readonly _commandForHash;
25
26
  private readonly _persist;
26
27
  private readonly _requestRun;
27
28
  private _ipcProcess;
@@ -0,0 +1,13 @@
1
+ import type { IPhasedCommandPlugin, PhasedCommandHooks } from '../../pluginFramework/PhasedCommandHooks';
2
+ export interface INodeDiagnosticDirPluginOptions {
3
+ diagnosticDir: string;
4
+ }
5
+ /**
6
+ * Phased command plugin that configures the NodeJS --diagnostic-dir option to contain the project and phase name.
7
+ */
8
+ export declare class NodeDiagnosticDirPlugin implements IPhasedCommandPlugin {
9
+ private readonly _diagnosticsDir;
10
+ constructor(options: INodeDiagnosticDirPluginOptions);
11
+ apply(hooks: PhasedCommandHooks): void;
12
+ }
13
+ //# sourceMappingURL=NodeDiagnosticDirPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/operations/NodeDiagnosticDirPlugin");
@@ -3,6 +3,7 @@ import type { Operation } from './Operation';
3
3
  import { OperationStatus } from './OperationStatus';
4
4
  import { OperationExecutionRecord } from './OperationExecutionRecord';
5
5
  import type { IExecutionResult } from './IOperationExecutionResult';
6
+ import type { IEnvironment } from '../../utilities/Utilities';
6
7
  export interface IOperationExecutionManagerOptions {
7
8
  quietMode: boolean;
8
9
  debugMode: boolean;
@@ -11,6 +12,7 @@ export interface IOperationExecutionManagerOptions {
11
12
  destination?: TerminalWritable;
12
13
  beforeExecuteOperationAsync?: (operation: OperationExecutionRecord) => Promise<OperationStatus | undefined>;
13
14
  afterExecuteOperationAsync?: (operation: OperationExecutionRecord) => Promise<void>;
15
+ createEnvironmentForOperation?: (operation: OperationExecutionRecord) => IEnvironment;
14
16
  onOperationStatusChangedAsync?: (record: OperationExecutionRecord) => void;
15
17
  beforeExecuteOperationsAsync?: (records: Map<Operation, OperationExecutionRecord>) => Promise<void>;
16
18
  }
@@ -34,6 +36,7 @@ export declare class OperationExecutionManager {
34
36
  private readonly _afterExecuteOperation?;
35
37
  private readonly _onOperationStatusChanged?;
36
38
  private readonly _beforeExecuteOperations?;
39
+ private readonly _createEnvironmentForOperation?;
37
40
  private _hasAnyFailures;
38
41
  private _hasAnyNonAllowedWarnings;
39
42
  private _completedOperations;
@@ -9,9 +9,13 @@ import type { IPhase } from '../../api/CommandLineConfiguration';
9
9
  import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
10
10
  import { type ILogFilePaths } from './ProjectLogWritable';
11
11
  import type { IOperationExecutionResult } from './IOperationExecutionResult';
12
+ import type { IInputsSnapshot } from '../incremental/InputsSnapshot';
13
+ import type { BuildCacheConfiguration } from '../../api/BuildCacheConfiguration';
14
+ import type { IEnvironment } from '../../utilities/Utilities';
12
15
  export interface IOperationExecutionRecordContext {
13
16
  streamCollator: StreamCollator;
14
17
  onOperationStatusChanged?: (record: OperationExecutionRecord) => void;
18
+ createEnvironment?: (record: OperationExecutionRecord) => IEnvironment;
15
19
  debugMode: boolean;
16
20
  quietMode: boolean;
17
21
  }
@@ -80,6 +84,7 @@ export declare class OperationExecutionRecord implements IOperationRunnerContext
80
84
  private readonly _context;
81
85
  private _collatedWriter;
82
86
  private _status;
87
+ private _stateHash;
83
88
  constructor(operation: Operation, context: IOperationExecutionRecordContext);
84
89
  get name(): string;
85
90
  get weight(): number;
@@ -88,6 +93,7 @@ export declare class OperationExecutionRecord implements IOperationRunnerContext
88
93
  get collatedWriter(): CollatedWriter;
89
94
  get nonCachedDurationMs(): number | undefined;
90
95
  get cobuildRunnerId(): string | undefined;
96
+ get environment(): IEnvironment | undefined;
91
97
  get metadataFolderPath(): string | undefined;
92
98
  get isTerminal(): boolean;
93
99
  /**
@@ -99,6 +105,7 @@ export declare class OperationExecutionRecord implements IOperationRunnerContext
99
105
  get status(): OperationStatus;
100
106
  set status(newStatus: OperationStatus);
101
107
  get silent(): boolean;
108
+ get stateHash(): string;
102
109
  /**
103
110
  * {@inheritdoc IOperationRunnerContext.runWithTerminalAsync}
104
111
  */
@@ -110,5 +117,9 @@ export declare class OperationExecutionRecord implements IOperationRunnerContext
110
117
  onStart: (record: OperationExecutionRecord) => Promise<OperationStatus | undefined>;
111
118
  onResult: (record: OperationExecutionRecord) => Promise<void>;
112
119
  }): Promise<void>;
120
+ calculateStateHash(options: {
121
+ inputsSnapshot: IInputsSnapshot;
122
+ buildCacheConfiguration: BuildCacheConfiguration;
123
+ }): string;
113
124
  }
114
125
  //# sourceMappingURL=OperationExecutionRecord.d.ts.map
@@ -1,17 +1,13 @@
1
1
  import type { IPhase } from '../../api/CommandLineConfiguration';
2
- import type { RushConfiguration } from '../../api/RushConfiguration';
3
2
  import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
4
- import { type IEnvironment } from '../../utilities/Utilities';
5
3
  import type { IOperationRunner, IOperationRunnerContext } from './IOperationRunner';
6
4
  import { OperationStatus } from './OperationStatus';
7
- export interface IOperationRunnerOptions {
5
+ export interface IShellOperationRunnerOptions {
6
+ phase: IPhase;
8
7
  rushProject: RushConfigurationProject;
9
- rushConfiguration: RushConfiguration;
8
+ displayName: string;
10
9
  commandToRun: string;
11
10
  commandForHash: string;
12
- displayName: string;
13
- phase: IPhase;
14
- environment?: IEnvironment;
15
11
  }
16
12
  /**
17
13
  * An `IOperationRunner` subclass that performs an operation via a shell command.
@@ -24,12 +20,10 @@ export declare class ShellOperationRunner implements IOperationRunner {
24
20
  readonly silent: boolean;
25
21
  readonly cacheable: boolean;
26
22
  readonly warningsAreAllowed: boolean;
27
- private readonly _commandToRun;
23
+ readonly commandToRun: string;
28
24
  private readonly _commandForHash;
29
25
  private readonly _rushProject;
30
- private readonly _rushConfiguration;
31
- private readonly _environment?;
32
- constructor(options: IOperationRunnerOptions);
26
+ constructor(options: IShellOperationRunnerOptions);
33
27
  executeAsync(context: IOperationRunnerContext): Promise<OperationStatus>;
34
28
  getConfigHash(): string;
35
29
  private _executeAsync;
@@ -1,4 +1,4 @@
1
- import { AsyncParallelHook, AsyncSeriesBailHook, AsyncSeriesHook, AsyncSeriesWaterfallHook, SyncHook } 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';
@@ -12,6 +12,7 @@ import type { IOperationRunnerContext } from '../logic/operations/IOperationRunn
12
12
  import type { ITelemetryData } from '../logic/Telemetry';
13
13
  import type { OperationStatus } from '../logic/operations/OperationStatus';
14
14
  import type { IInputsSnapshot } from '../logic/incremental/InputsSnapshot';
15
+ import type { IEnvironment } from '../utilities/Utilities';
15
16
  /**
16
17
  * A plugin that interacts with a phased commands.
17
18
  * @alpha
@@ -132,6 +133,14 @@ export declare class PhasedCommandHooks {
132
133
  readonly beforeExecuteOperation: AsyncSeriesBailHook<[
133
134
  IOperationRunnerContext & IOperationExecutionResult
134
135
  ], OperationStatus | undefined>;
136
+ /**
137
+ * Hook invoked to define environment variables for an operation.
138
+ * May be invoked by the runner to get the environment for the operation.
139
+ */
140
+ readonly createEnvironmentForOperation: SyncWaterfallHook<[
141
+ IEnvironment,
142
+ IOperationRunnerContext & IOperationExecutionResult
143
+ ]>;
135
144
  /**
136
145
  * Hook invoked after executing a operation.
137
146
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/rush-sdk",
3
- "version": "5.147.2",
3
+ "version": "5.149.0",
4
4
  "description": "An API for interacting with the Rush engine",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,22 +35,22 @@
35
35
  "dependencies": {
36
36
  "@pnpm/lockfile.types": "~1.0.3",
37
37
  "tapable": "2.2.1",
38
- "@rushstack/lookup-by-path": "0.5.0",
39
- "@rushstack/package-deps-hash": "4.3.1",
40
- "@rushstack/node-core-library": "5.10.1",
41
- "@rushstack/terminal": "0.14.4"
38
+ "@rushstack/lookup-by-path": "0.5.5",
39
+ "@rushstack/package-deps-hash": "4.3.6",
40
+ "@rushstack/terminal": "0.15.0",
41
+ "@rushstack/node-core-library": "5.11.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/semver": "7.5.0",
45
45
  "@types/webpack-env": "1.18.0",
46
46
  "webpack": "~5.95.0",
47
- "@rushstack/heft": "0.68.11",
48
- "@microsoft/rush-lib": "5.147.2",
49
- "@rushstack/stream-collator": "4.1.79",
47
+ "@microsoft/rush-lib": "5.149.0",
48
+ "@rushstack/heft": "0.68.16",
50
49
  "local-node-rig": "1.0.0",
51
- "@rushstack/heft-webpack5-plugin": "0.11.9",
52
- "@rushstack/webpack-preserve-dynamic-require-plugin": "0.11.78",
53
- "@rushstack/ts-command-line": "4.23.2"
50
+ "@rushstack/heft-webpack5-plugin": "0.11.14",
51
+ "@rushstack/ts-command-line": "4.23.5",
52
+ "@rushstack/stream-collator": "4.1.84",
53
+ "@rushstack/webpack-preserve-dynamic-require-plugin": "0.11.83"
54
54
  },
55
55
  "scripts": {
56
56
  "build": "heft build --clean",