@rushstack/rush-sdk 5.135.0 → 5.136.1

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 (33) hide show
  1. package/dist/rush-lib.d.ts +115 -26
  2. package/lib/api/CommonVersionsConfiguration.d.ts +1 -1
  3. package/lib/api/EnvironmentConfiguration.d.ts +7 -0
  4. package/lib/api/RushConfiguration.d.ts +50 -14
  5. package/lib/api/Subspace.d.ts +33 -9
  6. package/lib/api/Variants.d.ts +8 -0
  7. package/lib/api/Variants.js +1 -0
  8. package/lib/cli/actions/AddAction.d.ts +2 -1
  9. package/lib/cli/actions/BaseAddAndRemoveAction.d.ts +1 -1
  10. package/lib/cli/actions/BaseInstallAction.d.ts +2 -1
  11. package/lib/cli/actions/CheckAction.d.ts +1 -0
  12. package/lib/cli/actions/RemoveAction.d.ts +3 -3
  13. package/lib/cli/actions/UpgradeInteractiveAction.d.ts +1 -0
  14. package/lib/cli/scriptActions/PhasedScriptAction.d.ts +1 -0
  15. package/lib/logic/DependencyAnalyzer.d.ts +2 -2
  16. package/lib/logic/PackageJsonUpdaterTypes.d.ts +4 -0
  17. package/lib/logic/ProjectChangeAnalyzer.d.ts +1 -0
  18. package/lib/logic/RepoStateFile.d.ts +1 -1
  19. package/lib/logic/RushConstants.d.ts +10 -0
  20. package/lib/logic/base/BaseInstallManagerTypes.d.ts +4 -0
  21. package/lib/logic/base/BaseShrinkwrapFile.d.ts +2 -1
  22. package/lib/logic/npm/NpmShrinkwrapFile.d.ts +1 -1
  23. package/lib/logic/pnpm/PnpmShrinkwrapFile.d.ts +1 -1
  24. package/lib/logic/pnpm/PnpmfileConfiguration.d.ts +2 -2
  25. package/lib/logic/pnpm/SubspacePnpmfileConfiguration.d.ts +2 -2
  26. package/lib/logic/policy/PolicyValidator.d.ts +1 -1
  27. package/lib/logic/policy/ShrinkwrapFilePolicy.d.ts +1 -1
  28. package/lib/logic/versionMismatch/VersionMismatchFinder.d.ts +2 -2
  29. package/lib/pluginFramework/RushLifeCycle.d.ts +10 -2
  30. package/lib/utilities/Utilities.d.ts +1 -1
  31. package/lib-shim/index.js +41 -10
  32. package/lib-shim/index.js.map +1 -1
  33. package/package.json +7 -7
@@ -5,9 +5,9 @@ import type { IPackageJsonUpdaterRushRemoveOptions } from '../../logic/PackageJs
5
5
  export declare class RemoveAction extends BaseAddAndRemoveAction {
6
6
  protected readonly _allFlag: CommandLineFlagParameter;
7
7
  protected readonly _packageNameList: CommandLineStringListParameter;
8
- private _terminalProvider;
9
- private _terminal;
8
+ private readonly _variantParameter;
9
+ private readonly _terminal;
10
10
  constructor(parser: RushCommandLineParser);
11
- getUpdateOptions(): IPackageJsonUpdaterRushRemoveOptions;
11
+ getUpdateOptionsAsync(): Promise<IPackageJsonUpdaterRushRemoveOptions>;
12
12
  }
13
13
  //# sourceMappingURL=RemoveAction.d.ts.map
@@ -3,6 +3,7 @@ import { BaseRushAction } from './BaseRushAction';
3
3
  export declare class UpgradeInteractiveAction extends BaseRushAction {
4
4
  private _makeConsistentFlag;
5
5
  private _skipUpdateFlag;
6
+ private readonly _variantParameter;
6
7
  constructor(parser: RushCommandLineParser);
7
8
  runAsync(): Promise<void>;
8
9
  }
@@ -51,6 +51,7 @@ export declare class PhasedScriptAction extends BaseScriptAction<IPhasedCommandC
51
51
  private readonly _timelineParameter;
52
52
  private readonly _cobuildPlanParameter;
53
53
  private readonly _installParameter;
54
+ private readonly _variantParameter;
54
55
  private readonly _noIPCParameter;
55
56
  constructor(options: IPhasedScriptActionOptions);
56
57
  runAsync(): Promise<void>;
@@ -20,10 +20,10 @@ export interface IDependencyAnalysis {
20
20
  export declare class DependencyAnalyzer {
21
21
  private static _dependencyAnalyzerByRushConfiguration;
22
22
  private _rushConfiguration;
23
- private _analysisBySubspace;
23
+ private _analysisByVariantBySubspace;
24
24
  private constructor();
25
25
  static forRushConfiguration(rushConfiguration: RushConfiguration): DependencyAnalyzer;
26
- getAnalysis(subspace?: Subspace, addAction?: boolean): IDependencyAnalysis;
26
+ getAnalysis(subspace: Subspace | undefined, variant: string | undefined, addAction: boolean): IDependencyAnalysis;
27
27
  /**
28
28
  * Generates the {@link IDependencyAnalysis}.
29
29
  *
@@ -45,6 +45,10 @@ export interface IPackageJsonUpdaterRushBaseUpdateOptions {
45
45
  * actionName
46
46
  */
47
47
  actionName: string;
48
+ /**
49
+ * The variant to consider when performing installations and validating shrinkwrap updates.
50
+ */
51
+ variant: string | undefined | undefined;
48
52
  }
49
53
  /**
50
54
  * Configuration options for adding or updating a dependency in a single project
@@ -8,6 +8,7 @@ export interface IGetChangedProjectsOptions {
8
8
  targetBranchName: string;
9
9
  terminal: ITerminal;
10
10
  shouldFetch?: boolean;
11
+ variant?: string;
11
12
  /**
12
13
  * If set to `true`, consider a project's external dependency installation layout as defined in the
13
14
  * package manager lockfile when determining if it has changed.
@@ -51,7 +51,7 @@ export declare class RepoStateFile {
51
51
  *
52
52
  * @returns true if the file was modified, otherwise false.
53
53
  */
54
- refreshState(rushConfiguration: RushConfiguration, subspace: Subspace | undefined): boolean;
54
+ refreshState(rushConfiguration: RushConfiguration, subspace: Subspace | undefined, variant?: string): boolean;
55
55
  /**
56
56
  * Writes the "repo-state.json" file to disk, using the filename that was passed to loadFromFile().
57
57
  */
@@ -41,6 +41,12 @@ export declare class RushConstants {
41
41
  * The NPM scope ("\@rush-temp") that is used for Rush's temporary projects.
42
42
  */
43
43
  static readonly rushTempNpmScope: '@rush-temp';
44
+ /**
45
+ * The folder name ("variants") under which named variant configurations for
46
+ * alternate dependency sets may be found.
47
+ * Example: `C:\MyRepo\common\config\rush\variants`
48
+ */
49
+ static readonly rushVariantsFolderName: 'variants';
44
50
  /**
45
51
  * The folder name ("temp") under the common folder, or under the .rush folder in each project's directory where
46
52
  * temporary files will be stored.
@@ -268,5 +274,9 @@ export declare class RushConstants {
268
274
  * The filename for the machine-generated file that tracks state for Rush alerts.
269
275
  */
270
276
  static readonly rushAlertsStateFilename: 'rush-alerts-state.json';
277
+ /**
278
+ * The filename for the file that tracks which variant is currently installed.
279
+ */
280
+ static readonly currentVariantsFilename: 'current-variants.json';
271
281
  }
272
282
  //# sourceMappingURL=RushConstants.d.ts.map
@@ -64,6 +64,10 @@ export interface IInstallManagerOptions {
64
64
  * If specified when using PNPM, the logs will be in /common/temp/pnpm.log
65
65
  */
66
66
  collectLogFile: boolean;
67
+ /**
68
+ * The variant to consider when performing installations and validating shrinkwrap updates.
69
+ */
70
+ variant: string | undefined;
67
71
  /**
68
72
  * Retry the install the specified number of times
69
73
  */
@@ -85,10 +85,11 @@ export declare abstract class BaseShrinkwrapFile {
85
85
  * a given package.json. Returns true if any dependencies are not aligned with the shrinkwrap.
86
86
  *
87
87
  * @param project - the Rush project that is being validated against the shrinkwrap
88
+ * @param variant - the variant that is being validated
88
89
  *
89
90
  * @virtual
90
91
  */
91
- abstract isWorkspaceProjectModifiedAsync(project: RushConfigurationProject, subspace: Subspace): Promise<boolean>;
92
+ abstract isWorkspaceProjectModifiedAsync(project: RushConfigurationProject, subspace: Subspace, variant: string | undefined): Promise<boolean>;
92
93
  /** @virtual */
93
94
  protected abstract serialize(): string;
94
95
  protected _getTempProjectNames(dependencies: {
@@ -25,6 +25,6 @@ export declare class NpmShrinkwrapFile extends BaseShrinkwrapFile {
25
25
  /** @override */
26
26
  getProjectShrinkwrap(project: RushConfigurationProject): BaseProjectShrinkwrapFile<NpmShrinkwrapFile> | undefined;
27
27
  /** @override */
28
- isWorkspaceProjectModifiedAsync(project: RushConfigurationProject, subspace: Subspace): Promise<boolean>;
28
+ isWorkspaceProjectModifiedAsync(project: RushConfigurationProject, subspace: Subspace, variant: string | undefined): Promise<boolean>;
29
29
  }
30
30
  //# sourceMappingURL=NpmShrinkwrapFile.d.ts.map
@@ -255,7 +255,7 @@ export declare class PnpmShrinkwrapFile extends BaseShrinkwrapFile {
255
255
  getImporter(importerKey: string): IPnpmShrinkwrapImporterYaml | undefined;
256
256
  getIntegrityForImporter(importerKey: string): Map<string, string> | undefined;
257
257
  /** @override */
258
- isWorkspaceProjectModifiedAsync(project: RushConfigurationProject, subspace: Subspace): Promise<boolean>;
258
+ isWorkspaceProjectModifiedAsync(project: RushConfigurationProject, subspace: Subspace, variant: string | undefined): Promise<boolean>;
259
259
  private _getIntegrityForPackage;
260
260
  private _addIntegrities;
261
261
  /**
@@ -8,8 +8,8 @@ import type { Subspace } from '../../api/Subspace';
8
8
  export declare class PnpmfileConfiguration {
9
9
  private _context;
10
10
  private constructor();
11
- static initializeAsync(rushConfiguration: RushConfiguration, subspace: Subspace): Promise<PnpmfileConfiguration>;
12
- static writeCommonTempPnpmfileShimAsync(rushConfiguration: RushConfiguration, targetDir: string, subspace: Subspace): Promise<void>;
11
+ static initializeAsync(rushConfiguration: RushConfiguration, subspace: Subspace, variant: string | undefined): Promise<PnpmfileConfiguration>;
12
+ static writeCommonTempPnpmfileShimAsync(rushConfiguration: RushConfiguration, targetDir: string, subspace: Subspace, variant: string | undefined): Promise<void>;
13
13
  private static _getPnpmfileShimSettingsAsync;
14
14
  /**
15
15
  * Transform a package.json file using the pnpmfile.js hook.
@@ -11,8 +11,8 @@ export declare class SubspacePnpmfileConfiguration {
11
11
  * That means each project owns their individual pnpmfile under project folder. While the global pnpmfile could be
12
12
  * under the common/temp-split/ folder and be used by all split workspace projects.
13
13
  */
14
- static writeCommonTempSubspaceGlobalPnpmfileAsync(rushConfiguration: RushConfiguration, subspace: Subspace): Promise<void>;
15
- static getSubspacePnpmfileShimSettings(rushConfiguration: RushConfiguration, subspace: Subspace): ISubspacePnpmfileShimSettings;
14
+ static writeCommonTempSubspaceGlobalPnpmfileAsync(rushConfiguration: RushConfiguration, subspace: Subspace, variant: string | undefined): Promise<void>;
15
+ static getSubspacePnpmfileShimSettings(rushConfiguration: RushConfiguration, subspace: Subspace, variant: string | undefined): ISubspacePnpmfileShimSettings;
16
16
  private static _getProjectNameToInjectedDependenciesMap;
17
17
  private static _processDependenciesForTransitiveInjectedInstall;
18
18
  }
@@ -5,5 +5,5 @@ export interface IPolicyValidatorOptions {
5
5
  bypassPolicy?: boolean;
6
6
  allowShrinkwrapUpdates?: boolean;
7
7
  }
8
- export declare function validatePolicyAsync(rushConfiguration: RushConfiguration, subspace: Subspace, options: IPolicyValidatorOptions): Promise<void>;
8
+ export declare function validatePolicyAsync(rushConfiguration: RushConfiguration, subspace: Subspace, variant: string | undefined, options: IPolicyValidatorOptions): Promise<void>;
9
9
  //# sourceMappingURL=PolicyValidator.d.ts.map
@@ -8,5 +8,5 @@ export interface IShrinkwrapFilePolicyValidatorOptions extends IPolicyValidatorO
8
8
  /**
9
9
  * A policy that validates shrinkwrap files used by package managers.
10
10
  */
11
- export declare function validate(rushConfiguration: RushConfiguration, subspace: Subspace, options: IPolicyValidatorOptions): void;
11
+ export declare function validate(rushConfiguration: RushConfiguration, subspace: Subspace, variant: string | undefined, options: IPolicyValidatorOptions): void;
12
12
  //# sourceMappingURL=ShrinkwrapFilePolicy.d.ts.map
@@ -3,12 +3,12 @@ import type { RushConfiguration } from '../../api/RushConfiguration';
3
3
  import type { VersionMismatchFinderEntity } from './VersionMismatchFinderEntity';
4
4
  import type { Subspace } from '../../api/Subspace';
5
5
  export interface IVersionMismatchFinderOptions {
6
- subspace: Subspace;
6
+ subspace?: Subspace;
7
+ variant: string | undefined;
7
8
  }
8
9
  export interface IVersionMismatchFinderRushCheckOptions extends IVersionMismatchFinderOptions {
9
10
  printAsJson?: boolean | undefined;
10
11
  truncateLongPackageNameLists?: boolean | undefined;
11
- subspace: Subspace;
12
12
  }
13
13
  export interface IVersionMismatchFinderEnsureConsistentVersionsOptions extends IVersionMismatchFinderOptions {
14
14
  }
@@ -58,11 +58,19 @@ export declare class RushLifecycleHooks {
58
58
  /**
59
59
  * The hook to run between preparing the common/temp folder and invoking the package manager during "rush install" or "rush update".
60
60
  */
61
- readonly beforeInstall: AsyncSeriesHook<[IGlobalCommand, Subspace]>;
61
+ readonly beforeInstall: AsyncSeriesHook<[
62
+ command: IGlobalCommand,
63
+ subspace: Subspace,
64
+ variant: string | undefined
65
+ ]>;
62
66
  /**
63
67
  * The hook to run after a successful install.
64
68
  */
65
- readonly afterInstall: AsyncSeriesHook<[IRushCommand, Subspace]>;
69
+ readonly afterInstall: AsyncSeriesHook<[
70
+ command: IRushCommand,
71
+ subspace: Subspace,
72
+ variant: string | undefined
73
+ ]>;
66
74
  /**
67
75
  * A hook to allow plugins to hook custom logic to process telemetry data.
68
76
  */
@@ -120,7 +120,7 @@ export declare class Utilities {
120
120
  * hard disk.
121
121
  */
122
122
  static dangerouslyDeletePath(folderPath: string): void;
123
- static isFileTimestampCurrent(dateToCompare: Date, inputFilenames: string[]): boolean;
123
+ static isFileTimestampCurrentAsync(dateToCompare: Date, inputFilePaths: string[]): Promise<boolean>;
124
124
  static executeCommandAsync(options: IExecuteCommandOptions & {
125
125
  captureExitCodeAndSignal: true;
126
126
  }): Promise<Pick<IWaitForExitResult, 'exitCode' | 'signal'>>;
package/lib-shim/index.js CHANGED
@@ -160,6 +160,13 @@ const EnvironmentVariableNames = {
160
160
  * or `0` to disallow them. (See the comments in the command-line.json file for more information).
161
161
  */
162
162
  RUSH_ALLOW_WARNINGS_IN_SUCCESSFUL_BUILD: 'RUSH_ALLOW_WARNINGS_IN_SUCCESSFUL_BUILD',
163
+ /**
164
+ * This variable selects a specific installation variant for Rush to use when installing
165
+ * and linking package dependencies.
166
+ * For more information, see the command-line help for the `--variant` parameter
167
+ * and this article: https://rushjs.io/pages/advanced/installation_variants/
168
+ */
169
+ RUSH_VARIANT: 'RUSH_VARIANT',
163
170
  /**
164
171
  * Specifies the maximum number of concurrent processes to launch during a build.
165
172
  * For more information, see the command-line help for the `--parallelism` parameter for "rush build".
@@ -543,6 +550,7 @@ class EnvironmentConfiguration {
543
550
  }
544
551
  case EnvironmentVariableNames.RUSH_PARALLELISM:
545
552
  case EnvironmentVariableNames.RUSH_PREVIEW_VERSION:
553
+ case EnvironmentVariableNames.RUSH_VARIANT:
546
554
  case EnvironmentVariableNames.RUSH_DEPLOY_TARGET_FOLDER:
547
555
  // Handled by @microsoft/rush front end
548
556
  break;
@@ -748,6 +756,12 @@ RushConstants.commonFolderName = 'common';
748
756
  * The NPM scope ("\@rush-temp") that is used for Rush's temporary projects.
749
757
  */
750
758
  RushConstants.rushTempNpmScope = '@rush-temp';
759
+ /**
760
+ * The folder name ("variants") under which named variant configurations for
761
+ * alternate dependency sets may be found.
762
+ * Example: `C:\MyRepo\common\config\rush\variants`
763
+ */
764
+ RushConstants.rushVariantsFolderName = 'variants';
751
765
  /**
752
766
  * The folder name ("temp") under the common folder, or under the .rush folder in each project's directory where
753
767
  * temporary files will be stored.
@@ -977,6 +991,10 @@ RushConstants.rushAlertsConfigFilename = 'rush-alerts.json';
977
991
  * The filename for the machine-generated file that tracks state for Rush alerts.
978
992
  */
979
993
  RushConstants.rushAlertsStateFilename = 'rush-alerts-state.json';
994
+ /**
995
+ * The filename for the file that tracks which variant is currently installed.
996
+ */
997
+ RushConstants.currentVariantsFilename = 'current-variants.json';
980
998
  //# sourceMappingURL=RushConstants.js.map
981
999
 
982
1000
  /***/ }),
@@ -1130,17 +1148,30 @@ class Utilities {
1130
1148
  * NOTE: The filenames can also be paths for directories, in which case the directory
1131
1149
  * timestamp is compared.
1132
1150
  */
1133
- static isFileTimestampCurrent(dateToCompare, inputFilenames) {
1134
- for (const inputFilename of inputFilenames) {
1135
- if (!_rushstack_node_core_library__WEBPACK_IMPORTED_MODULE_5__.FileSystem.exists(inputFilename)) {
1136
- return false;
1137
- }
1138
- const inputStats = _rushstack_node_core_library__WEBPACK_IMPORTED_MODULE_5__.FileSystem.getStatistics(inputFilename);
1139
- if (dateToCompare < inputStats.mtime) {
1140
- return false;
1151
+ static async isFileTimestampCurrentAsync(dateToCompare, inputFilePaths) {
1152
+ let anyAreOutOfDate = false;
1153
+ await _rushstack_node_core_library__WEBPACK_IMPORTED_MODULE_5__.Async.forEachAsync(inputFilePaths, async (filePath) => {
1154
+ if (!anyAreOutOfDate) {
1155
+ let inputStats;
1156
+ try {
1157
+ inputStats = await _rushstack_node_core_library__WEBPACK_IMPORTED_MODULE_5__.FileSystem.getStatisticsAsync(filePath);
1158
+ }
1159
+ catch (e) {
1160
+ if (_rushstack_node_core_library__WEBPACK_IMPORTED_MODULE_5__.FileSystem.isNotExistError(e)) {
1161
+ // eslint-disable-next-line require-atomic-updates
1162
+ anyAreOutOfDate = true;
1163
+ }
1164
+ else {
1165
+ throw e;
1166
+ }
1167
+ }
1168
+ if (inputStats && dateToCompare < inputStats.mtime) {
1169
+ // eslint-disable-next-line require-atomic-updates
1170
+ anyAreOutOfDate = true;
1171
+ }
1141
1172
  }
1142
- }
1143
- return true;
1173
+ }, { concurrency: 10 });
1174
+ return !anyAreOutOfDate;
1144
1175
  }
1145
1176
  /**
1146
1177
  * Executes the command with the specified command-line parameters, and waits for it to complete.