@rushstack/rush-sdk 5.92.0 → 5.93.1-pr3481.17

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 (39) hide show
  1. package/README.md +5 -3
  2. package/dist/rush-lib.d.ts +171 -20
  3. package/lib/api/EnvironmentConfiguration.d.ts +5 -0
  4. package/lib/api/ExperimentsConfiguration.d.ts +5 -0
  5. package/lib/api/LastInstallFlag.d.ts +58 -21
  6. package/lib/api/LastLinkFlag.d.ts +3 -7
  7. package/lib/api/Rush.d.ts +1 -0
  8. package/lib/api/RushConfiguration.d.ts +52 -0
  9. package/lib/api/RushConfigurationProject.d.ts +6 -0
  10. package/lib/api/base/BaseFlag.d.ts +50 -0
  11. package/lib/api/base/BaseFlag.js +1 -0
  12. package/lib/api/packageManager/PnpmPackageManager.d.ts +14 -0
  13. package/lib/cli/actions/InstallAction.d.ts +7 -0
  14. package/lib/cli/actions/ListAction.d.ts +4 -0
  15. package/lib/cli/actions/UpdateAction.d.ts +7 -0
  16. package/lib/cli/parsing/SelectionParameterSet.d.ts +17 -3
  17. package/lib/index.d.ts +2 -1
  18. package/lib/logic/PurgeManager.d.ts +1 -0
  19. package/lib/logic/RushConstants.d.ts +6 -0
  20. package/lib/logic/base/BaseInstallManagerTypes.d.ts +23 -0
  21. package/lib/logic/installManager/InstallHelpers.d.ts +1 -0
  22. package/lib/logic/pnpm/IPnpmfile.d.ts +16 -0
  23. package/lib/logic/pnpm/PnpmProjectShrinkwrapFile.d.ts +7 -0
  24. package/lib/logic/pnpm/PnpmShrinkwrapFile.d.ts +26 -0
  25. package/lib/logic/pnpm/SplitWorkspaceGlobalPnpmfileShim.d.ts +3 -0
  26. package/lib/logic/pnpm/SplitWorkspaceGlobalPnpmfileShim.js +1 -0
  27. package/lib/logic/pnpm/SplitWorkspacePnpmfileConfiguration.d.ts +23 -0
  28. package/lib/logic/pnpm/SplitWorkspacePnpmfileConfiguration.js +1 -0
  29. package/lib/logic/selectors/SplitWorkspaceProjectSelectorParser.d.ts +10 -0
  30. package/lib/logic/selectors/SplitWorkspaceProjectSelectorParser.js +1 -0
  31. package/lib/logic/versionMismatch/VersionMismatchFinderProject.d.ts +2 -0
  32. package/lib/utilities/PathConstants.d.ts +1 -0
  33. package/lib/utilities/SetRushLibPath.d.ts +2 -0
  34. package/lib/utilities/SetRushLibPath.js +1 -0
  35. package/lib/utilities/npmrcUtilities.d.ts +1 -1
  36. package/lib-shim/index.d.ts.map +1 -1
  37. package/lib-shim/index.js +25 -2
  38. package/lib-shim/index.js.map +1 -1
  39. package/package.json +2 -2
package/README.md CHANGED
@@ -10,7 +10,9 @@ The **@rushstack/rush-sdk** package acts as a lightweight proxy for accessing th
10
10
 
11
11
  2. When authoring unit tests for a Rush plugin, developers should add **@microsoft/rush-lib** to their **package.json** `devDependencies`. In this context, **@rushstack/rush-sdk** will resolve to that instance for testing purposes.
12
12
 
13
- 3. For scripts and tools that are designed to be used in a Rush monorepo, in the future **@rushstack/rush-sdk** will automatically invoke **install-run-rush.js** and load the local installation. This ensures that tools load a compatible version of the Rush engine for the given branch. Once this is implemented, **@rushstack/rush-sdk** can replace **@microsoft/rush-lib** entirely as the official API interface, with the latter serving as the underlying implementation.
13
+ 3. For projects within a monorepo that use **@rushstack/rush-sdk** during their build process, child processes will inherit the installation of Rush that invoked them. This is communicated using the `_RUSH_LIB_PATH` environment variable.
14
+
15
+ 4. For scripts and tools that are designed to be used in a Rush monorepo, in the future **@rushstack/rush-sdk** will automatically invoke **install-run-rush.js** and load the local installation. This ensures that tools load a compatible version of the Rush engine for the given branch. Once this is implemented, **@rushstack/rush-sdk** can replace **@microsoft/rush-lib** entirely as the official API interface, with the latter serving as the underlying implementation.
14
16
 
15
17
  The **@rushstack/rush-sdk** API declarations are identical to the corresponding version of **@microsoft/rush-lib**.
16
18
 
@@ -42,8 +44,8 @@ Example 2: How to import an internal API:
42
44
  // WARNING: INTERNAL APIS MAY CHANGE AT ANY TIME -- USE THIS AT YOUR OWN RISK:
43
45
 
44
46
  // Important: Since we're calling an internal API, we need to use the unbundled .d.ts files
45
- // instead of the normal .d.ts rollup
46
- import { RushConfiguration } from '@rushstack/rush-sdk/lib/';
47
+ // instead of the normal .d.ts rollup, otherwise TypeScript will complain about a type mismatch.
48
+ import { RushConfiguration } from '@rushstack/rush-sdk/lib/index';
47
49
  const config = RushConfiguration.loadFromDefaultLocation();
48
50
  console.log(config.commonFolder);
49
51
 
@@ -131,6 +131,55 @@ export declare class ApprovedPackagesPolicy {
131
131
  constructor(rushConfiguration: RushConfiguration, rushConfigurationJson: IRushConfigurationJson);
132
132
  }
133
133
 
134
+ /**
135
+ * A base class for flag file.
136
+ * @internal
137
+ */
138
+ export declare class _BaseFlag<T extends object = JsonObject> {
139
+ /**
140
+ * Flag file path
141
+ */
142
+ readonly path: string;
143
+ /**
144
+ * Content of the flag
145
+ */
146
+ protected _state: T;
147
+ /**
148
+ * Whether the current state is modified
149
+ */
150
+ protected _isModified: boolean;
151
+ /**
152
+ * Creates a new flag file
153
+ * @param folderPath - the folder that this flag is managing
154
+ * @param state - optional, the state that should be managed or compared
155
+ */
156
+ constructor(folderPath: string, state?: Partial<T>);
157
+ /**
158
+ * Returns true if the file exists and the contents match the current state.
159
+ */
160
+ isValid(): boolean;
161
+ /**
162
+ * Writes the flag file to disk with the current state
163
+ */
164
+ create(): void;
165
+ /**
166
+ * Merge new data into current state by lodash "merge"
167
+ */
168
+ mergeFromObject(data: JsonObject): void;
169
+ /**
170
+ * Writes the flag file to disk with the current state if modified
171
+ */
172
+ saveIfModified(): void;
173
+ /**
174
+ * Removes the flag file
175
+ */
176
+ clear(): void;
177
+ /**
178
+ * Returns Name of the flag file
179
+ */
180
+ protected get flagName(): string;
181
+ }
182
+
134
183
  /**
135
184
  * Use this class to load and save the "common/config/rush/build-cache.json" config file.
136
185
  * This file provides configuration options for cached project build output.
@@ -559,6 +608,11 @@ export declare enum EnvironmentVariableNames {
559
608
  * Explicitly specifies the path for the `tar` binary that is invoked by certain Rush operations.
560
609
  */
561
610
  RUSH_TAR_BINARY_PATH = "RUSH_TAR_BINARY_PATH",
611
+ /**
612
+ * Internal variable that explicitly specifies the path for the version of `@microsoft/rush-lib` being executed.
613
+ * Will be set upon loading Rush.
614
+ */
615
+ RUSH_LIB_PATH = "_RUSH_LIB_PATH",
562
616
  /**
563
617
  * When Rush executes shell scripts, it sometimes changes the working directory to be a project folder or
564
618
  * the repository root folder. The original working directory (where the Rush command was invoked) is assigned
@@ -878,6 +932,11 @@ export declare interface IExperimentsJson {
878
932
  * in common/config/rush/command-line.json.
879
933
  */
880
934
  phasedCommands?: boolean;
935
+ /**
936
+ * If true, rush install or rush update implicitly specify --ignore-scripts during pnpm install,
937
+ * and run install lifecycle scripts by pnpm rebuild --pending after pnpm install successfully.
938
+ */
939
+ deferredInstallationScripts?: boolean;
881
940
  /**
882
941
  * If true, perform a clean install after when running `rush install` or `rush update` if the
883
942
  * `.npmrc` file has changed since the last install.
@@ -949,6 +1008,51 @@ declare interface IIndividualVersionJson extends IVersionPolicyJson {
949
1008
  lockedMajor?: number;
950
1009
  }
951
1010
 
1011
+ /**
1012
+ * This represents the JSON data structure for the "last-install.flag" file.
1013
+ * @internal
1014
+ */
1015
+ export declare interface _ILastInstallFlagJson {
1016
+ /**
1017
+ * Current node version
1018
+ */
1019
+ node: string;
1020
+ /**
1021
+ * Current package manager name
1022
+ */
1023
+ packageManager: PackageManagerName;
1024
+ /**
1025
+ * Current package manager version
1026
+ */
1027
+ packageManagerVersion: string;
1028
+ /**
1029
+ * Current rush json folder
1030
+ */
1031
+ rushJsonFolder: string;
1032
+ /**
1033
+ * The content of package.json, used in the flag file of autoinstaller
1034
+ */
1035
+ packageJson?: IPackageJson;
1036
+ /**
1037
+ * Same with pnpmOptions.pnpmStorePath in rush.json
1038
+ */
1039
+ storePath?: string;
1040
+ /**
1041
+ * True when "useWorkspaces" is true in rush.json
1042
+ */
1043
+ workspaces?: true;
1044
+ /**
1045
+ * True when user explicitly specify "--ignore-scripts" CLI parameter or deferredInstallationScripts
1046
+ */
1047
+ ignoreScripts?: true;
1048
+ /**
1049
+ * When specified, it is a list of selected projects during partial install
1050
+ * It is undefined when full install
1051
+ */
1052
+ selectedProjectNames?: string[];
1053
+ [key: string]: unknown;
1054
+ }
1055
+
952
1056
  /**
953
1057
  * Options to pass to the rush "launch" functions.
954
1058
  *
@@ -1433,6 +1537,7 @@ declare interface IRushConfigurationProjectJson {
1433
1537
  skipRushCheck?: boolean;
1434
1538
  publishFolder?: string;
1435
1539
  tags?: string[];
1540
+ splitWorkspace?: boolean;
1436
1541
  }
1437
1542
 
1438
1543
  /**
@@ -1457,6 +1562,16 @@ declare interface IRushConfigurationProjectOptions {
1457
1562
  allowedProjectTags: Set<string> | undefined;
1458
1563
  }
1459
1564
 
1565
+ /**
1566
+ * The filter parameters to search from all projects.
1567
+ */
1568
+ declare interface IRushConfigurationProjectsFilter {
1569
+ /**
1570
+ * If true, filter out projects that specify splitWorkspace as true.
1571
+ */
1572
+ splitWorkspace: boolean;
1573
+ }
1574
+
1460
1575
  /**
1461
1576
  * Part of IRushConfigurationJson.
1462
1577
  */
@@ -1720,19 +1835,9 @@ export declare interface _IYarnOptionsJson extends IPackageManagerOptionsJsonBas
1720
1835
  * it can invalidate the last install.
1721
1836
  * @internal
1722
1837
  */
1723
- export declare class _LastInstallFlag {
1724
- private _state;
1725
- /**
1726
- * Returns the full path to the flag file
1727
- */
1728
- readonly path: string;
1729
- /**
1730
- * Creates a new LastInstall flag
1731
- * @param folderPath - the folder that this flag is managing
1732
- * @param state - optional, the state that should be managed or compared
1733
- */
1734
- constructor(folderPath: string, state?: JsonObject);
1838
+ export declare class _LastInstallFlag extends _BaseFlag<_ILastInstallFlagJson> {
1735
1839
  /**
1840
+ * @override
1736
1841
  * Returns true if the file exists and the contents match the current state.
1737
1842
  */
1738
1843
  isValid(options?: _ILockfileValidityCheckOptions): boolean;
@@ -1746,14 +1851,6 @@ export declare class _LastInstallFlag {
1746
1851
  rushVerb: string;
1747
1852
  }): boolean;
1748
1853
  private _isValid;
1749
- /**
1750
- * Writes the flag file to disk with the current state
1751
- */
1752
- create(): void;
1753
- /**
1754
- * Removes the flag file
1755
- */
1756
- clear(): void;
1757
1854
  /**
1758
1855
  * Returns the name of the flag file
1759
1856
  */
@@ -2566,6 +2663,8 @@ export declare class RushConfiguration {
2566
2663
  private _projects;
2567
2664
  private _projectsByName;
2568
2665
  private _projectsByTag;
2666
+ private _filteredProjectsCache;
2667
+ private _hasSplitWorkspaceProject;
2569
2668
  private _commonVersionsConfigurationsByVariant;
2570
2669
  /**
2571
2670
  * The name of the package manager being used to install dependencies
@@ -2620,6 +2719,12 @@ export declare class RushConfiguration {
2620
2719
  * Example: `C:\MyRepo\common\temp`
2621
2720
  */
2622
2721
  readonly commonTempFolder: string;
2722
+ /**
2723
+ * The folder where temporary files will be stored. This is always a subfolder called "temp"
2724
+ * under the common folder.
2725
+ * Example: `C:\MyRepo\common\temp-split`
2726
+ */
2727
+ readonly commonTempSplitFolder: string;
2623
2728
  /**
2624
2729
  * The folder where automation scripts are stored. This is always a subfolder called "scripts"
2625
2730
  * under the common folder.
@@ -2674,6 +2779,21 @@ export declare class RushConfiguration {
2674
2779
  * or `C:\MyRepo\common\temp\pnpm-lock-preinstall.yaml`
2675
2780
  */
2676
2781
  readonly tempShrinkwrapPreinstallFilename: string;
2782
+ /**
2783
+ * The filename (without any path) of the shrinkwrap file for split workspace that is used by the package manager.
2784
+ * @remarks
2785
+ * This property merely reports the filename; the file itself may not actually exist.
2786
+ * Example: `pnpm-lock.yaml`
2787
+ */
2788
+ readonly splitWorkspaceShrinkwrapFilename: string;
2789
+ /**
2790
+ * The full path of the temporary shrinkwrap file for split workspace that is used during
2791
+ * "rush install". This file may get rewritten by the package manager during installation.
2792
+ * @remarks
2793
+ * This property merely reports the filename; the file itself may not actually exist.
2794
+ * Example: `C:\MyRepo\common\temp-split\pnpm-lock.yaml`
2795
+ */
2796
+ readonly tempSplitWorkspaceShrinkwrapFilename: string;
2677
2797
  /**
2678
2798
  * The filename of the variant dependency data file. By default this is
2679
2799
  * called 'current-variant.json' resides in the Rush common folder.
@@ -2929,6 +3049,11 @@ export declare class RushConfiguration {
2929
3049
  * @beta
2930
3050
  */
2931
3051
  get projectsByTag(): ReadonlyMap<string, ReadonlySet<RushConfigurationProject>>;
3052
+ /**
3053
+ * Search for projects according to filter
3054
+ * @beta
3055
+ */
3056
+ getFilteredProjects(filter: IRushConfigurationProjectsFilter): RushConfigurationProject[];
2932
3057
  /**
2933
3058
  * Settings from the common-versions.json config file.
2934
3059
  * @remarks
@@ -2947,6 +3072,10 @@ export declare class RushConfiguration {
2947
3072
  * or "rush update".
2948
3073
  */
2949
3074
  get currentInstalledVariant(): string | undefined;
3075
+ /**
3076
+ * Is there any split workspace project.
3077
+ */
3078
+ get hasSplitWorkspaceProject(): boolean;
2950
3079
  /**
2951
3080
  * Gets the path to the common-versions.json config file for a specific variant.
2952
3081
  * @param variant - The name of the current variant in use by the active command.
@@ -2979,6 +3108,11 @@ export declare class RushConfiguration {
2979
3108
  * @param variant - The name of the current variant in use by the active command.
2980
3109
  */
2981
3110
  getCommittedShrinkwrapFilename(variant?: string | undefined): string;
3111
+ /**
3112
+ * Gets the committed shrinkwrap file name for split workspace.
3113
+ * @param variant - The name of the current variant in use by the active command.
3114
+ */
3115
+ getCommittedSplitWorkspaceShrinkwrapFilename(): string;
2982
3116
  /**
2983
3117
  * Gets the absolute path for "pnpmfile.js" for a specific variant.
2984
3118
  * @param variant - The name of the current variant in use by the active command.
@@ -3014,6 +3148,12 @@ export declare class RushConfiguration {
3014
3148
  */
3015
3149
  tryGetProjectForPath(currentFolderPath: string): RushConfigurationProject | undefined;
3016
3150
  private _getVariantConfigFolderPath;
3151
+ /**
3152
+ * Split workspace can only works on PNPM with "useWorkspaces" enabled.
3153
+ * The workspace project can NOT depend on a split workspace project.
3154
+ * The split workspace project CAN depend on a workspace project.
3155
+ */
3156
+ private _validateSplitWorkspaceRelationships;
3017
3157
  }
3018
3158
 
3019
3159
  /**
@@ -3129,6 +3269,11 @@ export declare class RushConfigurationProject {
3129
3269
  * @beta
3130
3270
  */
3131
3271
  readonly tags: ReadonlySet<string>;
3272
+ /**
3273
+ * Whether this project is a split workspace project.
3274
+ * @beta
3275
+ */
3276
+ readonly splitWorkspace: boolean;
3132
3277
  /** @internal */
3133
3278
  constructor(options: IRushConfigurationProjectOptions);
3134
3279
  /**
@@ -3238,6 +3383,12 @@ export declare class RushConstants {
3238
3383
  * Example: `C:\MyRepo\common\temp`
3239
3384
  */
3240
3385
  static readonly rushTempFolderName: string;
3386
+ /**
3387
+ * The folder name ("temp-split") under the common folder, or under the .rush folder in each project's directory where
3388
+ * temporary files will be stored.
3389
+ * Example: `C:\MyRepo\common\temp-split`
3390
+ */
3391
+ static readonly rushTempSplitFolderName: string;
3241
3392
  /**
3242
3393
  * The folder name ("projects") where temporary projects will be stored.
3243
3394
  * Example: `C:\MyRepo\common\temp\projects`
@@ -128,6 +128,11 @@ export declare enum EnvironmentVariableNames {
128
128
  * Explicitly specifies the path for the `tar` binary that is invoked by certain Rush operations.
129
129
  */
130
130
  RUSH_TAR_BINARY_PATH = "RUSH_TAR_BINARY_PATH",
131
+ /**
132
+ * Internal variable that explicitly specifies the path for the version of `@microsoft/rush-lib` being executed.
133
+ * Will be set upon loading Rush.
134
+ */
135
+ RUSH_LIB_PATH = "_RUSH_LIB_PATH",
131
136
  /**
132
137
  * When Rush executes shell scripts, it sometimes changes the working directory to be a project folder or
133
138
  * the repository root folder. The original working directory (where the Rush command was invoked) is assigned
@@ -35,6 +35,11 @@ export interface IExperimentsJson {
35
35
  * in common/config/rush/command-line.json.
36
36
  */
37
37
  phasedCommands?: boolean;
38
+ /**
39
+ * If true, rush install or rush update implicitly specify --ignore-scripts during pnpm install,
40
+ * and run install lifecycle scripts by pnpm rebuild --pending after pnpm install successfully.
41
+ */
42
+ deferredInstallationScripts?: boolean;
38
43
  /**
39
44
  * If true, perform a clean install after when running `rush install` or `rush update` if the
40
45
  * `.npmrc` file has changed since the last install.
@@ -1,6 +1,52 @@
1
- import { JsonObject } from '@rushstack/node-core-library';
1
+ import { IPackageJson } from '@rushstack/node-core-library';
2
+ import { BaseFlag } from './base/BaseFlag';
3
+ import { PackageManagerName } from './packageManager/PackageManager';
2
4
  import { RushConfiguration } from './RushConfiguration';
3
5
  export declare const LAST_INSTALL_FLAG_FILE_NAME: string;
6
+ /**
7
+ * This represents the JSON data structure for the "last-install.flag" file.
8
+ * @internal
9
+ */
10
+ export interface ILastInstallFlagJson {
11
+ /**
12
+ * Current node version
13
+ */
14
+ node: string;
15
+ /**
16
+ * Current package manager name
17
+ */
18
+ packageManager: PackageManagerName;
19
+ /**
20
+ * Current package manager version
21
+ */
22
+ packageManagerVersion: string;
23
+ /**
24
+ * Current rush json folder
25
+ */
26
+ rushJsonFolder: string;
27
+ /**
28
+ * The content of package.json, used in the flag file of autoinstaller
29
+ */
30
+ packageJson?: IPackageJson;
31
+ /**
32
+ * Same with pnpmOptions.pnpmStorePath in rush.json
33
+ */
34
+ storePath?: string;
35
+ /**
36
+ * True when "useWorkspaces" is true in rush.json
37
+ */
38
+ workspaces?: true;
39
+ /**
40
+ * True when user explicitly specify "--ignore-scripts" CLI parameter or deferredInstallationScripts
41
+ */
42
+ ignoreScripts?: true;
43
+ /**
44
+ * When specified, it is a list of selected projects during partial install
45
+ * It is undefined when full install
46
+ */
47
+ selectedProjectNames?: string[];
48
+ [key: string]: unknown;
49
+ }
4
50
  /**
5
51
  * @internal
6
52
  */
@@ -15,19 +61,9 @@ export interface ILockfileValidityCheckOptions {
15
61
  * it can invalidate the last install.
16
62
  * @internal
17
63
  */
18
- export declare class LastInstallFlag {
19
- private _state;
20
- /**
21
- * Returns the full path to the flag file
22
- */
23
- readonly path: string;
24
- /**
25
- * Creates a new LastInstall flag
26
- * @param folderPath - the folder that this flag is managing
27
- * @param state - optional, the state that should be managed or compared
28
- */
29
- constructor(folderPath: string, state?: JsonObject);
64
+ export declare class LastInstallFlag extends BaseFlag<ILastInstallFlagJson> {
30
65
  /**
66
+ * @override
31
67
  * Returns true if the file exists and the contents match the current state.
32
68
  */
33
69
  isValid(options?: ILockfileValidityCheckOptions): boolean;
@@ -41,14 +77,6 @@ export declare class LastInstallFlag {
41
77
  rushVerb: string;
42
78
  }): boolean;
43
79
  private _isValid;
44
- /**
45
- * Writes the flag file to disk with the current state
46
- */
47
- create(): void;
48
- /**
49
- * Removes the flag file
50
- */
51
- clear(): void;
52
80
  /**
53
81
  * Returns the name of the flag file
54
82
  */
@@ -69,5 +97,14 @@ export declare class LastInstallFlagFactory {
69
97
  * @internal
70
98
  */
71
99
  static getCommonTempFlag(rushConfiguration: RushConfiguration, extraState?: Record<string, string>): LastInstallFlag;
100
+ /**
101
+ * Gets the LastInstall flag and sets the current state. This state is used to compare
102
+ * against the last-known-good state tracked by the LastInstall flag.
103
+ * @param rushConfiguration - the configuration of the Rush repo to get the install
104
+ * state from
105
+ *
106
+ * @internal
107
+ */
108
+ static getCommonTempSplitFlag(rushConfiguration: RushConfiguration): LastInstallFlag;
72
109
  }
73
110
  //# sourceMappingURL=LastInstallFlag.d.ts.map
@@ -1,16 +1,12 @@
1
- import { LastInstallFlag } from './LastInstallFlag';
2
- import { RushConfiguration } from './RushConfiguration';
1
+ import { BaseFlag } from './base/BaseFlag';
2
+ import type { RushConfiguration } from './RushConfiguration';
3
3
  export declare const LAST_LINK_FLAG_FILE_NAME: string;
4
4
  /**
5
5
  * A helper class for managing the last-link flag, which is persistent and
6
6
  * indicates that linking was completed successfully.
7
7
  * @internal
8
8
  */
9
- export declare class LastLinkFlag extends LastInstallFlag {
10
- /**
11
- * @override
12
- */
13
- isValid(): boolean;
9
+ export declare class LastLinkFlag extends BaseFlag {
14
10
  /**
15
11
  * @override
16
12
  */
package/lib/api/Rush.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { IPackageJson, ITerminalProvider } from '@rushstack/node-core-library';
2
+ import '../utilities/SetRushLibPath';
2
3
  import { IBuiltInPluginConfiguration } from '../pluginFramework/PluginLoader/BuiltInPluginLoader';
3
4
  /**
4
5
  * Options to pass to the rush "launch" functions.
@@ -117,6 +117,15 @@ export interface IRushConfigurationJson {
117
117
  export interface ICurrentVariantJson {
118
118
  variant: string | JsonNull;
119
119
  }
120
+ /**
121
+ * The filter parameters to search from all projects.
122
+ */
123
+ export interface IRushConfigurationProjectsFilter {
124
+ /**
125
+ * If true, filter out projects that specify splitWorkspace as true.
126
+ */
127
+ splitWorkspace: boolean;
128
+ }
120
129
  /**
121
130
  * Options for `RushConfiguration.tryFindRushJsonLocation`.
122
131
  * @public
@@ -143,6 +152,8 @@ export declare class RushConfiguration {
143
152
  private _projects;
144
153
  private _projectsByName;
145
154
  private _projectsByTag;
155
+ private _filteredProjectsCache;
156
+ private _hasSplitWorkspaceProject;
146
157
  private _commonVersionsConfigurationsByVariant;
147
158
  /**
148
159
  * The name of the package manager being used to install dependencies
@@ -197,6 +208,12 @@ export declare class RushConfiguration {
197
208
  * Example: `C:\MyRepo\common\temp`
198
209
  */
199
210
  readonly commonTempFolder: string;
211
+ /**
212
+ * The folder where temporary files will be stored. This is always a subfolder called "temp"
213
+ * under the common folder.
214
+ * Example: `C:\MyRepo\common\temp-split`
215
+ */
216
+ readonly commonTempSplitFolder: string;
200
217
  /**
201
218
  * The folder where automation scripts are stored. This is always a subfolder called "scripts"
202
219
  * under the common folder.
@@ -251,6 +268,21 @@ export declare class RushConfiguration {
251
268
  * or `C:\MyRepo\common\temp\pnpm-lock-preinstall.yaml`
252
269
  */
253
270
  readonly tempShrinkwrapPreinstallFilename: string;
271
+ /**
272
+ * The filename (without any path) of the shrinkwrap file for split workspace that is used by the package manager.
273
+ * @remarks
274
+ * This property merely reports the filename; the file itself may not actually exist.
275
+ * Example: `pnpm-lock.yaml`
276
+ */
277
+ readonly splitWorkspaceShrinkwrapFilename: string;
278
+ /**
279
+ * The full path of the temporary shrinkwrap file for split workspace that is used during
280
+ * "rush install". This file may get rewritten by the package manager during installation.
281
+ * @remarks
282
+ * This property merely reports the filename; the file itself may not actually exist.
283
+ * Example: `C:\MyRepo\common\temp-split\pnpm-lock.yaml`
284
+ */
285
+ readonly tempSplitWorkspaceShrinkwrapFilename: string;
254
286
  /**
255
287
  * The filename of the variant dependency data file. By default this is
256
288
  * called 'current-variant.json' resides in the Rush common folder.
@@ -506,6 +538,11 @@ export declare class RushConfiguration {
506
538
  * @beta
507
539
  */
508
540
  get projectsByTag(): ReadonlyMap<string, ReadonlySet<RushConfigurationProject>>;
541
+ /**
542
+ * Search for projects according to filter
543
+ * @beta
544
+ */
545
+ getFilteredProjects(filter: IRushConfigurationProjectsFilter): RushConfigurationProject[];
509
546
  /**
510
547
  * Settings from the common-versions.json config file.
511
548
  * @remarks
@@ -524,6 +561,10 @@ export declare class RushConfiguration {
524
561
  * or "rush update".
525
562
  */
526
563
  get currentInstalledVariant(): string | undefined;
564
+ /**
565
+ * Is there any split workspace project.
566
+ */
567
+ get hasSplitWorkspaceProject(): boolean;
527
568
  /**
528
569
  * Gets the path to the common-versions.json config file for a specific variant.
529
570
  * @param variant - The name of the current variant in use by the active command.
@@ -556,6 +597,11 @@ export declare class RushConfiguration {
556
597
  * @param variant - The name of the current variant in use by the active command.
557
598
  */
558
599
  getCommittedShrinkwrapFilename(variant?: string | undefined): string;
600
+ /**
601
+ * Gets the committed shrinkwrap file name for split workspace.
602
+ * @param variant - The name of the current variant in use by the active command.
603
+ */
604
+ getCommittedSplitWorkspaceShrinkwrapFilename(): string;
559
605
  /**
560
606
  * Gets the absolute path for "pnpmfile.js" for a specific variant.
561
607
  * @param variant - The name of the current variant in use by the active command.
@@ -591,5 +637,11 @@ export declare class RushConfiguration {
591
637
  */
592
638
  tryGetProjectForPath(currentFolderPath: string): RushConfigurationProject | undefined;
593
639
  private _getVariantConfigFolderPath;
640
+ /**
641
+ * Split workspace can only works on PNPM with "useWorkspaces" enabled.
642
+ * The workspace project can NOT depend on a split workspace project.
643
+ * The split workspace project CAN depend on a workspace project.
644
+ */
645
+ private _validateSplitWorkspaceRelationships;
594
646
  }
595
647
  //# sourceMappingURL=RushConfiguration.d.ts.map
@@ -16,6 +16,7 @@ export interface IRushConfigurationProjectJson {
16
16
  skipRushCheck?: boolean;
17
17
  publishFolder?: string;
18
18
  tags?: string[];
19
+ splitWorkspace?: boolean;
19
20
  }
20
21
  /**
21
22
  * @internal
@@ -151,6 +152,11 @@ export declare class RushConfigurationProject {
151
152
  * @beta
152
153
  */
153
154
  readonly tags: ReadonlySet<string>;
155
+ /**
156
+ * Whether this project is a split workspace project.
157
+ * @beta
158
+ */
159
+ readonly splitWorkspace: boolean;
154
160
  /** @internal */
155
161
  constructor(options: IRushConfigurationProjectOptions);
156
162
  /**
@@ -0,0 +1,50 @@
1
+ import { JsonObject } from '@rushstack/node-core-library';
2
+ /**
3
+ * A base class for flag file.
4
+ * @internal
5
+ */
6
+ export declare class BaseFlag<T extends object = JsonObject> {
7
+ /**
8
+ * Flag file path
9
+ */
10
+ readonly path: string;
11
+ /**
12
+ * Content of the flag
13
+ */
14
+ protected _state: T;
15
+ /**
16
+ * Whether the current state is modified
17
+ */
18
+ protected _isModified: boolean;
19
+ /**
20
+ * Creates a new flag file
21
+ * @param folderPath - the folder that this flag is managing
22
+ * @param state - optional, the state that should be managed or compared
23
+ */
24
+ constructor(folderPath: string, state?: Partial<T>);
25
+ /**
26
+ * Returns true if the file exists and the contents match the current state.
27
+ */
28
+ isValid(): boolean;
29
+ /**
30
+ * Writes the flag file to disk with the current state
31
+ */
32
+ create(): void;
33
+ /**
34
+ * Merge new data into current state by lodash "merge"
35
+ */
36
+ mergeFromObject(data: JsonObject): void;
37
+ /**
38
+ * Writes the flag file to disk with the current state if modified
39
+ */
40
+ saveIfModified(): void;
41
+ /**
42
+ * Removes the flag file
43
+ */
44
+ clear(): void;
45
+ /**
46
+ * Returns Name of the flag file
47
+ */
48
+ protected get flagName(): string;
49
+ }
50
+ //# sourceMappingURL=BaseFlag.d.ts.map
@@ -0,0 +1 @@
1
+ module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("api/base/BaseFlag");
@@ -11,7 +11,21 @@ export declare class PnpmPackageManager extends PackageManager {
11
11
  * Example: `pnpmfile.js` or `.pnpmfile.cjs`
12
12
  */
13
13
  readonly pnpmfileFilename: string;
14
+ /**
15
+ * The filename of the shrinkwrap file of split workspace that is used by the package manager.
16
+ *
17
+ * @remarks
18
+ * Example: `.pnpmfile-split-workspace.cjs`
19
+ */
20
+ splitWorkspacePnpmfileFilename: string;
14
21
  /** @internal */
15
22
  constructor(version: string);
23
+ /**
24
+ * The filename of the global shrinkwrap file that is used by the package manager.
25
+ *
26
+ * @remarks
27
+ * Example: `global-pnpmfile.cjs`
28
+ */
29
+ get globalPnpmfileFilename(): string;
16
30
  }
17
31
  //# sourceMappingURL=PnpmPackageManager.d.ts.map
@@ -3,6 +3,13 @@ import type { IInstallManagerOptions } from '../../logic/base/BaseInstallManager
3
3
  import { RushCommandLineParser } from '../RushCommandLineParser';
4
4
  export declare class InstallAction extends BaseInstallAction {
5
5
  private readonly _checkOnlyParameter;
6
+ private _ignoreScriptsParameter;
7
+ /**
8
+ * Whether split workspace projects are included in install
9
+ *
10
+ * This parameter only supported when there is split workspace project
11
+ */
12
+ private _includeSplitWorkspaceParameter?;
6
13
  constructor(parser: RushCommandLineParser);
7
14
  protected buildInstallOptionsAsync(): Promise<IInstallManagerOptions>;
8
15
  }
@@ -34,6 +34,10 @@ export interface IJsonEntry {
34
34
  * @see {@link ../../api/RushConfigurationProject#RushConfigurationProject.tags | RushConfigurationProject.tags}
35
35
  */
36
36
  tags: string[];
37
+ /**
38
+ * @see {@link ../../api/RushConfigurationProject#RushConfigurationProject.splitWorkspace | RushConfigurationProject.splitWorkspace}
39
+ */
40
+ splitWorkspace: boolean;
37
41
  }
38
42
  export interface IJsonOutput {
39
43
  projects: IJsonEntry[];
@@ -4,6 +4,13 @@ import { RushCommandLineParser } from '../RushCommandLineParser';
4
4
  export declare class UpdateAction extends BaseInstallAction {
5
5
  private readonly _fullParameter;
6
6
  private readonly _recheckParameter;
7
+ private _ignoreScriptsParameter;
8
+ /**
9
+ * Whether split workspace projects are included in update
10
+ *
11
+ * This parameter only supported when there is split workspace project
12
+ */
13
+ private _includeSplitWorkspaceParameter?;
7
14
  constructor(parser: RushCommandLineParser);
8
15
  protected runAsync(): Promise<void>;
9
16
  protected buildInstallOptionsAsync(): Promise<IInstallManagerOptions>;
@@ -20,7 +20,15 @@ export declare class SelectionParameterSet {
20
20
  private readonly _fromVersionPolicy;
21
21
  private readonly _toVersionPolicy;
22
22
  private readonly _selectorParserByScope;
23
+ private readonly _selectors;
24
+ private _isSelectionSpecified;
23
25
  constructor(rushConfiguration: RushConfiguration, action: CommandLineParameterProvider, gitOptions: IGitSelectorParserOptions);
26
+ /**
27
+ * Check if any of the selection parameters have a value specified on the command line
28
+ *
29
+ * Returns true if specifying any selection parameters, otherwise false.
30
+ */
31
+ get isSelectionSpecified(): boolean;
24
32
  /**
25
33
  * Computes the set of selected projects based on all parameter values.
26
34
  *
@@ -28,14 +36,19 @@ export declare class SelectionParameterSet {
28
36
  */
29
37
  getSelectedProjectsAsync(terminal: ITerminal): Promise<Set<RushConfigurationProject>>;
30
38
  /**
31
- * Represents the selection as `--filter` parameters to pnpm.
39
+ * Represents the selection as `--filter` parameters to pnpm, and selected projects when partial install
32
40
  *
33
41
  * @remarks
34
42
  * This is a separate from the selection to allow the filters to be represented more concisely.
35
43
  *
36
- * @see https://pnpm.js.org/en/filtering
44
+ * @see https://pnpm.io/filtering
37
45
  */
38
- getPnpmFilterArgumentsAsync(terminal: ITerminal): Promise<string[]>;
46
+ getPnpmFilterArgumentsAsync(terminal: ITerminal): Promise<{
47
+ pnpmFilterArguments: string[];
48
+ splitWorkspacePnpmFilterArguments: string[];
49
+ selectedProjects: Set<RushConfigurationProject> | undefined;
50
+ hasSelectSplitWorkspaceProject: boolean;
51
+ }>;
39
52
  /**
40
53
  * Usage telemetry for selection parameters. Only saved locally, and if requested in the config.
41
54
  */
@@ -47,5 +60,6 @@ export declare class SelectionParameterSet {
47
60
  * Handles '.', unscoped names, and scoped names.
48
61
  */
49
62
  private _evaluateProjectParameterAsync;
63
+ toArguments(): string[];
50
64
  }
51
65
  //# sourceMappingURL=SelectionParameterSet.d.ts.map
package/lib/index.d.ts CHANGED
@@ -25,7 +25,8 @@ export { RepoStateFile } from './logic/RepoStateFile';
25
25
  export { LookupByPath } from './logic/LookupByPath';
26
26
  export { EventHooks, Event } from './api/EventHooks';
27
27
  export { ChangeManager } from './api/ChangeManager';
28
- export { LastInstallFlag as _LastInstallFlag, ILockfileValidityCheckOptions as _ILockfileValidityCheckOptions } from './api/LastInstallFlag';
28
+ export { LastInstallFlag as _LastInstallFlag, ILastInstallFlagJson as _ILastInstallFlagJson, ILockfileValidityCheckOptions as _ILockfileValidityCheckOptions } from './api/LastInstallFlag';
29
+ export { BaseFlag as _BaseFlag } from './api/base/BaseFlag';
29
30
  export { VersionPolicyDefinitionName, BumpType, LockStepVersionPolicy, IndividualVersionPolicy, VersionPolicy } from './api/VersionPolicy';
30
31
  export { VersionPolicyConfiguration } from './api/VersionPolicyConfiguration';
31
32
  export { ILaunchOptions, Rush } from './api/Rush';
@@ -9,6 +9,7 @@ export declare class PurgeManager {
9
9
  private _rushGlobalFolder;
10
10
  private _rushUserFolderRecycler;
11
11
  readonly commonTempFolderRecycler: AsyncRecycler;
12
+ readonly commonTempSplitFolderRecycler: AsyncRecycler;
12
13
  constructor(rushConfiguration: RushConfiguration, rushGlobalFolder: RushGlobalFolder);
13
14
  /**
14
15
  * Performs the AsyncRecycler.deleteAll() operation. This should be called before
@@ -43,6 +43,12 @@ export declare class RushConstants {
43
43
  * Example: `C:\MyRepo\common\temp`
44
44
  */
45
45
  static readonly rushTempFolderName: string;
46
+ /**
47
+ * The folder name ("temp-split") under the common folder, or under the .rush folder in each project's directory where
48
+ * temporary files will be stored.
49
+ * Example: `C:\MyRepo\common\temp-split`
50
+ */
51
+ static readonly rushTempSplitFolderName: string;
46
52
  /**
47
53
  * The folder name ("projects") where temporary projects will be stored.
48
54
  * Example: `C:\MyRepo\common\temp\projects`
@@ -1,3 +1,5 @@
1
+ import type { SelectionParameterSet } from '../../cli/parsing/SelectionParameterSet';
2
+ import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
1
3
  export interface IInstallManagerOptions {
2
4
  /**
3
5
  * Whether the global "--debug" flag was specified.
@@ -61,5 +63,26 @@ export interface IInstallManagerOptions {
61
63
  * Callback to invoke between preparing the common/temp folder and running installation.
62
64
  */
63
65
  beforeInstallAsync?: () => Promise<void>;
66
+ /**
67
+ * Whether to specify "--ignore-scripts" command-line parameter, which ignores
68
+ * install lifecycle scripts in package.json and its dependencies
69
+ */
70
+ ignoreScripts: boolean;
71
+ /**
72
+ * Whether to install for projects in split workspace
73
+ */
74
+ includeSplitWorkspace: boolean;
75
+ /**
76
+ * Filters to be passed to PNPM during installation for split workspace.
77
+ */
78
+ splitWorkspacePnpmFilterArguments: string[];
79
+ /**
80
+ * Selected projects during partial install.
81
+ */
82
+ selectedProjects?: Set<RushConfigurationProject>;
83
+ /**
84
+ * Selection parameters for partial install.
85
+ */
86
+ selectionParameters?: SelectionParameterSet;
64
87
  }
65
88
  //# sourceMappingURL=BaseInstallManagerTypes.d.ts.map
@@ -3,6 +3,7 @@ import { RushConfiguration } from '../../api/RushConfiguration';
3
3
  import { RushGlobalFolder } from '../../api/RushGlobalFolder';
4
4
  export declare class InstallHelpers {
5
5
  static generateCommonPackageJson(rushConfiguration: RushConfiguration, dependencies?: Map<string, string>): void;
6
+ static generateCommonSplitPackageJson(rushConfiguration: RushConfiguration): void;
6
7
  static getPackageManagerEnvironment(rushConfiguration: RushConfiguration, options?: {
7
8
  debug?: boolean;
8
9
  }): NodeJS.ProcessEnv;
@@ -1,5 +1,6 @@
1
1
  import type { LogBase } from '@pnpm/logger';
2
2
  import type { IPackageJson } from '@rushstack/node-core-library';
3
+ import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
3
4
  import type { IPnpmShrinkwrapYaml } from './PnpmShrinkwrapFile';
4
5
  /**
5
6
  * The `settings` parameter passed to {@link IPnpmfileShim.hooks.readPackage} and
@@ -19,6 +20,20 @@ export interface IPnpmfileShimSettings {
19
20
  workspaceVersions: Record<string, string>;
20
21
  userPnpmfilePath?: string;
21
22
  }
23
+ export interface IWorkspaceProjectInfo extends Pick<RushConfigurationProject, 'packageName' | 'projectRelativeFolder'> {
24
+ packageVersion: RushConfigurationProject['packageJson']['version'];
25
+ }
26
+ /**
27
+ * The `settings` parameter passed to {@link IPnpmfileShim.hooks.readPackage} and
28
+ * {@link IPnpmfileShim.hooks.afterAllResolved}.
29
+ */
30
+ export interface ISplitWorkspacePnpmfileShimSettings {
31
+ semverPath: string;
32
+ pathNormalizerPath: string;
33
+ workspaceProjects: Record<string, IWorkspaceProjectInfo>;
34
+ splitWorkspaceProjects: Record<string, IWorkspaceProjectInfo>;
35
+ userPnpmfilePath?: string;
36
+ }
22
37
  /**
23
38
  * The `context` parameter passed to {@link IPnpmfile.hooks.readPackage}, as defined by the
24
39
  * pnpmfile API contract.
@@ -26,6 +41,7 @@ export interface IPnpmfileShimSettings {
26
41
  export interface IPnpmfileContext {
27
42
  log: (message: string) => void;
28
43
  pnpmfileShimSettings?: IPnpmfileShimSettings;
44
+ splitWorkspacePnpmfileShimSettings?: ISplitWorkspacePnpmfileShimSettings;
29
45
  }
30
46
  /**
31
47
  * The `log` parameter passed to {@link IPnpmfile.hooks.filterLog}.
@@ -1,9 +1,15 @@
1
1
  import { BaseProjectShrinkwrapFile } from '../base/BaseProjectShrinkwrapFile';
2
2
  import { PnpmShrinkwrapFile } from './PnpmShrinkwrapFile';
3
+ import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
3
4
  /**
4
5
  *
5
6
  */
6
7
  export declare class PnpmProjectShrinkwrapFile extends BaseProjectShrinkwrapFile<PnpmShrinkwrapFile> {
8
+ /**
9
+ * When split workspace projects turn off shared-workspace-lockfiles, Pnpm creates individual
10
+ * shrinkwrap files for each project.
11
+ */
12
+ static generateIndividualProjectShrinkwrapAsync(project: RushConfigurationProject): Promise<void>;
7
13
  /**
8
14
  * Generate and write the project shrinkwrap file to <project>/.rush/temp/shrinkwrap-deps.json.
9
15
  * @returns True if the project shrinkwrap was created or updated, false otherwise.
@@ -16,6 +22,7 @@ export declare class PnpmProjectShrinkwrapFile extends BaseProjectShrinkwrapFile
16
22
  protected generateProjectShrinkwrapMap(): Map<string, string> | undefined;
17
23
  protected generateWorkspaceProjectShrinkwrapMap(): Map<string, string> | undefined;
18
24
  protected generateLegacyProjectShrinkwrapMap(): Map<string, string>;
25
+ protected generateIndividualProjectShrinkwrapMap(): Map<string, string>;
19
26
  private _addDependencyRecursive;
20
27
  private _resolveAndAddPeerDependencies;
21
28
  /**
@@ -4,6 +4,7 @@ import { RushConfiguration } from '../../api/RushConfiguration';
4
4
  import { IShrinkwrapFilePolicyValidatorOptions } from '../policy/ShrinkwrapFilePolicy';
5
5
  import { IExperimentsJson } from '../../api/ExperimentsConfiguration';
6
6
  import { RushConfigurationProject } from '../../api/RushConfigurationProject';
7
+ import { SplitWorkspacePnpmfileConfiguration } from './SplitWorkspacePnpmfileConfiguration';
7
8
  import { PnpmProjectShrinkwrapFile } from './PnpmProjectShrinkwrapFile';
8
9
  import { PackageManagerOptionsConfigurationBase } from '../base/BasePackageManagerOptionsConfiguration';
9
10
  export interface IPeerDependenciesMetaYaml {
@@ -91,6 +92,14 @@ export interface IPnpmShrinkwrapYaml {
91
92
  dependencies: {
92
93
  [dependency: string]: string;
93
94
  };
95
+ /** The list of resolved version numbers for develop dependencies */
96
+ devDependencies: {
97
+ [dependency: string]: string;
98
+ };
99
+ /** The list of resolved version numbers for optional dependencies */
100
+ optionalDependencies: {
101
+ [dependency: string]: string;
102
+ };
94
103
  /** The list of importers for local workspace projects */
95
104
  importers: {
96
105
  [relativePath: string]: IPnpmShrinkwrapImporterYaml;
@@ -105,6 +114,10 @@ export interface IPnpmShrinkwrapYaml {
105
114
  specifiers: {
106
115
  [dependency: string]: string;
107
116
  };
117
+ /** The list of override version number for dependencies */
118
+ overrides: {
119
+ [dependency: string]: string;
120
+ };
108
121
  }
109
122
  /**
110
123
  * Given an encoded "dependency key" from the PNPM shrinkwrap file, this parses it into an equivalent
@@ -117,15 +130,23 @@ export declare class PnpmShrinkwrapFile extends BaseShrinkwrapFile {
117
130
  readonly isWorkspaceCompatible: boolean;
118
131
  readonly registry: string;
119
132
  readonly dependencies: ReadonlyMap<string, string>;
133
+ readonly devDependencies: ReadonlyMap<string, string>;
134
+ readonly optionalDependencies: ReadonlyMap<string, string>;
120
135
  readonly importers: ReadonlyMap<string, IPnpmShrinkwrapImporterYaml>;
121
136
  readonly specifiers: ReadonlyMap<string, string>;
122
137
  readonly packages: ReadonlyMap<string, IPnpmShrinkwrapDependencyYaml>;
138
+ readonly overrides: ReadonlyMap<string, string>;
123
139
  private readonly _shrinkwrapJson;
124
140
  private readonly _integrities;
125
141
  private _pnpmfileConfiguration;
142
+ private _splitWorkspaceGlobalPnpmfileConfiguration;
143
+ private _individualPackageName;
144
+ private _individualShrinkwrapImporter;
126
145
  private constructor();
127
146
  static loadFromFile(shrinkwrapYamlFilename: string): PnpmShrinkwrapFile | undefined;
128
147
  static loadFromString(shrinkwrapContent: string): PnpmShrinkwrapFile;
148
+ setIndividualPackage(packageName: string, splitWorkspaceGlobalPnpmfileConfiguration?: SplitWorkspacePnpmfileConfiguration): void;
149
+ get isIndividual(): boolean;
129
150
  getShrinkwrapHash(experimentsConfig?: IExperimentsJson): string;
130
151
  /** @override */
131
152
  validate(packageManagerOptionsConfig: PackageManagerOptionsConfigurationBase, policyOptions: IShrinkwrapFilePolicyValidatorOptions, experimentsConfig?: IExperimentsJson): void;
@@ -192,8 +213,12 @@ export declare class PnpmShrinkwrapFile extends BaseShrinkwrapFile {
192
213
  getImporterKeyByPath(workspaceRoot: string, projectFolder: string): string;
193
214
  getImporter(importerKey: string): IPnpmShrinkwrapImporterYaml | undefined;
194
215
  getIntegrityForImporter(importerKey: string): Map<string, string> | undefined;
216
+ getIntegrityForIndividualProject(): Map<string, string>;
195
217
  /** @override */
196
218
  isWorkspaceProjectModifiedAsync(project: RushConfigurationProject, variant?: string): Promise<boolean>;
219
+ isSplitWorkspaceProjectModified(project: RushConfigurationProject): boolean;
220
+ isSplitWorkspaceIndividualProjectModified(project: RushConfigurationProject): boolean;
221
+ private _isProjectModified;
197
222
  private _getIntegrityForPackage;
198
223
  private _addIntegrities;
199
224
  /**
@@ -203,5 +228,6 @@ export declare class PnpmShrinkwrapFile extends BaseShrinkwrapFile {
203
228
  private _getPackageId;
204
229
  private _parsePnpmDependencyKey;
205
230
  private _serializeInternal;
231
+ private _getIndividualShrinkwrapImporter;
206
232
  }
207
233
  //# sourceMappingURL=PnpmShrinkwrapFile.d.ts.map
@@ -0,0 +1,3 @@
1
+ import type { IPnpmfileHooks } from './IPnpmfile';
2
+ export declare const hooks: IPnpmfileHooks;
3
+ //# sourceMappingURL=SplitWorkspaceGlobalPnpmfileShim.d.ts.map
@@ -0,0 +1 @@
1
+ module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/pnpm/SplitWorkspaceGlobalPnpmfileShim");
@@ -0,0 +1,23 @@
1
+ import { IPackageJson } from '@rushstack/node-core-library';
2
+ import type { RushConfiguration } from '../../api/RushConfiguration';
3
+ /**
4
+ * Loads PNPM's pnpmfile.js configuration, and invokes it to preprocess package.json files,
5
+ * optionally utilizing a pnpmfile shim to inject preferred versions.
6
+ */
7
+ export declare class SplitWorkspacePnpmfileConfiguration {
8
+ private _context;
9
+ constructor(rushConfiguration: RushConfiguration);
10
+ /**
11
+ * Split workspace use global pnpmfile, because in split workspace, user may set `shared-workspace-lockfile=false`.
12
+ * That means each project owns their individual pnpmfile under project folder. While the global pnpmfile could be
13
+ * under the common/temp-split/ folder and be used by all split workspace projects.
14
+ */
15
+ static writeCommonTempSplitGlobalPnpmfileAsync(rushConfiguration: RushConfiguration): Promise<void>;
16
+ private static _getSplitWorkspacePnpmfileShimSettings;
17
+ /**
18
+ * Transform a package.json file using the pnpmfile.js hook.
19
+ * @returns the tranformed object, or the original input if pnpmfile.js was not found.
20
+ */
21
+ transform(packageJson: IPackageJson): IPackageJson;
22
+ }
23
+ //# sourceMappingURL=SplitWorkspacePnpmfileConfiguration.d.ts.map
@@ -0,0 +1 @@
1
+ module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/pnpm/SplitWorkspacePnpmfileConfiguration");
@@ -0,0 +1,10 @@
1
+ import type { RushConfiguration } from '../../api/RushConfiguration';
2
+ import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
3
+ import type { IEvaluateSelectorOptions, ISelectorParser } from './ISelectorParser';
4
+ export declare class SplitWorkspaceProjectSelectorParser implements ISelectorParser<RushConfigurationProject> {
5
+ private readonly _rushConfiguration;
6
+ constructor(rushConfiguration: RushConfiguration);
7
+ evaluateSelectorAsync({ unscopedSelector, terminal, parameterName }: IEvaluateSelectorOptions): Promise<Iterable<RushConfigurationProject>>;
8
+ getCompletions(): Iterable<string>;
9
+ }
10
+ //# sourceMappingURL=SplitWorkspaceProjectSelectorParser.d.ts.map
@@ -0,0 +1 @@
1
+ module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/selectors/SplitWorkspaceProjectSelectorParser");
@@ -4,8 +4,10 @@ import { RushConfigurationProject } from '../../api/RushConfigurationProject';
4
4
  export declare class VersionMismatchFinderProject extends VersionMismatchFinderEntity {
5
5
  packageName: string;
6
6
  private _fileManager;
7
+ private _project;
7
8
  constructor(project: RushConfigurationProject);
8
9
  get filePath(): string;
10
+ get project(): RushConfigurationProject;
9
11
  get allDependencies(): ReadonlyArray<PackageJsonDependency>;
10
12
  tryGetDependency(packageName: string): PackageJsonDependency | undefined;
11
13
  tryGetDevDependency(packageName: string): PackageJsonDependency | undefined;
@@ -11,6 +11,7 @@ export declare const assetsFolderPath: string;
11
11
  */
12
12
  export declare const scriptsFolderName: string;
13
13
  export declare const pnpmfileShimFilename: string;
14
+ export declare const splitWorkspacePnpmfileShimFilename: string;
14
15
  export declare const installRunScriptFilename: string;
15
16
  export declare const installRunRushScriptFilename: string;
16
17
  export declare const installRunRushxScriptFilename: string;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=SetRushLibPath.d.ts.map
@@ -0,0 +1 @@
1
+ module.exports = require("../../lib-shim/index")._rushSdk_loadInternalModule("utilities/SetRushLibPath");
@@ -11,5 +11,5 @@ export interface ILogger {
11
11
  * @returns
12
12
  * The text of the the synced .npmrc, if one exists. If one does not exist, then undefined is returned.
13
13
  */
14
- export declare function syncNpmrc(sourceNpmrcFolder: string, targetNpmrcFolder: string, useNpmrcPublish?: boolean, logger?: ILogger): string | undefined;
14
+ export declare function syncNpmrc(sourceNpmrcFolder: string, targetNpmrcFolder: string, useNpmrcPublish?: boolean, sourceNpmrcFilename?: string, logger?: ILogger): string | undefined;
15
15
  //# sourceMappingURL=npmrcUtilities.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAuLA;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAO1E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAkNA;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAO1E"}
package/lib-shim/index.js CHANGED
@@ -48,7 +48,9 @@ function _require(moduleName) {
48
48
  }
49
49
  // SCENARIO 1: Rush's PluginManager has initialized "rush-sdk" with Rush's own instance of rush-lib.
50
50
  // The Rush host process will assign "global.___rush___rushLibModule" before loading the plugin.
51
- let rushLibModule = global.___rush___rushLibModule || global.___rush___rushLibModuleFromInstallAndRunRush;
51
+ let rushLibModule = global.___rush___rushLibModule ||
52
+ global.___rush___rushLibModuleFromEnvironment ||
53
+ global.___rush___rushLibModuleFromInstallAndRunRush;
52
54
  let errorMessage = '';
53
55
  // SCENARIO 2: The project importing "rush-sdk" has installed its own instance of "rush-lib"
54
56
  // as a package.json dependency. For example, this is used by the Jest tests for Rush plugins.
@@ -84,7 +86,28 @@ if (rushLibModule === undefined) {
84
86
  }
85
87
  }
86
88
  }
87
- // SCENARIO 3: A tool or script depends on "rush-sdk", and is meant to be used inside a monorepo folder.
89
+ // SCENARIO 3: A tool or script has been invoked as a child process by an instance of "rush-lib" and can use the
90
+ // version that invoked it. In this case, use process.env._RUSH_LIB_PATH to find "rush-lib".
91
+ if (rushLibModule === undefined) {
92
+ const rushLibVariable = '_RUSH_LIB_PATH';
93
+ const rushLibPath = process.env[rushLibVariable];
94
+ if (rushLibPath) {
95
+ terminal.writeVerboseLine(`Try to load ${RUSH_LIB_NAME} from process.env.${rushLibVariable} from caller package`);
96
+ try {
97
+ rushLibModule = _require(rushLibPath);
98
+ }
99
+ catch (error) {
100
+ // Log this as a warning, since it is unexpected to define an incorrect value of the variable.
101
+ terminal.writeWarningLine(`Failed to load ${RUSH_LIB_NAME} via process.env.${rushLibVariable}`);
102
+ }
103
+ if (rushLibModule !== undefined) {
104
+ // to track which scenario is active and how it got initialized.
105
+ global.___rush___rushLibModuleFromEnvironment = rushLibModule;
106
+ terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} from process.env.${rushLibVariable}`);
107
+ }
108
+ }
109
+ }
110
+ // SCENARIO 4: A standalone tool or script depends on "rush-sdk", and is meant to be used inside a monorepo folder.
88
111
  // In this case, we can use install-run-rush.js to obtain the appropriate rush-lib version for the monorepo.
89
112
  if (rushLibModule === undefined) {
90
113
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;AA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,EAAE,CAAC,EAAE;QACnC,MAAM,gBAAgB,GAAW,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;QAEvE,IAAI,8BAAU,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE;YACvC,OAAO,gBAAgB,CAAC;SACzB;QAED,MAAM,YAAY,GAAW,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QACzD,IAAI,YAAY,KAAK,aAAa,EAAE;YAClC,MAAM;SACP;QAED,aAAa,GAAG,YAAY,CAAC;KAC9B;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'path';\nimport {\n JsonFile,\n JsonObject,\n Import,\n IPackageJson,\n PackageJsonLookup,\n Executable,\n FileSystem,\n Terminal,\n ConsoleTerminalProvider\n} from '@rushstack/node-core-library';\nimport type { SpawnSyncReturns } from 'child_process';\n\nconst RUSH_LIB_NAME: string = '@microsoft/rush-lib';\n\nconst verboseEnabled: boolean = typeof process !== 'undefined' && process.env.RUSH_SDK_DEBUG === '1';\nconst terminal: Terminal = new Terminal(\n new ConsoleTerminalProvider({\n verboseEnabled\n })\n);\n\ntype RushLibModuleType = Record<string, unknown>;\ndeclare const global: NodeJS.Global &\n typeof globalThis & {\n ___rush___rushLibModule?: RushLibModuleType;\n ___rush___rushLibModuleFromInstallAndRunRush?: RushLibModuleType;\n };\n\nfunction _require<TResult>(moduleName: string): TResult {\n if (typeof __non_webpack_require__ === 'function') {\n // If this library has been bundled with Webpack, we need to call the real `require` function\n // that doesn't get turned into a `__webpack_require__` statement.\n // `__non_webpack_require__` is a Webpack macro that gets turned into a `require` statement\n // during bundling.\n return __non_webpack_require__(moduleName);\n } else {\n return require(moduleName);\n }\n}\n\n// SCENARIO 1: Rush's PluginManager has initialized \"rush-sdk\" with Rush's own instance of rush-lib.\n// The Rush host process will assign \"global.___rush___rushLibModule\" before loading the plugin.\nlet rushLibModule: RushLibModuleType | undefined =\n global.___rush___rushLibModule || global.___rush___rushLibModuleFromInstallAndRunRush;\nlet errorMessage: string = '';\n\n// SCENARIO 2: The project importing \"rush-sdk\" has installed its own instance of \"rush-lib\"\n// as a package.json dependency. For example, this is used by the Jest tests for Rush plugins.\nif (rushLibModule === undefined) {\n const importingPath: string | null | undefined = module?.parent?.filename;\n if (importingPath) {\n const callerPackageFolder: string | undefined =\n PackageJsonLookup.instance.tryGetPackageFolderFor(importingPath);\n\n if (callerPackageFolder !== undefined) {\n const callerPackageJson: IPackageJson = _require(path.join(callerPackageFolder, 'package.json'));\n\n // Does the caller properly declare a dependency on rush-lib?\n if (\n (callerPackageJson.dependencies && callerPackageJson.dependencies[RUSH_LIB_NAME] !== undefined) ||\n (callerPackageJson.devDependencies &&\n callerPackageJson.devDependencies[RUSH_LIB_NAME] !== undefined) ||\n (callerPackageJson.peerDependencies &&\n callerPackageJson.peerDependencies[RUSH_LIB_NAME] !== undefined)\n ) {\n // Try to resolve rush-lib from the caller's folder\n terminal.writeVerboseLine(`Try to load ${RUSH_LIB_NAME} from caller package`);\n try {\n rushLibModule = requireRushLibUnderFolderPath(callerPackageFolder);\n } catch (error) {\n // If we fail to resolve it, ignore the error\n terminal.writeVerboseLine(`Failed to load ${RUSH_LIB_NAME} from caller package`);\n }\n\n // If two different libraries invoke `rush-sdk`, and one of them provides \"rush-lib\"\n // then the first version to be loaded wins. We do not support side-by-side instances of \"rush-lib\".\n if (rushLibModule !== undefined) {\n // to track which scenario is active and how it got initialized.\n global.___rush___rushLibModule = rushLibModule;\n terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} from caller`);\n }\n }\n }\n }\n}\n\n// SCENARIO 3: A tool or script depends on \"rush-sdk\", and is meant to be used inside a monorepo folder.\n// In this case, we can use install-run-rush.js to obtain the appropriate rush-lib version for the monorepo.\nif (rushLibModule === undefined) {\n try {\n const rushJsonPath: string | undefined = tryFindRushJsonLocation(process.cwd());\n if (!rushJsonPath) {\n throw new Error(\n 'Unable to find rush.json in the current folder or its parent folders.\\n' +\n 'This tool is meant to be invoked from a working directory inside a Rush repository.'\n );\n }\n const monorepoRoot: string = path.dirname(rushJsonPath);\n\n const rushJson: JsonObject = JsonFile.load(rushJsonPath);\n const { rushVersion } = rushJson;\n\n const installRunNodeModuleFolder: string = path.join(\n monorepoRoot,\n `common/temp/install-run/@microsoft+rush@${rushVersion}`\n );\n\n try {\n // First, try to load the version of \"rush-lib\" that was installed by install-run-rush.js\n terminal.writeVerboseLine(`Trying to load ${RUSH_LIB_NAME} installed by install-run-rush`);\n rushLibModule = requireRushLibUnderFolderPath(installRunNodeModuleFolder);\n } catch (e) {\n let installAndRunRushStderrContent: string = '';\n try {\n const installAndRunRushJSPath: string = path.join(monorepoRoot, 'common/scripts/install-run-rush.js');\n\n terminal.writeLine('The Rush engine has not been installed yet. Invoking install-run-rush.js...');\n\n const installAndRuhRushProcess: SpawnSyncReturns<string> = Executable.spawnSync(\n 'node',\n [installAndRunRushJSPath, '--help'],\n {\n stdio: 'pipe'\n }\n );\n\n installAndRunRushStderrContent = installAndRuhRushProcess.stderr;\n if (installAndRuhRushProcess.status !== 0) {\n throw new Error(`The ${RUSH_LIB_NAME} package failed to install`);\n }\n\n // Retry to load \"rush-lib\" after install-run-rush run\n terminal.writeVerboseLine(\n `Trying to load ${RUSH_LIB_NAME} installed by install-run-rush a second time`\n );\n rushLibModule = requireRushLibUnderFolderPath(installRunNodeModuleFolder);\n } catch (e) {\n console.error(`${installAndRunRushStderrContent}`);\n throw new Error(`The ${RUSH_LIB_NAME} package failed to load`);\n }\n }\n\n if (rushLibModule !== undefined) {\n // to track which scenario is active and how it got initialized.\n global.___rush___rushLibModuleFromInstallAndRunRush = rushLibModule;\n terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} installed by install-run-rush`);\n }\n } catch (e) {\n // no-catch\n errorMessage = (e as Error).message;\n }\n}\n\nif (rushLibModule === undefined) {\n // This error indicates that a project is trying to import \"@rushstack/rush-sdk\", but the Rush engine\n // instance cannot be found. If you are writing Jest tests for a Rush plugin, add \"@microsoft/rush-lib\"\n // to the devDependencies for your project.\n console.error(`Error: The @rushstack/rush-sdk package was not able to load the Rush engine:\n${errorMessage}\n`);\n process.exit(1);\n}\n\n// Based on TypeScript's __exportStar()\nfor (const property in rushLibModule) {\n if (property !== 'default' && !exports.hasOwnProperty(property)) {\n const rushLibModuleForClosure: RushLibModuleType = rushLibModule;\n\n // Based on TypeScript's __createBinding()\n Object.defineProperty(exports, property, {\n enumerable: true,\n get: function () {\n return rushLibModuleForClosure[property];\n }\n });\n }\n}\n\n/**\n * Used by the .js stubs for path-based imports of `@microsoft/rush-lib` internal APIs.\n */\nexport function _rushSdk_loadInternalModule(srcImportPath: string): unknown {\n if (!exports._RushInternals) {\n throw new Error(\n `Rush version ${exports.Rush.version} does not support internal API imports via rush-sdk`\n );\n }\n return exports._RushInternals.loadModule(srcImportPath);\n}\n\n/**\n * Require `@microsoft/rush-lib` under the specified folder path.\n */\nfunction requireRushLibUnderFolderPath(folderPath: string): RushLibModuleType {\n const rushLibModulePath: string = Import.resolveModule({\n modulePath: RUSH_LIB_NAME,\n baseFolderPath: folderPath\n });\n\n return _require(rushLibModulePath);\n}\n\n/**\n * Find the rush.json location and return the path, or undefined if a rush.json can't be found.\n *\n * @privateRemarks\n * Keep this in sync with `RushConfiguration.tryFindRushJsonLocation`.\n */\nfunction tryFindRushJsonLocation(startingFolder: string): string | undefined {\n let currentFolder: string = startingFolder;\n\n // Look upwards at parent folders until we find a folder containing rush.json\n for (let i: number = 0; i < 10; ++i) {\n const rushJsonFilename: string = path.join(currentFolder, 'rush.json');\n\n if (FileSystem.exists(rushJsonFilename)) {\n return rushJsonFilename;\n }\n\n const parentFolder: string = path.dirname(currentFolder);\n if (parentFolder === currentFolder) {\n break;\n }\n\n currentFolder = parentFolder;\n }\n\n return undefined;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceR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E in the project root for license information.\n\nimport * as path from 'path';\nimport {\n JsonFile,\n JsonObject,\n Import,\n IPackageJson,\n PackageJsonLookup,\n Executable,\n FileSystem,\n Terminal,\n ConsoleTerminalProvider\n} from '@rushstack/node-core-library';\nimport type { SpawnSyncReturns } from 'child_process';\n\nconst RUSH_LIB_NAME: '@microsoft/rush-lib' = '@microsoft/rush-lib';\n\nconst verboseEnabled: boolean = typeof process !== 'undefined' && process.env.RUSH_SDK_DEBUG === '1';\nconst terminal: Terminal = new Terminal(\n new ConsoleTerminalProvider({\n verboseEnabled\n })\n);\n\ntype RushLibModuleType = Record<string, unknown>;\ndeclare const global: NodeJS.Global &\n typeof globalThis & {\n ___rush___rushLibModule?: RushLibModuleType;\n ___rush___rushLibModuleFromEnvironment?: RushLibModuleType;\n ___rush___rushLibModuleFromInstallAndRunRush?: RushLibModuleType;\n };\n\nfunction _require<TResult>(moduleName: string): TResult {\n if (typeof __non_webpack_require__ === 'function') {\n // If this library has been bundled with Webpack, we need to call the real `require` function\n // that doesn't get turned into a `__webpack_require__` statement.\n // `__non_webpack_require__` is a Webpack macro that gets turned into a `require` statement\n // during bundling.\n return __non_webpack_require__(moduleName);\n } else {\n return require(moduleName);\n }\n}\n\n// SCENARIO 1: Rush's PluginManager has initialized \"rush-sdk\" with Rush's own instance of rush-lib.\n// The Rush host process will assign \"global.___rush___rushLibModule\" before loading the plugin.\nlet rushLibModule: RushLibModuleType | undefined =\n global.___rush___rushLibModule ||\n global.___rush___rushLibModuleFromEnvironment ||\n global.___rush___rushLibModuleFromInstallAndRunRush;\nlet errorMessage: string = '';\n\n// SCENARIO 2: The project importing \"rush-sdk\" has installed its own instance of \"rush-lib\"\n// as a package.json dependency. For example, this is used by the Jest tests for Rush plugins.\nif (rushLibModule === undefined) {\n const importingPath: string | null | undefined = module?.parent?.filename;\n if (importingPath) {\n const callerPackageFolder: string | undefined =\n PackageJsonLookup.instance.tryGetPackageFolderFor(importingPath);\n\n if (callerPackageFolder !== undefined) {\n const callerPackageJson: IPackageJson = _require(path.join(callerPackageFolder, 'package.json'));\n\n // Does the caller properly declare a dependency on rush-lib?\n if (\n (callerPackageJson.dependencies && callerPackageJson.dependencies[RUSH_LIB_NAME] !== undefined) ||\n (callerPackageJson.devDependencies &&\n callerPackageJson.devDependencies[RUSH_LIB_NAME] !== undefined) ||\n (callerPackageJson.peerDependencies &&\n callerPackageJson.peerDependencies[RUSH_LIB_NAME] !== undefined)\n ) {\n // Try to resolve rush-lib from the caller's folder\n terminal.writeVerboseLine(`Try to load ${RUSH_LIB_NAME} from caller package`);\n try {\n rushLibModule = requireRushLibUnderFolderPath(callerPackageFolder);\n } catch (error) {\n // If we fail to resolve it, ignore the error\n terminal.writeVerboseLine(`Failed to load ${RUSH_LIB_NAME} from caller package`);\n }\n\n // If two different libraries invoke `rush-sdk`, and one of them provides \"rush-lib\"\n // then the first version to be loaded wins. We do not support side-by-side instances of \"rush-lib\".\n if (rushLibModule !== undefined) {\n // to track which scenario is active and how it got initialized.\n global.___rush___rushLibModule = rushLibModule;\n terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} from caller`);\n }\n }\n }\n }\n}\n\n// SCENARIO 3: A tool or script has been invoked as a child process by an instance of \"rush-lib\" and can use the\n// version that invoked it. In this case, use process.env._RUSH_LIB_PATH to find \"rush-lib\".\nif (rushLibModule === undefined) {\n const rushLibVariable: '_RUSH_LIB_PATH' = '_RUSH_LIB_PATH';\n const rushLibPath: string | undefined = process.env[rushLibVariable];\n if (rushLibPath) {\n terminal.writeVerboseLine(\n `Try to load ${RUSH_LIB_NAME} from process.env.${rushLibVariable} from caller package`\n );\n try {\n rushLibModule = _require(rushLibPath);\n } catch (error) {\n // Log this as a warning, since it is unexpected to define an incorrect value of the variable.\n terminal.writeWarningLine(`Failed to load ${RUSH_LIB_NAME} via process.env.${rushLibVariable}`);\n }\n\n if (rushLibModule !== undefined) {\n // to track which scenario is active and how it got initialized.\n global.___rush___rushLibModuleFromEnvironment = rushLibModule;\n terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} from process.env.${rushLibVariable}`);\n }\n }\n}\n\n// SCENARIO 4: A standalone tool or script depends on \"rush-sdk\", and is meant to be used inside a monorepo folder.\n// In this case, we can use install-run-rush.js to obtain the appropriate rush-lib version for the monorepo.\nif (rushLibModule === undefined) {\n try {\n const rushJsonPath: string | undefined = tryFindRushJsonLocation(process.cwd());\n if (!rushJsonPath) {\n throw new Error(\n 'Unable to find rush.json in the current folder or its parent folders.\\n' +\n 'This tool is meant to be invoked from a working directory inside a Rush repository.'\n );\n }\n const monorepoRoot: string = path.dirname(rushJsonPath);\n\n const rushJson: JsonObject = JsonFile.load(rushJsonPath);\n const { rushVersion } = rushJson;\n\n const installRunNodeModuleFolder: string = path.join(\n monorepoRoot,\n `common/temp/install-run/@microsoft+rush@${rushVersion}`\n );\n\n try {\n // First, try to load the version of \"rush-lib\" that was installed by install-run-rush.js\n terminal.writeVerboseLine(`Trying to load ${RUSH_LIB_NAME} installed by install-run-rush`);\n rushLibModule = requireRushLibUnderFolderPath(installRunNodeModuleFolder);\n } catch (e) {\n let installAndRunRushStderrContent: string = '';\n try {\n const installAndRunRushJSPath: string = path.join(monorepoRoot, 'common/scripts/install-run-rush.js');\n\n terminal.writeLine('The Rush engine has not been installed yet. Invoking install-run-rush.js...');\n\n const installAndRuhRushProcess: SpawnSyncReturns<string> = Executable.spawnSync(\n 'node',\n [installAndRunRushJSPath, '--help'],\n {\n stdio: 'pipe'\n }\n );\n\n installAndRunRushStderrContent = installAndRuhRushProcess.stderr;\n if (installAndRuhRushProcess.status !== 0) {\n throw new Error(`The ${RUSH_LIB_NAME} package failed to install`);\n }\n\n // Retry to load \"rush-lib\" after install-run-rush run\n terminal.writeVerboseLine(\n `Trying to load ${RUSH_LIB_NAME} installed by install-run-rush a second time`\n );\n rushLibModule = requireRushLibUnderFolderPath(installRunNodeModuleFolder);\n } catch (e) {\n console.error(`${installAndRunRushStderrContent}`);\n throw new Error(`The ${RUSH_LIB_NAME} package failed to load`);\n }\n }\n\n if (rushLibModule !== undefined) {\n // to track which scenario is active and how it got initialized.\n global.___rush___rushLibModuleFromInstallAndRunRush = rushLibModule;\n terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} installed by install-run-rush`);\n }\n } catch (e) {\n // no-catch\n errorMessage = (e as Error).message;\n }\n}\n\nif (rushLibModule === undefined) {\n // This error indicates that a project is trying to import \"@rushstack/rush-sdk\", but the Rush engine\n // instance cannot be found. If you are writing Jest tests for a Rush plugin, add \"@microsoft/rush-lib\"\n // to the devDependencies for your project.\n console.error(`Error: The @rushstack/rush-sdk package was not able to load the Rush engine:\n${errorMessage}\n`);\n process.exit(1);\n}\n\n// Based on TypeScript's __exportStar()\nfor (const property in rushLibModule) {\n if (property !== 'default' && !exports.hasOwnProperty(property)) {\n const rushLibModuleForClosure: RushLibModuleType = rushLibModule;\n\n // Based on TypeScript's __createBinding()\n Object.defineProperty(exports, property, {\n enumerable: true,\n get: function () {\n return rushLibModuleForClosure[property];\n }\n });\n }\n}\n\n/**\n * Used by the .js stubs for path-based imports of `@microsoft/rush-lib` internal APIs.\n */\nexport function _rushSdk_loadInternalModule(srcImportPath: string): unknown {\n if (!exports._RushInternals) {\n throw new Error(\n `Rush version ${exports.Rush.version} does not support internal API imports via rush-sdk`\n );\n }\n return exports._RushInternals.loadModule(srcImportPath);\n}\n\n/**\n * Require `@microsoft/rush-lib` under the specified folder path.\n */\nfunction requireRushLibUnderFolderPath(folderPath: string): RushLibModuleType {\n const rushLibModulePath: string = Import.resolveModule({\n modulePath: RUSH_LIB_NAME,\n baseFolderPath: folderPath\n });\n\n return _require(rushLibModulePath);\n}\n\n/**\n * Find the rush.json location and return the path, or undefined if a rush.json can't be found.\n *\n * @privateRemarks\n * Keep this in sync with `RushConfiguration.tryFindRushJsonLocation`.\n */\nfunction tryFindRushJsonLocation(startingFolder: string): string | undefined {\n let currentFolder: string = startingFolder;\n\n // Look upwards at parent folders until we find a folder containing rush.json\n for (let i: number = 0; i < 10; ++i) {\n const rushJsonFilename: string = path.join(currentFolder, 'rush.json');\n\n if (FileSystem.exists(rushJsonFilename)) {\n return rushJsonFilename;\n }\n\n const parentFolder: string = path.dirname(currentFolder);\n if (parentFolder === currentFolder) {\n break;\n }\n\n currentFolder = parentFolder;\n }\n\n return undefined;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/rush-sdk",
3
- "version": "5.92.0",
3
+ "version": "5.93.1-pr3481.17",
4
4
  "description": "An API for interacting with the Rush engine",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,10 +17,10 @@
17
17
  "@rushstack/node-core-library": "3.55.2"
18
18
  },
19
19
  "devDependencies": {
20
+ "@microsoft/rush-lib": "5.93.1-pr3481.17",
20
21
  "@types/heft-jest": "1.0.1",
21
22
  "@types/semver": "7.3.5",
22
23
  "@types/webpack-env": "1.18.0",
23
- "@microsoft/rush-lib": "5.92.0",
24
24
  "@rushstack/eslint-config": "3.2.0",
25
25
  "@rushstack/heft": "0.49.7",
26
26
  "@rushstack/heft-node-rig": "1.12.4",