@rushstack/rush-sdk 5.112.0 → 5.112.2-pr4476.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.
@@ -181,11 +181,19 @@ export declare class BuildCacheConfiguration {
181
181
  /**
182
182
  * Type of version bumps
183
183
  * @public
184
+ *
185
+ * @internalRemarks
186
+ * This is a copy of the semver ReleaseType enum, but with the `none` value added and
187
+ * the `premajor` and `prepatch` omitted.
188
+ * See {@link LockStepVersionPolicy._getReleaseType}.
189
+ *
190
+ * TODO: Consider supporting `premajor` and `prepatch` in the future.
184
191
  */
185
192
  export declare enum BumpType {
186
193
  'none' = 0,
187
194
  'prerelease' = 1,
188
195
  'patch' = 2,
196
+ 'preminor' = 3,
189
197
  'minor' = 4,
190
198
  'major' = 5
191
199
  }
@@ -1104,6 +1112,10 @@ export declare interface ICreateOperationsContext {
1104
1112
  * Maps from the `longName` field in command-line.json to the parser configuration in ts-command-line.
1105
1113
  */
1106
1114
  readonly customParameters: ReadonlyMap<string, CommandLineParameter>;
1115
+ /**
1116
+ * The current state of the repository, if available
1117
+ */
1118
+ readonly inputSnapshot?: IInputSnapshot;
1107
1119
  /**
1108
1120
  * If true, projects may read their output from cache or be skipped if already up to date.
1109
1121
  * If false, neither of the above may occur, e.g. "rush rebuild"
@@ -1126,10 +1138,6 @@ export declare interface ICreateOperationsContext {
1126
1138
  * The set of phases selected for the current command execution.
1127
1139
  */
1128
1140
  readonly phaseSelection: ReadonlySet<IPhase>;
1129
- /**
1130
- * The current state of the repository
1131
- */
1132
- readonly projectChangeAnalyzer: ProjectChangeAnalyzer;
1133
1141
  /**
1134
1142
  * The set of Rush projects selected for the current command execution.
1135
1143
  */
@@ -1272,12 +1280,12 @@ export declare interface IExecutionResult {
1272
1280
  export declare interface IExperimentsJson {
1273
1281
  /**
1274
1282
  * By default, 'rush install' passes --no-prefer-frozen-lockfile to 'pnpm install'.
1275
- * Set this option to true to pass '--frozen-lockfile' instead.
1283
+ * Set this option to true to pass '--frozen-lockfile' instead for faster installs.
1276
1284
  */
1277
1285
  usePnpmFrozenLockfileForRushInstall?: boolean;
1278
1286
  /**
1279
1287
  * By default, 'rush update' passes --no-prefer-frozen-lockfile to 'pnpm install'.
1280
- * Set this option to true to pass '--prefer-frozen-lockfile' instead.
1288
+ * Set this option to true to pass '--prefer-frozen-lockfile' instead to minimize shrinkwrap changes.
1281
1289
  */
1282
1290
  usePnpmPreferFrozenLockfileForRushUpdate?: boolean;
1283
1291
  /**
@@ -1391,6 +1399,32 @@ declare interface IIndividualVersionJson extends IVersionPolicyJson {
1391
1399
  lockedMajor?: number;
1392
1400
  }
1393
1401
 
1402
+ /**
1403
+ * Represents a synchronously-queryable in-memory snapshot of the state of the inputs to a Rush repository.
1404
+ *
1405
+ * The methods on this interface are idempotent and will return the same result regardless of when they are executed.
1406
+ * @beta
1407
+ */
1408
+ export declare interface IInputSnapshot {
1409
+ /**
1410
+ * Gets the map of file paths to Git hashes that will be used to compute the local state hash of the operation.
1411
+ * Exposed separately from the final state hash to facilitate detailed change detection.
1412
+ *
1413
+ * @param project - The Rush project to get hashes for
1414
+ * @param operationName - The name of the operation (phase) to get hashes for. If omitted, returns a default set for the project, as used for bulk commands.
1415
+ * @returns A map of file name to Git hash. For local files paths will be relative. Configured additional files may be absolute paths.
1416
+ */
1417
+ getTrackedFileHashesForOperation(project: IRushConfigurationProjectForSnapshot, operationName?: string): ReadonlyMap<string, string>;
1418
+ /**
1419
+ * Gets the local state hash for the operation. This will later be combined with the hash of the command being executed and the final hashes of the operation's dependencies to compute
1420
+ * the final hash for the operation.
1421
+ * @param project - The Rush project to compute the state hash for
1422
+ * @param operationName - The name of the operation (phase) to get hashes for. If omitted, returns a generic hash for the whole project, as used for bulk commands.
1423
+ * @returns The local state hash for the project. This is a hash of the environment, the project's tracked files, and any additional files.
1424
+ */
1425
+ getLocalStateHashForOperation(project: IRushConfigurationProjectForSnapshot, operationName?: string): string;
1426
+ }
1427
+
1394
1428
  /**
1395
1429
  * Options to pass to the rush "launch" functions.
1396
1430
  *
@@ -1925,12 +1959,54 @@ export declare interface IPrefixMatch<TItem> {
1925
1959
  }
1926
1960
 
1927
1961
  /**
1928
- * @internal
1962
+ * The readonly component of `LookupByPath`, to simplify unit testing.
1963
+ *
1964
+ * @beta
1929
1965
  */
1930
- export declare interface _IRawRepoState {
1931
- projectState: Map<RushConfigurationProject, Map<string, string>> | undefined;
1932
- rootDir: string;
1933
- rawHashes: Map<string, string>;
1966
+ export declare interface IReadonlyLookupByPath<TItem> {
1967
+ /**
1968
+ * Searches for the item associated with `childPath`, or the nearest ancestor of that path that
1969
+ * has an associated item.
1970
+ *
1971
+ * @returns the found item, or `undefined` if no item was found
1972
+ *
1973
+ * @example
1974
+ * ```ts
1975
+ * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
1976
+ * tree.findChildPath('foo/baz'); // returns 1
1977
+ * tree.findChildPath('foo/bar/baz'); // returns 2
1978
+ * ```
1979
+ */
1980
+ findChildPath(childPath: string): TItem | undefined;
1981
+ /**
1982
+ * Searches for the item for which the recorded prefix is the longest matching prefix of `query`.
1983
+ * Obtains both the item and the length of the matched prefix, so that the remainder of the path can be
1984
+ * extracted.
1985
+ *
1986
+ * @returns the found item and the length of the matched prefix, or `undefined` if no item was found
1987
+ *
1988
+ * @example
1989
+ * ```ts
1990
+ * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
1991
+ * tree.findLongestPrefixMatch('foo/baz'); // returns { item: 1, index: 3 }
1992
+ * tree.findLongestPrefixMatch('foo/bar/baz'); // returns { item: 2, index: 7 }
1993
+ * ```
1994
+ */
1995
+ findLongestPrefixMatch(query: string): IPrefixMatch<TItem> | undefined;
1996
+ /**
1997
+ * Searches for the item associated with `childPathSegments`, or the nearest ancestor of that path that
1998
+ * has an associated item.
1999
+ *
2000
+ * @returns the found item, or `undefined` if no item was found
2001
+ *
2002
+ * @example
2003
+ * ```ts
2004
+ * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
2005
+ * tree.findChildPathFromSegments(['foo', 'baz']); // returns 1
2006
+ * tree.findChildPathFromSegments(['foo','bar', 'baz']); // returns 2
2007
+ * ```
2008
+ */
2009
+ findChildPathFromSegments(childPathSegments: Iterable<string>): TItem | undefined;
1934
2010
  }
1935
2011
 
1936
2012
  /**
@@ -1975,6 +2051,11 @@ declare interface IRushConfigurationJson {
1975
2051
  variants?: IRushVariantOptionsJson[];
1976
2052
  }
1977
2053
 
2054
+ /**
2055
+ * @beta
2056
+ */
2057
+ export declare type IRushConfigurationProjectForSnapshot = Pick<RushConfigurationProject, 'projectFolder' | 'projectRelativeFolder'>;
2058
+
1978
2059
  /**
1979
2060
  * This represents the JSON data object for a project entry in the rush.json configuration file.
1980
2061
  */
@@ -1989,6 +2070,7 @@ declare interface IRushConfigurationProjectJson {
1989
2070
  skipRushCheck?: boolean;
1990
2071
  publishFolder?: string;
1991
2072
  tags?: string[];
2073
+ subspaceName?: string;
1992
2074
  }
1993
2075
 
1994
2076
  /**
@@ -2421,7 +2503,7 @@ export declare class LockStepVersionPolicy extends VersionPolicy {
2421
2503
  * ```
2422
2504
  * @beta
2423
2505
  */
2424
- export declare class LookupByPath<TItem> {
2506
+ export declare class LookupByPath<TItem> implements IReadonlyLookupByPath<TItem> {
2425
2507
  /**
2426
2508
  * The delimiter used to split paths
2427
2509
  */
@@ -2462,46 +2544,15 @@ export declare class LookupByPath<TItem> {
2462
2544
  */
2463
2545
  setItemFromSegments(pathSegments: Iterable<string>, value: TItem): this;
2464
2546
  /**
2465
- * Searches for the item associated with `childPath`, or the nearest ancestor of that path that
2466
- * has an associated item.
2467
- *
2468
- * @returns the found item, or `undefined` if no item was found
2469
- *
2470
- * @example
2471
- * ```ts
2472
- * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
2473
- * tree.findChildPath('foo/baz'); // returns 1
2474
- * tree.findChildPath('foo/bar/baz'); // returns 2
2475
- * ```
2547
+ * {@inheritdoc IReadonlyLookupByPath}
2476
2548
  */
2477
2549
  findChildPath(childPath: string): TItem | undefined;
2478
2550
  /**
2479
- * Searches for the item for which the recorded prefix is the longest matching prefix of `query`.
2480
- * Obtains both the item and the length of the matched prefix, so that the remainder of the path can be
2481
- * extracted.
2482
- *
2483
- * @returns the found item and the length of the matched prefix, or `undefined` if no item was found
2484
- *
2485
- * @example
2486
- * ```ts
2487
- * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
2488
- * tree.findLongestPrefixMatch('foo/baz'); // returns { item: 1, index: 3 }
2489
- * tree.findLongestPrefixMatch('foo/bar/baz'); // returns { item: 2, index: 7 }
2490
- * ```
2551
+ * {@inheritdoc IReadonlyLookupByPath}
2491
2552
  */
2492
2553
  findLongestPrefixMatch(query: string): IPrefixMatch<TItem> | undefined;
2493
2554
  /**
2494
- * Searches for the item associated with `childPathSegments`, or the nearest ancestor of that path that
2495
- * has an associated item.
2496
- *
2497
- * @returns the found item, or `undefined` if no item was found
2498
- *
2499
- * @example
2500
- * ```ts
2501
- * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
2502
- * tree.findChildPathFromSegments(['foo', 'baz']); // returns 1
2503
- * tree.findChildPathFromSegments(['foo','bar', 'baz']); // returns 2
2504
- * ```
2555
+ * {@inheritdoc IReadonlyLookupByPath}
2505
2556
  */
2506
2557
  findChildPathFromSegments(childPathSegments: Iterable<string>): TItem | undefined;
2507
2558
  /**
@@ -3089,52 +3140,29 @@ export declare type PnpmStoreOptions = PnpmStoreLocation;
3089
3140
  * @beta
3090
3141
  */
3091
3142
  export declare class ProjectChangeAnalyzer {
3092
- /**
3093
- * UNINITIALIZED === we haven't looked
3094
- * undefined === data isn't available (i.e. - git isn't present)
3095
- */
3096
- private _data;
3097
- private readonly _filteredData;
3098
- private readonly _projectStateCache;
3099
3143
  private readonly _rushConfiguration;
3100
3144
  private readonly _git;
3145
+ private _snapshotPrerequisitesPromise;
3101
3146
  constructor(rushConfiguration: RushConfiguration);
3102
3147
  /**
3103
- * Try to get a list of the specified project's dependencies and their hashes.
3104
- *
3105
- * @remarks
3106
- * If the data can't be generated (i.e. - if Git is not present) this returns undefined.
3107
- *
3108
- * @internal
3148
+ * Gets a list of projects that have changed in the current state of the repo
3149
+ * when compared to the specified branch, optionally taking the shrinkwrap and settings in
3150
+ * the rush-project.json file into consideration.
3109
3151
  */
3110
- _tryGetProjectDependenciesAsync(project: RushConfigurationProject, terminal: ITerminal): Promise<Map<string, string> | undefined>;
3152
+ getChangedProjectsAsync(options: IGetChangedProjectsOptions): Promise<Set<RushConfigurationProject>>;
3111
3153
  /**
3154
+ * Gets a snapshot of the input state of the Rush workspace that can be queried for incremental
3155
+ * build operations and use by the build cache.
3112
3156
  * @internal
3113
3157
  */
3114
- _ensureInitializedAsync(terminal: ITerminal): Promise<_IRawRepoState | undefined>;
3158
+ _tryGetSnapshotAsync(terminal: ITerminal): Promise<IInputSnapshot | undefined>;
3115
3159
  /**
3116
- * The project state hash is calculated in the following way:
3117
- * - Project dependencies are collected (see ProjectChangeAnalyzer.getPackageDeps)
3118
- * - If project dependencies cannot be collected (i.e. - if Git isn't available),
3119
- * this function returns `undefined`
3120
- * - The (path separator normalized) repo-root-relative dependencies' file paths are sorted
3121
- * - A SHA1 hash is created and each (sorted) file path is fed into the hash and then its
3122
- * Git SHA is fed into the hash
3123
- * - A hex digest of the hash is returned
3124
- *
3125
3160
  * @internal
3126
3161
  */
3127
- _tryGetProjectStateHashAsync(project: RushConfigurationProject, terminal: ITerminal): Promise<string | undefined>;
3128
3162
  _filterProjectDataAsync<T>(project: RushConfigurationProject, unfilteredProjectData: Map<string, T>, rootDir: string, terminal: ITerminal): Promise<Map<string, T>>;
3129
- /**
3130
- * Gets a list of projects that have changed in the current state of the repo
3131
- * when compared to the specified branch, optionally taking the shrinkwrap and settings in
3132
- * the rush-project.json file into consideration.
3133
- */
3134
- getChangedProjectsAsync(options: IGetChangedProjectsOptions): Promise<Set<RushConfigurationProject>>;
3135
- private _getDataAsync;
3136
3163
  private _getIgnoreMatcherForProjectAsync;
3137
- private _getRepoDepsAsync;
3164
+ private _computeSnapshotPrerequisites;
3165
+ private _computeSnapshotPrerequisitesInner;
3138
3166
  }
3139
3167
 
3140
3168
  /**
@@ -3264,6 +3292,7 @@ export declare class RushConfiguration {
3264
3292
  private _projects;
3265
3293
  private _projectsByName;
3266
3294
  private _projectsByTag;
3295
+ private _rushProjectsBySubspaceName;
3267
3296
  private _commonVersionsConfigurationsByVariant;
3268
3297
  /**
3269
3298
  * The name of the package manager being used to install dependencies
@@ -3372,6 +3401,11 @@ export declare class RushConfiguration {
3372
3401
  * or `C:\MyRepo\common\temp\pnpm-lock-preinstall.yaml`
3373
3402
  */
3374
3403
  readonly tempShrinkwrapPreinstallFilename: string;
3404
+ /**
3405
+ * The object that specifies subspace configurations if they are provided in the rush workspace.
3406
+ * @beta
3407
+ */
3408
+ readonly subspaceConfiguration?: SubspaceConfiguration;
3375
3409
  /**
3376
3410
  * The filename of the variant dependency data file. By default this is
3377
3411
  * called 'current-variant.json' resides in the Rush common folder.
@@ -3610,6 +3644,25 @@ export declare class RushConfiguration {
3610
3644
  * shrinkwrap file name for a given active variant.
3611
3645
  */
3612
3646
  get committedShrinkwrapFilename(): string;
3647
+ /**
3648
+ * Returns full path of the temporary shrinkwrap file for a specific subspace.
3649
+ * @remarks
3650
+ * This function takes the subspace name, and returns the full path for the subspace's shrinkwrap file.
3651
+ * This function also consults the deprecated option to allow for shrinkwraps to be stored under a package folder.
3652
+ * This shrinkwrap file is used during "rush install", and may be rewritten by the package manager during installation
3653
+ * This property merely reports the filename, the file itself may not actually exist.
3654
+ * example: `C:\MyRepo\common\<subspace_name>\pnpm-lock.yaml`
3655
+ * @beta
3656
+ */
3657
+ getTempSubspaceShrinkwrapFileName(subspaceName: string): string;
3658
+ /**
3659
+ * The filename (without any path) of the shrinkwrap file used for individual subspaces, used by the package manager.
3660
+ * @remarks
3661
+ * This property merely reports the filename; The file itself may not actually exist.
3662
+ * Example: From "pnpm-lock.yaml" to "subspace-pnpm-lock.yaml"
3663
+ * @beta
3664
+ */
3665
+ subspaceShrinkwrapFilenames(subspaceName: string): string;
3613
3666
  /**
3614
3667
  * Returns an English phrase such as "shrinkwrap file" that can be used in logging messages
3615
3668
  * to refer to the shrinkwrap file using appropriate terminology for the currently selected
@@ -3632,6 +3685,14 @@ export declare class RushConfiguration {
3632
3685
  */
3633
3686
  get repositoryDefaultFullyQualifiedRemoteBranch(): string;
3634
3687
  get projects(): RushConfigurationProject[];
3688
+ /**
3689
+ * A list of all the available subspaces in this workspace.
3690
+ * @beta
3691
+ */
3692
+ get subspaceNames(): Iterable<string>;
3693
+ /**
3694
+ * @beta
3695
+ */
3635
3696
  get projectsByName(): Map<string, RushConfigurationProject>;
3636
3697
  /**
3637
3698
  * Obtains the mapping from custom tags to projects.
@@ -3661,6 +3722,12 @@ export declare class RushConfiguration {
3661
3722
  * @param variant - The name of the current variant in use by the active command.
3662
3723
  */
3663
3724
  getCommonVersionsFilePath(variant?: string | undefined): string;
3725
+ /**
3726
+ * Returns `true` if the subspaces feature is enabled and at least one subspaces is defined
3727
+ * in the `subspaces.json` config file.
3728
+ * @beta
3729
+ */
3730
+ get hasSubspaces(): boolean;
3664
3731
  /**
3665
3732
  * Gets the settings from the common-versions.json config file for a specific variant.
3666
3733
  * @param variant - The name of the current variant in use by the active command.
@@ -3838,6 +3905,18 @@ export declare class RushConfigurationProject {
3838
3905
  * @beta
3839
3906
  */
3840
3907
  readonly tags: ReadonlySet<string>;
3908
+ /**
3909
+ * Returns the name of the subspace that this project belongs to, as assigned by the `"subspaceName"`
3910
+ * property in `rush.json`.
3911
+ *
3912
+ * @remarks
3913
+ * If the Rush subspaces feature is disabled, the value is still return.
3914
+ * When the Rush subspaces feature is enabled, an undefined `subspaceName` specifies that
3915
+ * the project belongs to the default subspace (whose name is `"default"`).
3916
+ *
3917
+ * @beta
3918
+ */
3919
+ readonly subspaceName: string | undefined;
3841
3920
  /** @internal */
3842
3921
  constructor(options: IRushConfigurationProjectOptions);
3843
3922
  /**
@@ -4049,6 +4128,10 @@ export declare class RushConstants {
4049
4128
  * The artifactory.json configuration file name.
4050
4129
  */
4051
4130
  static readonly artifactoryFilename: string;
4131
+ /**
4132
+ * The subspaces.json configuration file name
4133
+ */
4134
+ static readonly subspacesConfigFilename: string;
4052
4135
  /**
4053
4136
  * Build cache configuration file.
4054
4137
  */
@@ -4313,6 +4396,26 @@ export declare class RushUserConfiguration {
4313
4396
  static getRushUserFolderPath(): string;
4314
4397
  }
4315
4398
 
4399
+ /**
4400
+ * This represents the subspace configurations for a repository, based on the "subspaces.json"
4401
+ * configuration file.
4402
+ * @beta
4403
+ */
4404
+ export declare class SubspaceConfiguration {
4405
+ private static _jsonSchema;
4406
+ /**
4407
+ * The absolute path to the "subspaces.json" configuration file that was loaded to construct this object.
4408
+ */
4409
+ readonly subspaceJsonFilePath: string;
4410
+ /**
4411
+ * A set of the available subspaces
4412
+ */
4413
+ readonly subspaceNames: Set<string>;
4414
+ private constructor();
4415
+ static tryLoadFromConfigurationFile(subspaceJsonFilePath: string): SubspaceConfiguration | undefined;
4416
+ static tryLoadFromDefaultLocation(rushConfiguration: RushConfiguration): SubspaceConfiguration | undefined;
4417
+ }
4418
+
4316
4419
  declare enum VersionFormatForCommit {
4317
4420
  wildcard = "wildcard",
4318
4421
  original = "original"
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.38.3"
8
+ "packageVersion": "7.39.1"
9
9
  }
10
10
  ]
11
11
  }
@@ -6,12 +6,12 @@
6
6
  export interface IExperimentsJson {
7
7
  /**
8
8
  * By default, 'rush install' passes --no-prefer-frozen-lockfile to 'pnpm install'.
9
- * Set this option to true to pass '--frozen-lockfile' instead.
9
+ * Set this option to true to pass '--frozen-lockfile' instead for faster installs.
10
10
  */
11
11
  usePnpmFrozenLockfileForRushInstall?: boolean;
12
12
  /**
13
13
  * By default, 'rush update' passes --no-prefer-frozen-lockfile to 'pnpm install'.
14
- * Set this option to true to pass '--prefer-frozen-lockfile' instead.
14
+ * Set this option to true to pass '--prefer-frozen-lockfile' instead to minimize shrinkwrap changes.
15
15
  */
16
16
  usePnpmPreferFrozenLockfileForRushUpdate?: boolean;
17
17
  /**
@@ -14,6 +14,7 @@ import { type INpmOptionsJson, NpmOptionsConfiguration } from '../logic/npm/NpmO
14
14
  import { type IYarnOptionsJson, YarnOptionsConfiguration } from '../logic/yarn/YarnOptionsConfiguration';
15
15
  import type { PackageManagerOptionsConfigurationBase } from '../logic/base/BasePackageManagerOptionsConfiguration';
16
16
  import { CustomTipsConfiguration } from './CustomTipsConfiguration';
17
+ import { SubspaceConfiguration } from './SubspaceConfiguration';
17
18
  /**
18
19
  * Part of IRushConfigurationJson.
19
20
  */
@@ -118,6 +119,15 @@ export interface IRushConfigurationJson {
118
119
  export interface ICurrentVariantJson {
119
120
  variant: string | JsonNull;
120
121
  }
122
+ /**
123
+ * The filter parameters to search from all projects
124
+ */
125
+ export interface IRushConfigurationProjectsFilter {
126
+ /**
127
+ * A string representation of the subspace to filter for
128
+ */
129
+ subspace: string;
130
+ }
121
131
  /**
122
132
  * Options for `RushConfiguration.tryFindRushJsonLocation`.
123
133
  * @public
@@ -144,6 +154,7 @@ export declare class RushConfiguration {
144
154
  private _projects;
145
155
  private _projectsByName;
146
156
  private _projectsByTag;
157
+ private _rushProjectsBySubspaceName;
147
158
  private _commonVersionsConfigurationsByVariant;
148
159
  /**
149
160
  * The name of the package manager being used to install dependencies
@@ -252,6 +263,11 @@ export declare class RushConfiguration {
252
263
  * or `C:\MyRepo\common\temp\pnpm-lock-preinstall.yaml`
253
264
  */
254
265
  readonly tempShrinkwrapPreinstallFilename: string;
266
+ /**
267
+ * The object that specifies subspace configurations if they are provided in the rush workspace.
268
+ * @beta
269
+ */
270
+ readonly subspaceConfiguration?: SubspaceConfiguration;
255
271
  /**
256
272
  * The filename of the variant dependency data file. By default this is
257
273
  * called 'current-variant.json' resides in the Rush common folder.
@@ -490,6 +506,25 @@ export declare class RushConfiguration {
490
506
  * shrinkwrap file name for a given active variant.
491
507
  */
492
508
  get committedShrinkwrapFilename(): string;
509
+ /**
510
+ * Returns full path of the temporary shrinkwrap file for a specific subspace.
511
+ * @remarks
512
+ * This function takes the subspace name, and returns the full path for the subspace's shrinkwrap file.
513
+ * This function also consults the deprecated option to allow for shrinkwraps to be stored under a package folder.
514
+ * This shrinkwrap file is used during "rush install", and may be rewritten by the package manager during installation
515
+ * This property merely reports the filename, the file itself may not actually exist.
516
+ * example: `C:\MyRepo\common\<subspace_name>\pnpm-lock.yaml`
517
+ * @beta
518
+ */
519
+ getTempSubspaceShrinkwrapFileName(subspaceName: string): string;
520
+ /**
521
+ * The filename (without any path) of the shrinkwrap file used for individual subspaces, used by the package manager.
522
+ * @remarks
523
+ * This property merely reports the filename; The file itself may not actually exist.
524
+ * Example: From "pnpm-lock.yaml" to "subspace-pnpm-lock.yaml"
525
+ * @beta
526
+ */
527
+ subspaceShrinkwrapFilenames(subspaceName: string): string;
493
528
  /**
494
529
  * Returns an English phrase such as "shrinkwrap file" that can be used in logging messages
495
530
  * to refer to the shrinkwrap file using appropriate terminology for the currently selected
@@ -512,6 +547,14 @@ export declare class RushConfiguration {
512
547
  */
513
548
  get repositoryDefaultFullyQualifiedRemoteBranch(): string;
514
549
  get projects(): RushConfigurationProject[];
550
+ /**
551
+ * A list of all the available subspaces in this workspace.
552
+ * @beta
553
+ */
554
+ get subspaceNames(): Iterable<string>;
555
+ /**
556
+ * @beta
557
+ */
515
558
  get projectsByName(): Map<string, RushConfigurationProject>;
516
559
  /**
517
560
  * Obtains the mapping from custom tags to projects.
@@ -541,6 +584,12 @@ export declare class RushConfiguration {
541
584
  * @param variant - The name of the current variant in use by the active command.
542
585
  */
543
586
  getCommonVersionsFilePath(variant?: string | undefined): string;
587
+ /**
588
+ * Returns `true` if the subspaces feature is enabled and at least one subspaces is defined
589
+ * in the `subspaces.json` config file.
590
+ * @beta
591
+ */
592
+ get hasSubspaces(): boolean;
544
593
  /**
545
594
  * Gets the settings from the common-versions.json config file for a specific variant.
546
595
  * @param variant - The name of the current variant in use by the active command.
@@ -16,6 +16,7 @@ export interface IRushConfigurationProjectJson {
16
16
  skipRushCheck?: boolean;
17
17
  publishFolder?: string;
18
18
  tags?: string[];
19
+ subspaceName?: string;
19
20
  }
20
21
  /**
21
22
  * @internal
@@ -151,6 +152,18 @@ export declare class RushConfigurationProject {
151
152
  * @beta
152
153
  */
153
154
  readonly tags: ReadonlySet<string>;
155
+ /**
156
+ * Returns the name of the subspace that this project belongs to, as assigned by the `"subspaceName"`
157
+ * property in `rush.json`.
158
+ *
159
+ * @remarks
160
+ * If the Rush subspaces feature is disabled, the value is still return.
161
+ * When the Rush subspaces feature is enabled, an undefined `subspaceName` specifies that
162
+ * the project belongs to the default subspace (whose name is `"default"`).
163
+ *
164
+ * @beta
165
+ */
166
+ readonly subspaceName: string | undefined;
154
167
  /** @internal */
155
168
  constructor(options: IRushConfigurationProjectOptions);
156
169
  /**
@@ -0,0 +1,26 @@
1
+ import type { RushConfiguration } from './RushConfiguration';
2
+ /**
3
+ * The allowed naming convention for subspace names.
4
+ * Allows for names to be formed of letters, numbers, and hyphens (-)
5
+ */
6
+ export declare const SUBSPACE_NAME_REGEXP: RegExp;
7
+ /**
8
+ * This represents the subspace configurations for a repository, based on the "subspaces.json"
9
+ * configuration file.
10
+ * @beta
11
+ */
12
+ export declare class SubspaceConfiguration {
13
+ private static _jsonSchema;
14
+ /**
15
+ * The absolute path to the "subspaces.json" configuration file that was loaded to construct this object.
16
+ */
17
+ readonly subspaceJsonFilePath: string;
18
+ /**
19
+ * A set of the available subspaces
20
+ */
21
+ readonly subspaceNames: Set<string>;
22
+ private constructor();
23
+ static tryLoadFromConfigurationFile(subspaceJsonFilePath: string): SubspaceConfiguration | undefined;
24
+ static tryLoadFromDefaultLocation(rushConfiguration: RushConfiguration): SubspaceConfiguration | undefined;
25
+ }
26
+ //# sourceMappingURL=SubspaceConfiguration.d.ts.map
@@ -0,0 +1 @@
1
+ module.exports = require("../../lib-shim/index")._rushSdk_loadInternalModule("api/SubspaceConfiguration");
@@ -4,11 +4,19 @@ import type { RushConfiguration } from './RushConfiguration';
4
4
  /**
5
5
  * Type of version bumps
6
6
  * @public
7
+ *
8
+ * @internalRemarks
9
+ * This is a copy of the semver ReleaseType enum, but with the `none` value added and
10
+ * the `premajor` and `prepatch` omitted.
11
+ * See {@link LockStepVersionPolicy._getReleaseType}.
12
+ *
13
+ * TODO: Consider supporting `premajor` and `prepatch` in the future.
7
14
  */
8
15
  export declare enum BumpType {
9
16
  'none' = 0,
10
17
  'prerelease' = 1,
11
18
  'patch' = 2,
19
+ 'preminor' = 3,
12
20
  'minor' = 4,
13
21
  'major' = 5
14
22
  }
@@ -3,6 +3,7 @@ import { BaseConfiglessRushAction } from './BaseRushAction';
3
3
  export declare class InitAction extends BaseConfiglessRushAction {
4
4
  private readonly _overwriteParameter;
5
5
  private readonly _rushExampleParameter;
6
+ private readonly _experimentsParameter;
6
7
  private _commentedBySectionName;
7
8
  constructor(parser: RushCommandLineParser);
8
9
  protected runAsync(): Promise<void>;
package/lib/index.d.ts CHANGED
@@ -4,6 +4,7 @@
4
4
  */
5
5
  export { ApprovedPackagesPolicy } from './api/ApprovedPackagesPolicy';
6
6
  export { RushConfiguration, ITryFindRushJsonLocationOptions } from './api/RushConfiguration';
7
+ export { SubspaceConfiguration } from './api/SubspaceConfiguration';
7
8
  export { IPackageManagerOptionsJsonBase, IConfigurationEnvironment, IConfigurationEnvironmentVariable, PackageManagerOptionsConfigurationBase } from './logic/base/BasePackageManagerOptionsConfiguration';
8
9
  export { INpmOptionsJson as _INpmOptionsJson, NpmOptionsConfiguration } from './logic/npm/NpmOptionsConfiguration';
9
10
  export { IYarnOptionsJson as _IYarnOptionsJson, YarnOptionsConfiguration } from './logic/yarn/YarnOptionsConfiguration';
@@ -24,7 +25,7 @@ export { ApprovedPackagesItem, ApprovedPackagesConfiguration } from './api/Appro
24
25
  export { CommonVersionsConfiguration } from './api/CommonVersionsConfiguration';
25
26
  export { PackageJsonEditor, PackageJsonDependency, DependencyType } from './api/PackageJsonEditor';
26
27
  export { RepoStateFile } from './logic/RepoStateFile';
27
- export { LookupByPath, IPrefixMatch } from './logic/LookupByPath';
28
+ export { LookupByPath, IPrefixMatch, IReadonlyLookupByPath } from './logic/LookupByPath';
28
29
  export { EventHooks, Event } from './api/EventHooks';
29
30
  export { ChangeManager } from './api/ChangeManager';
30
31
  export { LastInstallFlag as _LastInstallFlag, ILockfileValidityCheckOptions as _ILockfileValidityCheckOptions } from './api/LastInstallFlag';
@@ -34,7 +35,8 @@ export { ILaunchOptions, Rush } from './api/Rush';
34
35
  export { RushInternals as _RushInternals } from './api/RushInternals';
35
36
  export { ExperimentsConfiguration, IExperimentsJson } from './api/ExperimentsConfiguration';
36
37
  export { CustomTipsConfiguration, CustomTipId, ICustomTipsJson, ICustomTipInfo, ICustomTipItemJson, CustomTipSeverity, CustomTipType } from './api/CustomTipsConfiguration';
37
- export { ProjectChangeAnalyzer, IGetChangedProjectsOptions, IRawRepoState as _IRawRepoState } from './logic/ProjectChangeAnalyzer';
38
+ export { ProjectChangeAnalyzer, IGetChangedProjectsOptions } from './logic/ProjectChangeAnalyzer';
39
+ export { IInputSnapshot, IRushConfigurationProjectForSnapshot } from './logic/snapshots/InputSnapshot';
38
40
  export { IOperationRunner, IOperationRunnerContext } from './logic/operations/IOperationRunner';
39
41
  export { IExecutionResult, IOperationExecutionResult } from './logic/operations/IOperationExecutionResult';
40
42
  export { IOperationOptions, Operation } from './logic/operations/Operation';
@@ -7,6 +7,56 @@ export interface IPrefixMatch<TItem> {
7
7
  value: TItem;
8
8
  index: number;
9
9
  }
10
+ /**
11
+ * The readonly component of `LookupByPath`, to simplify unit testing.
12
+ *
13
+ * @beta
14
+ */
15
+ export interface IReadonlyLookupByPath<TItem> {
16
+ /**
17
+ * Searches for the item associated with `childPath`, or the nearest ancestor of that path that
18
+ * has an associated item.
19
+ *
20
+ * @returns the found item, or `undefined` if no item was found
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
25
+ * tree.findChildPath('foo/baz'); // returns 1
26
+ * tree.findChildPath('foo/bar/baz'); // returns 2
27
+ * ```
28
+ */
29
+ findChildPath(childPath: string): TItem | undefined;
30
+ /**
31
+ * Searches for the item for which the recorded prefix is the longest matching prefix of `query`.
32
+ * Obtains both the item and the length of the matched prefix, so that the remainder of the path can be
33
+ * extracted.
34
+ *
35
+ * @returns the found item and the length of the matched prefix, or `undefined` if no item was found
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
40
+ * tree.findLongestPrefixMatch('foo/baz'); // returns { item: 1, index: 3 }
41
+ * tree.findLongestPrefixMatch('foo/bar/baz'); // returns { item: 2, index: 7 }
42
+ * ```
43
+ */
44
+ findLongestPrefixMatch(query: string): IPrefixMatch<TItem> | undefined;
45
+ /**
46
+ * Searches for the item associated with `childPathSegments`, or the nearest ancestor of that path that
47
+ * has an associated item.
48
+ *
49
+ * @returns the found item, or `undefined` if no item was found
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
54
+ * tree.findChildPathFromSegments(['foo', 'baz']); // returns 1
55
+ * tree.findChildPathFromSegments(['foo','bar', 'baz']); // returns 2
56
+ * ```
57
+ */
58
+ findChildPathFromSegments(childPathSegments: Iterable<string>): TItem | undefined;
59
+ }
10
60
  /**
11
61
  * This class is used to associate POSIX relative paths, such as those returned by `git` commands,
12
62
  * with entities that correspond with ancestor folders, such as Rush Projects.
@@ -24,7 +74,7 @@ export interface IPrefixMatch<TItem> {
24
74
  * ```
25
75
  * @beta
26
76
  */
27
- export declare class LookupByPath<TItem> {
77
+ export declare class LookupByPath<TItem> implements IReadonlyLookupByPath<TItem> {
28
78
  /**
29
79
  * The delimiter used to split paths
30
80
  */
@@ -65,46 +115,15 @@ export declare class LookupByPath<TItem> {
65
115
  */
66
116
  setItemFromSegments(pathSegments: Iterable<string>, value: TItem): this;
67
117
  /**
68
- * Searches for the item associated with `childPath`, or the nearest ancestor of that path that
69
- * has an associated item.
70
- *
71
- * @returns the found item, or `undefined` if no item was found
72
- *
73
- * @example
74
- * ```ts
75
- * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
76
- * tree.findChildPath('foo/baz'); // returns 1
77
- * tree.findChildPath('foo/bar/baz'); // returns 2
78
- * ```
118
+ * {@inheritdoc IReadonlyLookupByPath}
79
119
  */
80
120
  findChildPath(childPath: string): TItem | undefined;
81
121
  /**
82
- * Searches for the item for which the recorded prefix is the longest matching prefix of `query`.
83
- * Obtains both the item and the length of the matched prefix, so that the remainder of the path can be
84
- * extracted.
85
- *
86
- * @returns the found item and the length of the matched prefix, or `undefined` if no item was found
87
- *
88
- * @example
89
- * ```ts
90
- * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
91
- * tree.findLongestPrefixMatch('foo/baz'); // returns { item: 1, index: 3 }
92
- * tree.findLongestPrefixMatch('foo/bar/baz'); // returns { item: 2, index: 7 }
93
- * ```
122
+ * {@inheritdoc IReadonlyLookupByPath}
94
123
  */
95
124
  findLongestPrefixMatch(query: string): IPrefixMatch<TItem> | undefined;
96
125
  /**
97
- * Searches for the item associated with `childPathSegments`, or the nearest ancestor of that path that
98
- * has an associated item.
99
- *
100
- * @returns the found item, or `undefined` if no item was found
101
- *
102
- * @example
103
- * ```ts
104
- * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
105
- * tree.findChildPathFromSegments(['foo', 'baz']); // returns 1
106
- * tree.findChildPathFromSegments(['foo','bar', 'baz']); // returns 2
107
- * ```
126
+ * {@inheritdoc IReadonlyLookupByPath}
108
127
  */
109
128
  findChildPathFromSegments(childPathSegments: Iterable<string>): TItem | undefined;
110
129
  /**
@@ -1,6 +1,7 @@
1
1
  import { type ITerminal } from '@rushstack/node-core-library';
2
2
  import type { RushConfiguration } from '../api/RushConfiguration';
3
3
  import type { RushConfigurationProject } from '../api/RushConfigurationProject';
4
+ import { type IInputSnapshot } from './snapshots/InputSnapshot';
4
5
  /**
5
6
  * @beta
6
7
  */
@@ -31,51 +32,28 @@ export interface IRawRepoState {
31
32
  * @beta
32
33
  */
33
34
  export declare class ProjectChangeAnalyzer {
34
- /**
35
- * UNINITIALIZED === we haven't looked
36
- * undefined === data isn't available (i.e. - git isn't present)
37
- */
38
- private _data;
39
- private readonly _filteredData;
40
- private readonly _projectStateCache;
41
35
  private readonly _rushConfiguration;
42
36
  private readonly _git;
37
+ private _snapshotPrerequisitesPromise;
43
38
  constructor(rushConfiguration: RushConfiguration);
44
39
  /**
45
- * Try to get a list of the specified project's dependencies and their hashes.
46
- *
47
- * @remarks
48
- * If the data can't be generated (i.e. - if Git is not present) this returns undefined.
49
- *
50
- * @internal
40
+ * Gets a list of projects that have changed in the current state of the repo
41
+ * when compared to the specified branch, optionally taking the shrinkwrap and settings in
42
+ * the rush-project.json file into consideration.
51
43
  */
52
- _tryGetProjectDependenciesAsync(project: RushConfigurationProject, terminal: ITerminal): Promise<Map<string, string> | undefined>;
44
+ getChangedProjectsAsync(options: IGetChangedProjectsOptions): Promise<Set<RushConfigurationProject>>;
53
45
  /**
46
+ * Gets a snapshot of the input state of the Rush workspace that can be queried for incremental
47
+ * build operations and use by the build cache.
54
48
  * @internal
55
49
  */
56
- _ensureInitializedAsync(terminal: ITerminal): Promise<IRawRepoState | undefined>;
50
+ _tryGetSnapshotAsync(terminal: ITerminal): Promise<IInputSnapshot | undefined>;
57
51
  /**
58
- * The project state hash is calculated in the following way:
59
- * - Project dependencies are collected (see ProjectChangeAnalyzer.getPackageDeps)
60
- * - If project dependencies cannot be collected (i.e. - if Git isn't available),
61
- * this function returns `undefined`
62
- * - The (path separator normalized) repo-root-relative dependencies' file paths are sorted
63
- * - A SHA1 hash is created and each (sorted) file path is fed into the hash and then its
64
- * Git SHA is fed into the hash
65
- * - A hex digest of the hash is returned
66
- *
67
52
  * @internal
68
53
  */
69
- _tryGetProjectStateHashAsync(project: RushConfigurationProject, terminal: ITerminal): Promise<string | undefined>;
70
54
  _filterProjectDataAsync<T>(project: RushConfigurationProject, unfilteredProjectData: Map<string, T>, rootDir: string, terminal: ITerminal): Promise<Map<string, T>>;
71
- /**
72
- * Gets a list of projects that have changed in the current state of the repo
73
- * when compared to the specified branch, optionally taking the shrinkwrap and settings in
74
- * the rush-project.json file into consideration.
75
- */
76
- getChangedProjectsAsync(options: IGetChangedProjectsOptions): Promise<Set<RushConfigurationProject>>;
77
- private _getDataAsync;
78
55
  private _getIgnoreMatcherForProjectAsync;
79
- private _getRepoDepsAsync;
56
+ private _computeSnapshotPrerequisites;
57
+ private _computeSnapshotPrerequisitesInner;
80
58
  }
81
59
  //# sourceMappingURL=ProjectChangeAnalyzer.d.ts.map
@@ -43,7 +43,6 @@ export declare class PublishUtilities {
43
43
  [key: string]: string;
44
44
  }, dependencyName: string, newProjectVersion: string): string;
45
45
  private static _getReleaseType;
46
- private static _getChangeTypeForSemverReleaseType;
47
46
  private static _getNewRangeDependency;
48
47
  private static _shouldSkipVersionBump;
49
48
  private static _updateCommitDetails;
@@ -145,6 +145,10 @@ export declare class RushConstants {
145
145
  * The artifactory.json configuration file name.
146
146
  */
147
147
  static readonly artifactoryFilename: string;
148
+ /**
149
+ * The subspaces.json configuration file name
150
+ */
151
+ static readonly subspacesConfigFilename: string;
148
152
  /**
149
153
  * Build cache configuration file.
150
154
  */
@@ -1,15 +1,12 @@
1
1
  import { type ITerminal } from '@rushstack/node-core-library';
2
2
  import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
3
- import type { ProjectChangeAnalyzer } from '../ProjectChangeAnalyzer';
4
3
  import type { BuildCacheConfiguration } from '../../api/BuildCacheConfiguration';
5
4
  export interface IProjectBuildCacheOptions {
6
5
  buildCacheConfiguration: BuildCacheConfiguration;
7
6
  project: RushConfigurationProject;
8
7
  projectOutputFolderNames: ReadonlyArray<string>;
9
8
  additionalProjectOutputFilePaths?: ReadonlyArray<string>;
10
- additionalContext?: Record<string, string>;
11
- configHash: string;
12
- projectChangeAnalyzer: ProjectChangeAnalyzer;
9
+ operationStateHash: string;
13
10
  terminal: ITerminal;
14
11
  phaseName: string;
15
12
  }
@@ -30,7 +27,7 @@ export declare class ProjectBuildCache {
30
27
  private constructor();
31
28
  private static _tryGetTarUtility;
32
29
  get cacheId(): string | undefined;
33
- static tryGetProjectBuildCache(options: IProjectBuildCacheOptions): Promise<ProjectBuildCache | undefined>;
30
+ static getProjectBuildCache(options: IProjectBuildCacheOptions): Promise<ProjectBuildCache | undefined>;
34
31
  tryRestoreFromCacheAsync(terminal: ITerminal, specifiedCacheId?: string): Promise<boolean>;
35
32
  trySetCacheEntryAsync(terminal: ITerminal, specifiedCacheId?: string): Promise<boolean>;
36
33
  /**
@@ -1,12 +1,10 @@
1
1
  import { type ITerminal } from '@rushstack/node-core-library';
2
2
  import { CobuildLock } from '../cobuild/CobuildLock';
3
3
  import { ProjectBuildCache } from '../buildCache/ProjectBuildCache';
4
- import type { IOperationSettings } from '../../api/RushProjectConfiguration';
5
4
  import { ProjectLogWritable } from './ProjectLogWritable';
6
5
  import type { CobuildConfiguration } from '../../api/CobuildConfiguration';
7
6
  import { PeriodicCallback } from './PeriodicCallback';
8
7
  import type { IPhasedCommandPlugin, PhasedCommandHooks } from '../../pluginFramework/PhasedCommandHooks';
9
- import type { ProjectChangeAnalyzer } from '../ProjectChangeAnalyzer';
10
8
  import type { BuildCacheConfiguration } from '../../api/BuildCacheConfiguration';
11
9
  export interface IProjectDeps {
12
10
  files: {
@@ -17,10 +15,10 @@ export interface IProjectDeps {
17
15
  export interface IOperationBuildCacheContext {
18
16
  isCacheWriteAllowed: boolean;
19
17
  isCacheReadAllowed: boolean;
20
- projectChangeAnalyzer: ProjectChangeAnalyzer;
21
- projectBuildCache: ProjectBuildCache | undefined;
18
+ stateHash: string;
19
+ operationBuildCache: ProjectBuildCache | undefined;
22
20
  cacheDisabledReason: string | undefined;
23
- operationSettings: IOperationSettings | undefined;
21
+ outputFolderNames: ReadonlyArray<string> | undefined;
24
22
  cobuildLock: CobuildLock | undefined;
25
23
  cobuildClusterId: string | undefined;
26
24
  buildCacheTerminal: ITerminal | undefined;
@@ -2,13 +2,11 @@ import { OperationStatus } from './OperationStatus';
2
2
  import type { IOperationRunner, IOperationRunnerContext } from './IOperationRunner';
3
3
  import type { RushConfiguration } from '../../api/RushConfiguration';
4
4
  import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
5
- import type { ProjectChangeAnalyzer } from '../ProjectChangeAnalyzer';
6
5
  import type { IPhase } from '../../api/CommandLineConfiguration';
7
6
  export interface IOperationRunnerOptions {
8
7
  rushProject: RushConfigurationProject;
9
8
  rushConfiguration: RushConfiguration;
10
9
  commandToRun: string;
11
- projectChangeAnalyzer: ProjectChangeAnalyzer;
12
10
  displayName: string;
13
11
  phase: IPhase;
14
12
  /**
@@ -0,0 +1,130 @@
1
+ import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
2
+ import type { RushProjectConfiguration } from '../../api/RushProjectConfiguration';
3
+ import { type IReadonlyLookupByPath } from '../LookupByPath';
4
+ /**
5
+ * @beta
6
+ */
7
+ export type IRushConfigurationProjectForSnapshot = Pick<RushConfigurationProject, 'projectFolder' | 'projectRelativeFolder'>;
8
+ /**
9
+ * @internal
10
+ */
11
+ export interface IRushSnapshotProjectMetadata {
12
+ /**
13
+ * The contents of rush-project.json for the project, if available
14
+ */
15
+ projectConfig?: RushProjectConfiguration;
16
+ /**
17
+ * A map of operation name to additional files that should be included in the hash for that operation.
18
+ */
19
+ additionalFilesByOperationName?: ReadonlyMap<string, ReadonlySet<string>>;
20
+ }
21
+ export type IRushSnapshotProjectMetadataMap = ReadonlyMap<IRushConfigurationProjectForSnapshot, IRushSnapshotProjectMetadata>;
22
+ /**
23
+ * The parameters for constructing an {@link InputSnapshot}.
24
+ * @internal
25
+ */
26
+ export interface IRushSnapshotParameters {
27
+ /**
28
+ * Hashes for files selected by `dependsOnAdditionalFiles`.
29
+ * Separated out to prevent being auto-assigned to a project.
30
+ */
31
+ additionalHashes?: ReadonlyMap<string, string>;
32
+ /**
33
+ * The environment to use for `dependsOnEnvVars`. By default performs a snapshot of process.env upon construction.
34
+ * @defaultValue \{ ...process.env \}
35
+ */
36
+ environment?: Record<string, string | undefined>;
37
+ /**
38
+ * File paths (keys into additionalHashes or hashes) to be included as part of every operation's dependencies.
39
+ */
40
+ globalAdditionalFiles?: Iterable<string>;
41
+ /**
42
+ * The hashes of all tracked files in the repository.
43
+ */
44
+ hashes: ReadonlyMap<string, string>;
45
+ /**
46
+ * Optimized lookup engine used to route `hashes` to individual projects.
47
+ */
48
+ lookupByPath: IReadonlyLookupByPath<IRushConfigurationProjectForSnapshot>;
49
+ /**
50
+ * Metadata for each project.
51
+ */
52
+ projectMap: IRushSnapshotProjectMetadataMap;
53
+ /**
54
+ * The directory that all relative paths are relative to.
55
+ */
56
+ rootDir: string;
57
+ }
58
+ /**
59
+ * Represents a synchronously-queryable in-memory snapshot of the state of the inputs to a Rush repository.
60
+ *
61
+ * The methods on this interface are idempotent and will return the same result regardless of when they are executed.
62
+ * @beta
63
+ */
64
+ export interface IInputSnapshot {
65
+ /**
66
+ * Gets the map of file paths to Git hashes that will be used to compute the local state hash of the operation.
67
+ * Exposed separately from the final state hash to facilitate detailed change detection.
68
+ *
69
+ * @param project - The Rush project to get hashes for
70
+ * @param operationName - The name of the operation (phase) to get hashes for. If omitted, returns a default set for the project, as used for bulk commands.
71
+ * @returns A map of file name to Git hash. For local files paths will be relative. Configured additional files may be absolute paths.
72
+ */
73
+ getTrackedFileHashesForOperation(project: IRushConfigurationProjectForSnapshot, operationName?: string): ReadonlyMap<string, string>;
74
+ /**
75
+ * Gets the local state hash for the operation. This will later be combined with the hash of the command being executed and the final hashes of the operation's dependencies to compute
76
+ * the final hash for the operation.
77
+ * @param project - The Rush project to compute the state hash for
78
+ * @param operationName - The name of the operation (phase) to get hashes for. If omitted, returns a generic hash for the whole project, as used for bulk commands.
79
+ * @returns The local state hash for the project. This is a hash of the environment, the project's tracked files, and any additional files.
80
+ */
81
+ getLocalStateHashForOperation(project: IRushConfigurationProjectForSnapshot, operationName?: string): string;
82
+ }
83
+ /**
84
+ * Represents a synchronously-queryable in-memory snapshot of the state of the inputs to a Rush repository.
85
+ * Any asynchronous work needs to be performed by the caller and the results passed to the constructor.
86
+ *
87
+ * @remarks
88
+ * All operations on this class will return the same result regardless of when they are executed.
89
+ *
90
+ * @internal
91
+ */
92
+ export declare class InputSnapshot implements IInputSnapshot {
93
+ /**
94
+ * The metadata for each project. This is a superset of the information in `projectMap` and includes caching of queries.
95
+ */
96
+ private readonly _projectMetadataMap;
97
+ /**
98
+ * Hashes of files to be included in all result sets.
99
+ */
100
+ private readonly _globalAdditionalHashes;
101
+ /**
102
+ * Hashes for files selected by `dependsOnAdditionalFiles`.
103
+ */
104
+ private readonly _additionalHashes;
105
+ /**
106
+ * The environment to use for `dependsOnEnvVars`.
107
+ */
108
+ private readonly _environment;
109
+ /**
110
+ * The hashes of all tracked files in the repository.
111
+ */
112
+ private readonly _hashes;
113
+ /**
114
+ *
115
+ * @param params - The parameters for the snapshot
116
+ * @internal
117
+ */
118
+ constructor(params: IRushSnapshotParameters);
119
+ /**
120
+ * {@inheritdoc}
121
+ */
122
+ getTrackedFileHashesForOperation(project: IRushConfigurationProjectForSnapshot, operationName?: string): ReadonlyMap<string, string>;
123
+ /**
124
+ * {@inheritdoc}
125
+ */
126
+ getLocalStateHashForOperation(project: IRushConfigurationProjectForSnapshot, operationName?: string): string;
127
+ private _resolveHashes;
128
+ private _getOrCreateProjectFilter;
129
+ }
130
+ //# sourceMappingURL=InputSnapshot.d.ts.map
@@ -1 +1 @@
1
- module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/buildCache/getHashesForGlobsAsync");
1
+ module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/snapshots/InputSnapshot");
@@ -5,13 +5,13 @@ 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 { ProjectChangeAnalyzer } from '../logic/ProjectChangeAnalyzer';
9
8
  import type { IExecutionResult, IOperationExecutionResult } from '../logic/operations/IOperationExecutionResult';
10
9
  import type { CobuildConfiguration } from '../api/CobuildConfiguration';
11
10
  import type { RushProjectConfiguration } from '../api/RushProjectConfiguration';
12
11
  import type { IOperationRunnerContext } from '../logic/operations/IOperationRunner';
13
12
  import type { ITelemetryData } from '../logic/Telemetry';
14
13
  import type { OperationStatus } from '../logic/operations/OperationStatus';
14
+ import type { IInputSnapshot } from '../logic/snapshots/InputSnapshot';
15
15
  /**
16
16
  * A plugin that interacts with a phased commands.
17
17
  * @alpha
@@ -40,6 +40,10 @@ export interface ICreateOperationsContext {
40
40
  * Maps from the `longName` field in command-line.json to the parser configuration in ts-command-line.
41
41
  */
42
42
  readonly customParameters: ReadonlyMap<string, CommandLineParameter>;
43
+ /**
44
+ * The current state of the repository, if available
45
+ */
46
+ readonly inputSnapshot?: IInputSnapshot;
43
47
  /**
44
48
  * If true, projects may read their output from cache or be skipped if already up to date.
45
49
  * If false, neither of the above may occur, e.g. "rush rebuild"
@@ -62,10 +66,6 @@ export interface ICreateOperationsContext {
62
66
  * The set of phases selected for the current command execution.
63
67
  */
64
68
  readonly phaseSelection: ReadonlySet<IPhase>;
65
- /**
66
- * The current state of the repository
67
- */
68
- readonly projectChangeAnalyzer: ProjectChangeAnalyzer;
69
69
  /**
70
70
  * The set of Rush projects selected for the current command execution.
71
71
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/rush-sdk",
3
- "version": "5.112.0",
3
+ "version": "5.112.2-pr4476.0",
4
4
  "description": "An API for interacting with the Rush engine",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,17 +25,17 @@
25
25
  "dependencies": {
26
26
  "@types/node-fetch": "2.6.2",
27
27
  "tapable": "2.2.1",
28
- "@rushstack/node-core-library": "3.61.0"
28
+ "@rushstack/node-core-library": "3.63.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/semver": "7.5.0",
32
32
  "@types/webpack-env": "1.18.0",
33
- "@microsoft/rush-lib": "5.112.0",
33
+ "@rushstack/heft": "0.63.6",
34
+ "@rushstack/terminal": "0.7.16",
35
+ "@rushstack/stream-collator": "4.1.17",
34
36
  "local-node-rig": "1.0.0",
35
- "@rushstack/stream-collator": "4.1.13",
36
- "@rushstack/heft": "0.63.2",
37
- "@rushstack/ts-command-line": "4.17.1",
38
- "@rushstack/terminal": "0.7.12"
37
+ "@microsoft/rush-lib": "5.112.2-pr4476.0",
38
+ "@rushstack/ts-command-line": "4.17.1"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "heft build --clean",
@@ -1,3 +0,0 @@
1
- import type { IRawRepoState } from '../ProjectChangeAnalyzer';
2
- export declare function getHashesForGlobsAsync(globPatterns: Iterable<string>, packagePath: string, repoState: IRawRepoState | undefined): Promise<Map<string, string>>;
3
- //# sourceMappingURL=getHashesForGlobsAsync.d.ts.map