@rushstack/rush-sdk 5.153.1 → 5.154.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.
@@ -1274,6 +1274,10 @@ export declare interface ICredentialCacheEntry {
1274
1274
  */
1275
1275
  export declare interface ICredentialCacheOptions {
1276
1276
  supportEditing: boolean;
1277
+ /**
1278
+ * If specified, use the specified path instead of the default path of `~/.rush-user/credentials.json`
1279
+ */
1280
+ cacheFilePath?: string;
1277
1281
  }
1278
1282
 
1279
1283
  /**
@@ -1580,6 +1584,10 @@ export declare interface IInputsSnapshot {
1580
1584
  * The directory that all paths in `hashes` are relative to.
1581
1585
  */
1582
1586
  readonly rootDirectory: string;
1587
+ /**
1588
+ * Whether or not the repository has uncommitted changes.
1589
+ */
1590
+ readonly hasUncommittedChanges: boolean;
1583
1591
  /**
1584
1592
  * Gets the map of file paths to Git hashes that will be used to compute the local state hash of the operation.
1585
1593
  * Exposed separately from the final state hash to facilitate detailed change detection.
@@ -1745,6 +1753,20 @@ export declare class IndividualVersionPolicy extends VersionPolicy {
1745
1753
  export declare interface _INpmOptionsJson extends IPackageManagerOptionsJsonBase {
1746
1754
  }
1747
1755
 
1756
+ /**
1757
+ * @internal
1758
+ */
1759
+ export declare interface _IOperationBuildCacheOptions {
1760
+ /**
1761
+ * The repo-wide configuration for the build cache.
1762
+ */
1763
+ buildCacheConfiguration: BuildCacheConfiguration;
1764
+ /**
1765
+ * The terminal to use for logging.
1766
+ */
1767
+ terminal: ITerminal;
1768
+ }
1769
+
1748
1770
  /**
1749
1771
  * The `IOperationExecutionResult` interface represents the results of executing an {@link Operation}.
1750
1772
  * @alpha
@@ -1782,10 +1804,6 @@ export declare interface IOperationExecutionResult {
1782
1804
  * The value indicates the duration of the same operation without cache hit.
1783
1805
  */
1784
1806
  readonly nonCachedDurationMs: number | undefined;
1785
- /**
1786
- * The id of the runner which actually runs the building process in cobuild mode.
1787
- */
1788
- readonly cobuildRunnerId: string | undefined;
1789
1807
  /**
1790
1808
  * The relative path to the folder that contains operation metadata. This folder will be automatically included in cache entries.
1791
1809
  */
@@ -2237,6 +2255,28 @@ export declare interface IPnpmPeerDependencyRules {
2237
2255
 
2238
2256
  export { IPrefixMatch }
2239
2257
 
2258
+ /**
2259
+ * @internal
2260
+ */
2261
+ export declare type _IProjectBuildCacheOptions = _IOperationBuildCacheOptions & {
2262
+ /**
2263
+ * Value from rush-project.json
2264
+ */
2265
+ projectOutputFolderNames: ReadonlyArray<string>;
2266
+ /**
2267
+ * The project to be cached.
2268
+ */
2269
+ project: RushConfigurationProject;
2270
+ /**
2271
+ * The hash of all relevant inputs and configuration that uniquely identifies this execution.
2272
+ */
2273
+ operationStateHash: string;
2274
+ /**
2275
+ * The name of the phase that is being cached.
2276
+ */
2277
+ phaseName: string;
2278
+ };
2279
+
2240
2280
  /**
2241
2281
  * Information about the currently executing command provided to plugins.
2242
2282
  * @beta
@@ -2857,6 +2897,35 @@ export declare class Operation {
2857
2897
  deleteDependency(dependency: Operation): void;
2858
2898
  }
2859
2899
 
2900
+ /**
2901
+ * @internal
2902
+ */
2903
+ export declare class _OperationBuildCache {
2904
+ private static _tarUtilityPromise;
2905
+ private readonly _project;
2906
+ private readonly _localBuildCacheProvider;
2907
+ private readonly _cloudBuildCacheProvider;
2908
+ private readonly _buildCacheEnabled;
2909
+ private readonly _cacheWriteEnabled;
2910
+ private readonly _projectOutputFolderNames;
2911
+ private readonly _cacheId;
2912
+ private constructor();
2913
+ private static _tryGetTarUtility;
2914
+ get cacheId(): string | undefined;
2915
+ static getOperationBuildCache(options: _IProjectBuildCacheOptions): _OperationBuildCache;
2916
+ static forOperation(executionResult: IOperationExecutionResult, options: _IOperationBuildCacheOptions): _OperationBuildCache;
2917
+ tryRestoreFromCacheAsync(terminal: ITerminal, specifiedCacheId?: string): Promise<boolean>;
2918
+ trySetCacheEntryAsync(terminal: ITerminal, specifiedCacheId?: string): Promise<boolean>;
2919
+ /**
2920
+ * Walks the declared output folders of the project and collects a list of files.
2921
+ * @returns The list of output files as project-relative paths, or `undefined` if a
2922
+ * symbolic link was encountered.
2923
+ */
2924
+ private _tryCollectPathsToCacheAsync;
2925
+ private _getTarLogFilePath;
2926
+ private static _getCacheId;
2927
+ }
2928
+
2860
2929
  /**
2861
2930
  * A helper class for managing the meta files of a operation.
2862
2931
  *
@@ -2869,6 +2938,7 @@ export declare class _OperationMetadataManager {
2869
2938
  private readonly _logPath;
2870
2939
  private readonly _errorLogPath;
2871
2940
  private readonly _logChunksPath;
2941
+ wasCobuilt: boolean;
2872
2942
  constructor(options: _IOperationMetadataManagerOptions);
2873
2943
  /**
2874
2944
  * Returns the relative paths of the metadata files to project folder.
@@ -2879,11 +2949,14 @@ export declare class _OperationMetadataManager {
2879
2949
  */
2880
2950
  get metadataFolderPath(): string;
2881
2951
  saveAsync({ durationInSeconds, cobuildContextId, cobuildRunnerId, logPath, errorLogPath, logChunksPath }: _IOperationMetadata): Promise<void>;
2882
- tryRestoreAsync({ terminal, terminalProvider, errorLogPath }: {
2952
+ tryRestoreAsync({ terminal, terminalProvider, errorLogPath, cobuildContextId, cobuildRunnerId }: {
2883
2953
  terminalProvider: ITerminalProvider;
2884
2954
  terminal: ITerminal;
2885
2955
  errorLogPath: string;
2956
+ cobuildContextId?: string;
2957
+ cobuildRunnerId?: string;
2886
2958
  }): Promise<void>;
2959
+ tryRestoreStopwatch(originalStopwatch: IStopwatchResult): IStopwatchResult;
2887
2960
  }
2888
2961
 
2889
2962
  /**
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.52.5"
8
+ "packageVersion": "7.52.8"
9
9
  }
10
10
  ]
11
11
  }
package/lib/index.d.ts CHANGED
@@ -59,4 +59,6 @@ export type { IStopwatchResult } from './utilities/Stopwatch';
59
59
  export { OperationStateFile as _OperationStateFile, type IOperationStateFileOptions as _IOperationStateFileOptions, type IOperationStateJson as _IOperationStateJson } from './logic/operations/OperationStateFile';
60
60
  export { OperationMetadataManager as _OperationMetadataManager, type IOperationMetadataManagerOptions as _IOperationMetadataManagerOptions, type IOperationMetaData as _IOperationMetadata } from './logic/operations/OperationMetadataManager';
61
61
  export { RushCommandLine, type IRushCommandLineSpec, type IRushCommandLineParameter, type IRushCommandLineAction } from './api/RushCommandLine';
62
+ export { OperationBuildCache as _OperationBuildCache } from './logic/buildCache/OperationBuildCache';
63
+ export type { IOperationBuildCacheOptions as _IOperationBuildCacheOptions, IProjectBuildCacheOptions as _IProjectBuildCacheOptions } from './logic/buildCache/OperationBuildCache';
62
64
  //# sourceMappingURL=index.d.ts.map
@@ -11,6 +11,10 @@ export interface ICredentialCacheEntry {
11
11
  */
12
12
  export interface ICredentialCacheOptions {
13
13
  supportEditing: boolean;
14
+ /**
15
+ * If specified, use the specified path instead of the default path of `~/.rush-user/credentials.json`
16
+ */
17
+ cacheFilePath?: string;
14
18
  }
15
19
  /**
16
20
  * @beta
@@ -1,7 +1,10 @@
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 { OperationExecutionRecord } from '../operations/OperationExecutionRecord';
4
+ import type { IOperationExecutionResult } from '../operations/IOperationExecutionResult';
5
+ /**
6
+ * @internal
7
+ */
5
8
  export interface IOperationBuildCacheOptions {
6
9
  /**
7
10
  * The repo-wide configuration for the build cache.
@@ -12,6 +15,9 @@ export interface IOperationBuildCacheOptions {
12
15
  */
13
16
  terminal: ITerminal;
14
17
  }
18
+ /**
19
+ * @internal
20
+ */
15
21
  export type IProjectBuildCacheOptions = IOperationBuildCacheOptions & {
16
22
  /**
17
23
  * Value from rush-project.json
@@ -30,7 +36,10 @@ export type IProjectBuildCacheOptions = IOperationBuildCacheOptions & {
30
36
  */
31
37
  phaseName: string;
32
38
  };
33
- export declare class ProjectBuildCache {
39
+ /**
40
+ * @internal
41
+ */
42
+ export declare class OperationBuildCache {
34
43
  private static _tarUtilityPromise;
35
44
  private readonly _project;
36
45
  private readonly _localBuildCacheProvider;
@@ -42,8 +51,8 @@ export declare class ProjectBuildCache {
42
51
  private constructor();
43
52
  private static _tryGetTarUtility;
44
53
  get cacheId(): string | undefined;
45
- static getProjectBuildCache(options: IProjectBuildCacheOptions): ProjectBuildCache;
46
- static forOperation(operation: OperationExecutionRecord, options: IOperationBuildCacheOptions): ProjectBuildCache;
54
+ static getOperationBuildCache(options: IProjectBuildCacheOptions): OperationBuildCache;
55
+ static forOperation(executionResult: IOperationExecutionResult, options: IOperationBuildCacheOptions): OperationBuildCache;
47
56
  tryRestoreFromCacheAsync(terminal: ITerminal, specifiedCacheId?: string): Promise<boolean>;
48
57
  trySetCacheEntryAsync(terminal: ITerminal, specifiedCacheId?: string): Promise<boolean>;
49
58
  /**
@@ -55,4 +64,4 @@ export declare class ProjectBuildCache {
55
64
  private _getTarLogFilePath;
56
65
  private static _getCacheId;
57
66
  }
58
- //# sourceMappingURL=ProjectBuildCache.d.ts.map
67
+ //# sourceMappingURL=OperationBuildCache.d.ts.map
@@ -1 +1 @@
1
- module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/buildCache/ProjectBuildCache");
1
+ module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/buildCache/OperationBuildCache");
@@ -1,7 +1,7 @@
1
1
  import type { CobuildConfiguration } from '../../api/CobuildConfiguration';
2
2
  import type { OperationStatus } from '../operations/OperationStatus';
3
3
  import type { ICobuildContext } from './ICobuildLockProvider';
4
- import type { ProjectBuildCache } from '../buildCache/ProjectBuildCache';
4
+ import type { OperationBuildCache } from '../buildCache/OperationBuildCache';
5
5
  export interface ICobuildLockOptions {
6
6
  /**
7
7
  * {@inheritdoc CobuildConfiguration}
@@ -19,7 +19,7 @@ export interface ICobuildLockOptions {
19
19
  * {@inheritdoc ICobuildContext.phaseName}
20
20
  */
21
21
  phaseName: string;
22
- projectBuildCache: ProjectBuildCache;
22
+ operationBuildCache: OperationBuildCache;
23
23
  /**
24
24
  * The expire time of the lock in seconds.
25
25
  */
@@ -31,7 +31,7 @@ export interface ICobuildCompletedState {
31
31
  }
32
32
  export declare class CobuildLock {
33
33
  readonly cobuildConfiguration: CobuildConfiguration;
34
- readonly projectBuildCache: ProjectBuildCache;
34
+ readonly operationBuildCache: OperationBuildCache;
35
35
  private _cobuildContext;
36
36
  constructor(options: ICobuildLockOptions);
37
37
  setCompletedStateAsync(state: ICobuildCompletedState): Promise<void>;
@@ -50,6 +50,10 @@ export interface IInputsSnapshotParameters {
50
50
  * The hashes of all tracked files in the repository.
51
51
  */
52
52
  hashes: ReadonlyMap<string, string>;
53
+ /**
54
+ * Whether or not the repository has uncommitted changes.
55
+ */
56
+ hasUncommittedChanges: boolean;
53
57
  /**
54
58
  * Optimized lookup engine used to route `hashes` to individual projects.
55
59
  */
@@ -78,6 +82,10 @@ export interface IInputsSnapshot {
78
82
  * The directory that all paths in `hashes` are relative to.
79
83
  */
80
84
  readonly rootDirectory: string;
85
+ /**
86
+ * Whether or not the repository has uncommitted changes.
87
+ */
88
+ readonly hasUncommittedChanges: boolean;
81
89
  /**
82
90
  * Gets the map of file paths to Git hashes that will be used to compute the local state hash of the operation.
83
91
  * Exposed separately from the final state hash to facilitate detailed change detection.
@@ -110,6 +118,10 @@ export declare class InputsSnapshot implements IInputsSnapshot {
110
118
  * {@inheritdoc IInputsSnapshot.hashes}
111
119
  */
112
120
  readonly hashes: ReadonlyMap<string, string>;
121
+ /**
122
+ * {@inheritdoc IInputsSnapshot.hasUncommittedChanges}
123
+ */
124
+ readonly hasUncommittedChanges: boolean;
113
125
  /**
114
126
  * {@inheritdoc IInputsSnapshot.rootDirectory}
115
127
  */
@@ -1,6 +1,6 @@
1
1
  import { type TerminalWritable, type ITerminal } from '@rushstack/terminal';
2
2
  import { CobuildLock } from '../cobuild/CobuildLock';
3
- import { ProjectBuildCache } from '../buildCache/ProjectBuildCache';
3
+ import { OperationBuildCache } from '../buildCache/OperationBuildCache';
4
4
  import type { CobuildConfiguration } from '../../api/CobuildConfiguration';
5
5
  import { DisjointSet } from '../cobuild/DisjointSet';
6
6
  import { PeriodicCallback } from './PeriodicCallback';
@@ -16,7 +16,7 @@ export interface IProjectDeps {
16
16
  export interface IOperationBuildCacheContext {
17
17
  isCacheWriteAllowed: boolean;
18
18
  isCacheReadAllowed: boolean;
19
- operationBuildCache: ProjectBuildCache | undefined;
19
+ operationBuildCache: OperationBuildCache | undefined;
20
20
  cacheDisabledReason: string | undefined;
21
21
  outputFolderNames: ReadonlyArray<string>;
22
22
  cobuildLock: CobuildLock | undefined;
@@ -40,8 +40,8 @@ export declare class CacheableOperationPlugin implements IPhasedCommandPlugin {
40
40
  apply(hooks: PhasedCommandHooks): void;
41
41
  private _getBuildCacheContextByOperation;
42
42
  private _getBuildCacheContextByOperationOrThrow;
43
- private _tryGetProjectBuildCache;
44
- private _tryGetLogOnlyProjectBuildCacheAsync;
43
+ private _tryGetOperationBuildCache;
44
+ private _tryGetLogOnlyOperationBuildCacheAsync;
45
45
  private _tryGetCobuildLockAsync;
46
46
  private _createBuildCacheTerminalAsync;
47
47
  private _tryGetBuildCacheTerminalWritableAsync;
@@ -16,11 +16,11 @@ export declare class ConsoleTimelinePlugin implements IPhasedCommandPlugin {
16
16
  export interface IPrintTimelineParameters {
17
17
  terminal: ITerminal;
18
18
  result: IExecutionResult;
19
- cobuildConfiguration: CobuildConfiguration | undefined;
19
+ cobuildConfiguration?: CobuildConfiguration;
20
20
  }
21
21
  /**
22
22
  * Print a more detailed timeline and analysis of CPU usage for the build.
23
23
  * @internal
24
24
  */
25
- export declare function _printTimeline({ terminal, result, cobuildConfiguration }: IPrintTimelineParameters): void;
25
+ export declare function _printTimeline({ terminal, result }: IPrintTimelineParameters): void;
26
26
  //# sourceMappingURL=ConsoleTimelinePlugin.d.ts.map
@@ -40,10 +40,6 @@ export interface IOperationExecutionResult {
40
40
  * The value indicates the duration of the same operation without cache hit.
41
41
  */
42
42
  readonly nonCachedDurationMs: number | undefined;
43
- /**
44
- * The id of the runner which actually runs the building process in cobuild mode.
45
- */
46
- readonly cobuildRunnerId: string | undefined;
47
43
  /**
48
44
  * The relative path to the folder that contains operation metadata. This folder will be automatically included in cache entries.
49
45
  */
@@ -7,10 +7,13 @@ 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 ILogFilePaths } from './ProjectLogWritable';
11
10
  import type { IOperationExecutionResult } from './IOperationExecutionResult';
12
11
  import type { IInputsSnapshot } from '../incremental/InputsSnapshot';
13
12
  import type { IEnvironment } from '../../utilities/Utilities';
13
+ import { type ILogFilePaths } from './ProjectLogWritable';
14
+ /**
15
+ * @internal
16
+ */
14
17
  export interface IOperationExecutionRecordContext {
15
18
  streamCollator: StreamCollator;
16
19
  onOperationStatusChanged?: (record: OperationExecutionRecord) => void;
@@ -1,6 +1,7 @@
1
1
  import { type ITerminalChunk, type ITerminal, type ITerminalProvider } from '@rushstack/terminal';
2
2
  import { OperationStateFile } from './OperationStateFile';
3
3
  import type { Operation } from './Operation';
4
+ import { type IStopwatchResult } from '../../utilities/Stopwatch';
4
5
  /**
5
6
  * @internal
6
7
  */
@@ -33,6 +34,7 @@ export declare class OperationMetadataManager {
33
34
  private readonly _logPath;
34
35
  private readonly _errorLogPath;
35
36
  private readonly _logChunksPath;
37
+ wasCobuilt: boolean;
36
38
  constructor(options: IOperationMetadataManagerOptions);
37
39
  /**
38
40
  * Returns the relative paths of the metadata files to project folder.
@@ -43,10 +45,13 @@ export declare class OperationMetadataManager {
43
45
  */
44
46
  get metadataFolderPath(): string;
45
47
  saveAsync({ durationInSeconds, cobuildContextId, cobuildRunnerId, logPath, errorLogPath, logChunksPath }: IOperationMetaData): Promise<void>;
46
- tryRestoreAsync({ terminal, terminalProvider, errorLogPath }: {
48
+ tryRestoreAsync({ terminal, terminalProvider, errorLogPath, cobuildContextId, cobuildRunnerId }: {
47
49
  terminalProvider: ITerminalProvider;
48
50
  terminal: ITerminal;
49
51
  errorLogPath: string;
52
+ cobuildContextId?: string;
53
+ cobuildRunnerId?: string;
50
54
  }): Promise<void>;
55
+ tryRestoreStopwatch(originalStopwatch: IStopwatchResult): IStopwatchResult;
51
56
  }
52
57
  //# sourceMappingURL=OperationMetadataManager.d.ts.map
@@ -37,6 +37,10 @@ export declare class Stopwatch implements IStopwatchResult {
37
37
  private _state;
38
38
  private _getTime;
39
39
  constructor(getTime?: () => number);
40
+ static fromState({ startTime, endTime }: {
41
+ startTime: number;
42
+ endTime: number;
43
+ }): Stopwatch;
40
44
  /**
41
45
  * Static helper function which creates a stopwatch which is immediately started
42
46
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/rush-sdk",
3
- "version": "5.153.1",
3
+ "version": "5.154.0",
4
4
  "description": "An API for interacting with the Rush engine",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,22 +36,22 @@
36
36
  "dependencies": {
37
37
  "@pnpm/lockfile.types": "~1.0.3",
38
38
  "tapable": "2.2.1",
39
- "@rushstack/lookup-by-path": "0.5.21",
40
- "@rushstack/node-core-library": "5.13.0",
41
- "@rushstack/package-deps-hash": "4.3.22",
42
- "@rushstack/terminal": "0.15.2"
39
+ "@rushstack/node-core-library": "5.13.1",
40
+ "@rushstack/lookup-by-path": "0.7.0",
41
+ "@rushstack/package-deps-hash": "4.4.1",
42
+ "@rushstack/terminal": "0.15.3"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/semver": "7.5.0",
46
46
  "@types/webpack-env": "1.18.8",
47
47
  "webpack": "~5.98.0",
48
- "@microsoft/rush-lib": "5.153.1",
49
- "@rushstack/heft": "0.73.3",
50
- "@rushstack/heft-webpack5-plugin": "0.11.30",
48
+ "@microsoft/rush-lib": "5.154.0",
49
+ "@rushstack/heft": "0.73.6",
50
+ "@rushstack/heft-webpack5-plugin": "0.11.33",
51
51
  "local-node-rig": "1.0.0",
52
- "@rushstack/ts-command-line": "5.0.0",
53
- "@rushstack/webpack-preserve-dynamic-require-plugin": "0.11.99",
54
- "@rushstack/stream-collator": "4.1.100"
52
+ "@rushstack/ts-command-line": "5.0.1",
53
+ "@rushstack/webpack-preserve-dynamic-require-plugin": "0.11.102",
54
+ "@rushstack/stream-collator": "4.1.103"
55
55
  },
56
56
  "scripts": {
57
57
  "build": "heft build --clean",