@rushstack/rush-sdk 5.105.0 → 5.107.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.
@@ -376,7 +376,17 @@ export declare class CredentialCache {
376
376
  *
377
377
  * @beta
378
378
  */
379
- export declare type CustomTipId = 'TIP_RUSH_INCONSISTENT_VERSIONS' | string;
379
+ export declare enum CustomTipId {
380
+ TIP_RUSH_INCONSISTENT_VERSIONS = "TIP_RUSH_INCONSISTENT_VERSIONS",
381
+ TIP_PNPM_UNEXPECTED_STORE = "TIP_PNPM_UNEXPECTED_STORE",
382
+ TIP_PNPM_NO_MATCHING_VERSION = "TIP_PNPM_NO_MATCHING_VERSION",
383
+ TIP_PNPM_NO_MATCHING_VERSION_INSIDE_WORKSPACE = "TIP_PNPM_NO_MATCHING_VERSION_INSIDE_WORKSPACE",
384
+ TIP_PNPM_PEER_DEP_ISSUES = "TIP_PNPM_PEER_DEP_ISSUES",
385
+ TIP_PNPM_OUTDATED_LOCKFILE = "TIP_PNPM_OUTDATED_LOCKFILE",
386
+ TIP_PNPM_TARBALL_INTEGRITY = "TIP_PNPM_TARBALL_INTEGRITY",
387
+ TIP_PNPM_MISMATCHED_RELEASE_CHANNEL = "TIP_PNPM_MISMATCHED_RELEASE_CHANNEL",
388
+ TIP_PNPM_INVALID_NODE_VERSION = "TIP_PNPM_INVALID_NODE_VERSION"
389
+ }
380
390
 
381
391
  /**
382
392
  * Used to access the `common/config/rush/custom-tips.json` config file,
@@ -386,34 +396,83 @@ export declare type CustomTipId = 'TIP_RUSH_INCONSISTENT_VERSIONS' | string;
386
396
  */
387
397
  export declare class CustomTipsConfiguration {
388
398
  private static _jsonSchema;
389
- private readonly _tipMap;
390
- private readonly _jsonFileName;
399
+ readonly providedCustomTipsByTipId: ReadonlyMap<CustomTipId, ICustomTipItemJson>;
391
400
  /**
392
- * The JSON settings loaded from `custom-tips.json`.
401
+ * A registry mapping custom tip IDs to their corresponding metadata.
402
+ *
403
+ * @remarks
404
+ * This registry is used to look up metadata for custom tips based on their IDs. The metadata includes
405
+ * information such as the severity level, the type of tip, and an optional matching function.
406
+ *
407
+ * Each key in the registry corresponds to a `CustomTipIdEnum` value, and each value is an object
408
+ * implementing the `ICustomTipInfo` interface.
409
+ *
410
+ * @example
411
+ * ```typescript
412
+ * const tipInfo = CustomTipsConfiguration.customTipRegistry[CustomTipIdEnum.TIP_RUSH_INCONSISTENT_VERSIONS];
413
+ * console.log(tipInfo.severity); // Output: CustomTipSeverity.Error
414
+ * ```
415
+ *
416
+ * See {@link CustomTipId} for the list of custom tip IDs.
417
+ * See {@link ICustomTipInfo} for the structure of the metadata.
393
418
  */
394
- readonly configuration: Readonly<ICustomTipsJson>;
419
+ static customTipRegistry: Readonly<Record<CustomTipId, ICustomTipInfo>>;
420
+ constructor(configFilePath: string);
395
421
  /**
396
- * The list of identifiers that are allowed to be used in the "tipId" field
397
- * of the config file.
422
+ * If custom-tips.json defines a tip for the specified tipId,
423
+ * display the tip on the terminal.
424
+ *
425
+ * @remarks
426
+ * The severity of the tip is defined in ${@link CustomTipsConfiguration.customTipRegistry}.
427
+ * If you want to change the severity specifically for this call, use other API like {@link CustomTipsConfiguration._showErrorTip}.
428
+ *
429
+ * @internal
398
430
  */
399
- static readonly supportedTipIds: ReadonlySet<string>;
400
- constructor(configFilename: string);
401
- private _formatTipMessage;
431
+ _showTip(terminal: ITerminal, tipId: CustomTipId): void;
402
432
  /**
403
433
  * If custom-tips.json defines a tip for the specified tipId,
404
434
  * display the tip on the terminal.
435
+ * @internal
405
436
  */
406
- showInfoTip(terminal: ITerminal, tipId: CustomTipId): void;
437
+ _showInfoTip(terminal: ITerminal, tipId: CustomTipId): void;
407
438
  /**
408
439
  * If custom-tips.json defines a tip for the specified tipId,
409
440
  * display the tip on the terminal.
441
+ * @internal
410
442
  */
411
- showWarningTip(terminal: ITerminal, tipId: CustomTipId): void;
443
+ _showWarningTip(terminal: ITerminal, tipId: CustomTipId): void;
412
444
  /**
413
445
  * If custom-tips.json defines a tip for the specified tipId,
414
446
  * display the tip on the terminal.
447
+ * @internal
415
448
  */
416
- showErrorTip(terminal: ITerminal, tipId: CustomTipId): void;
449
+ _showErrorTip(terminal: ITerminal, tipId: CustomTipId): void;
450
+ private _writeMessageWithPipes;
451
+ }
452
+
453
+ /**
454
+ * The severity of a custom tip.
455
+ * It determines the printing severity ("Error" = red, "Warning" = yellow, "Info" = normal).
456
+ *
457
+ * @beta
458
+ */
459
+ export declare enum CustomTipSeverity {
460
+ Warning = "Warning",
461
+ Error = "Error",
462
+ Info = "Info"
463
+ }
464
+
465
+ /**
466
+ * The type of the custom tip.
467
+ *
468
+ * @remarks
469
+ * There might be types like `git` in the future.
470
+ *
471
+ * @beta
472
+ */
473
+ export declare enum CustomTipType {
474
+ rush = "rush",
475
+ pnpm = "pnpm"
417
476
  }
418
477
 
419
478
  /**
@@ -733,7 +792,7 @@ export declare const EnvironmentVariableNames: {
733
792
  * Events happen during Rush runs.
734
793
  * @beta
735
794
  */
736
- export declare enum Event {
795
+ declare enum Event_2 {
737
796
  /**
738
797
  * Pre Rush install event
739
798
  */
@@ -751,6 +810,7 @@ export declare enum Event {
751
810
  */
752
811
  postRushBuild = 4
753
812
  }
813
+ export { Event_2 as Event }
754
814
 
755
815
  /**
756
816
  * This class represents Rush event hooks configured for this repo.
@@ -768,7 +828,7 @@ export declare class EventHooks {
768
828
  * Return all the scripts associated with the specified event.
769
829
  * @param event - Rush event
770
830
  */
771
- get(event: Event): string[];
831
+ get(event: Event_2): string[];
772
832
  }
773
833
 
774
834
  /**
@@ -1082,6 +1142,39 @@ export declare interface ICredentialCacheOptions {
1082
1142
  supportEditing: boolean;
1083
1143
  }
1084
1144
 
1145
+ /**
1146
+ * Metadata for a custom tip.
1147
+ *
1148
+ * @remarks
1149
+ * This differs from the {@link ICustomTipItemJson} interface in that these are not configurable by the user;
1150
+ * it's the inherent state of a custom tip. For example, the custom tip for `ERR_PNPM_NO_MATCHING_VERSION`
1151
+ * has a inherent severity of `Error`, and a inherent match function that rush maintainer defines.
1152
+ *
1153
+ * @beta
1154
+ */
1155
+ export declare interface ICustomTipInfo {
1156
+ tipId: CustomTipId;
1157
+ /**
1158
+ * The severity of the custom tip. It will determine the printing severity ("Error" = red, "Warning" = yellow, "Info" = normal).
1159
+ *
1160
+ * @remarks
1161
+ * The severity should be consistent with the original message, unless there are strong reasons not to.
1162
+ */
1163
+ severity: CustomTipSeverity;
1164
+ /**
1165
+ * The type of the custom tip.
1166
+ */
1167
+ type: CustomTipType;
1168
+ /**
1169
+ * The function to determine how to match this tipId.
1170
+ *
1171
+ * @remarks
1172
+ * This function might need to be updated if the depending package is updated.
1173
+ * For example, if `pnpm` change the error logs for "ERR_PNPM_NO_MATCHING_VERSION", we will need to update the match function accordingly.
1174
+ */
1175
+ isMatch?: (str: string) => boolean;
1176
+ }
1177
+
1085
1178
  /**
1086
1179
  * An item from the {@link ICustomTipsJson.customTips} list.
1087
1180
  * @beta
@@ -1097,11 +1190,6 @@ export declare interface ICustomTipItemJson {
1097
1190
  * (REQUIRED) The message text to be displayed for this tip.
1098
1191
  */
1099
1192
  message: string;
1100
- /**
1101
- * Overrides the "defaultMessagePrefix" for this tip.
1102
- * Specify an empty string to omit the "defaultMessagePrefix" entirely.
1103
- */
1104
- messagePrefix?: string;
1105
1193
  }
1106
1194
 
1107
1195
  /**
@@ -1110,11 +1198,6 @@ export declare interface ICustomTipItemJson {
1110
1198
  * @beta
1111
1199
  */
1112
1200
  export declare interface ICustomTipsJson {
1113
- /**
1114
- * If specified, this prefix will be prepended to any the tip messages when they are displayed.
1115
- * The default value is an empty string.
1116
- */
1117
- defaultMessagePrefix?: string;
1118
1201
  /**
1119
1202
  * Specifies the custom tips to be displayed by Rush.
1120
1203
  */
@@ -1723,7 +1806,7 @@ export declare interface _IPnpmOptionsJson extends IPackageManagerOptionsJsonBas
1723
1806
  /**
1724
1807
  * {@inheritDoc PnpmOptionsConfiguration.pnpmStore}
1725
1808
  */
1726
- pnpmStore?: PnpmStoreOptions;
1809
+ pnpmStore?: PnpmStoreLocation;
1727
1810
  /**
1728
1811
  * {@inheritDoc PnpmOptionsConfiguration.strictPeerDependencies}
1729
1812
  */
@@ -1764,6 +1847,10 @@ export declare interface _IPnpmOptionsJson extends IPackageManagerOptionsJsonBas
1764
1847
  * {@inheritDoc PnpmOptionsConfiguration.unsupportedPackageJsonSettings}
1765
1848
  */
1766
1849
  unsupportedPackageJsonSettings?: unknown;
1850
+ /**
1851
+ * {@inheritDoc PnpmOptionsConfiguration.resolutionMode}
1852
+ */
1853
+ resolutionMode?: PnpmResolutionMode;
1767
1854
  }
1768
1855
 
1769
1856
  declare interface IPnpmPackageExtension {
@@ -2522,9 +2609,13 @@ export declare class _OperationStateFile {
2522
2609
  */
2523
2610
  export declare enum OperationStatus {
2524
2611
  /**
2525
- * The Operation is on the queue, ready to execute (but may be waiting for dependencies)
2612
+ * The Operation is ready to execute. All its dependencies have succeeded.
2526
2613
  */
2527
2614
  Ready = "READY",
2615
+ /**
2616
+ * The Operation is waiting for one or more dependencies to complete.
2617
+ */
2618
+ Waiting = "WAITING",
2528
2619
  /**
2529
2620
  * The Operation is Queued
2530
2621
  */
@@ -2757,7 +2848,19 @@ export declare class PnpmOptionsConfiguration extends PackageManagerOptionsConfi
2757
2848
  * - local: Use the standard Rush store path: common/temp/pnpm-store
2758
2849
  * - global: Use PNPM's global store path
2759
2850
  */
2760
- readonly pnpmStore: PnpmStoreOptions;
2851
+ readonly pnpmStore: PnpmStoreLocation;
2852
+ /**
2853
+ * This setting determines PNPM's `resolution-mode` option. The default value is `highest`.
2854
+ *
2855
+ * @remarks
2856
+ * Be aware that the PNPM 8 initially defaulted to `lowest` instead of `highest`, but PNPM
2857
+ * reverted this decision in 8.6.12 because it caused confusion for users. Rush 5.106.0 and newer
2858
+ * avoids this confusion by consistently defaulting to `highest` when `resolutionMode` is not
2859
+ * explicitly set in pnpm-config.json or .npmrc, regardless of your PNPM version.
2860
+ *
2861
+ * PNPM documentation: https://pnpm.io/npmrc#resolution-mode
2862
+ */
2863
+ readonly resolutionMode: PnpmResolutionMode | undefined;
2761
2864
  /**
2762
2865
  * The path for PNPM to use as the store directory.
2763
2866
  *
@@ -2901,11 +3004,27 @@ export declare class PnpmOptionsConfiguration extends PackageManagerOptionsConfi
2901
3004
  updateGlobalPatchedDependencies(patchedDependencies: Record<string, string> | undefined): void;
2902
3005
  }
2903
3006
 
3007
+ /**
3008
+ * Possible values for the `resolutionMode` setting in Rush's pnpm-config.json file.
3009
+ * @remarks
3010
+ * These modes correspond to PNPM's `resolution-mode` values, which are documented here:
3011
+ * {@link https://pnpm.io/npmrc#resolution-mode}
3012
+ *
3013
+ * @public
3014
+ */
3015
+ export declare type PnpmResolutionMode = 'highest' | 'time-based' | 'lowest-direct';
3016
+
2904
3017
  /**
2905
3018
  * This represents the available PNPM store options
2906
3019
  * @public
2907
3020
  */
2908
- export declare type PnpmStoreOptions = 'local' | 'global';
3021
+ export declare type PnpmStoreLocation = 'local' | 'global';
3022
+
3023
+ /**
3024
+ * @deprecated Use {@link PnpmStoreLocation} instead
3025
+ * @public
3026
+ */
3027
+ export declare type PnpmStoreOptions = PnpmStoreLocation;
2909
3028
 
2910
3029
  /**
2911
3030
  * @beta
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.36.4"
8
+ "packageVersion": "7.37.0"
9
9
  }
10
10
  ]
11
11
  }
@@ -5,11 +5,6 @@ import { ITerminal } from '@rushstack/node-core-library';
5
5
  * @beta
6
6
  */
7
7
  export interface ICustomTipsJson {
8
- /**
9
- * If specified, this prefix will be prepended to any the tip messages when they are displayed.
10
- * The default value is an empty string.
11
- */
12
- defaultMessagePrefix?: string;
13
8
  /**
14
9
  * Specifies the custom tips to be displayed by Rush.
15
10
  */
@@ -30,11 +25,6 @@ export interface ICustomTipItemJson {
30
25
  * (REQUIRED) The message text to be displayed for this tip.
31
26
  */
32
27
  message: string;
33
- /**
34
- * Overrides the "defaultMessagePrefix" for this tip.
35
- * Specify an empty string to omit the "defaultMessagePrefix" entirely.
36
- */
37
- messagePrefix?: string;
38
28
  }
39
29
  /**
40
30
  * An identifier representing a Rush message that can be customized by
@@ -48,7 +38,74 @@ export interface ICustomTipItemJson {
48
38
  *
49
39
  * @beta
50
40
  */
51
- export type CustomTipId = 'TIP_RUSH_INCONSISTENT_VERSIONS' | string;
41
+ export declare enum CustomTipId {
42
+ TIP_RUSH_INCONSISTENT_VERSIONS = "TIP_RUSH_INCONSISTENT_VERSIONS",
43
+ TIP_PNPM_UNEXPECTED_STORE = "TIP_PNPM_UNEXPECTED_STORE",
44
+ TIP_PNPM_NO_MATCHING_VERSION = "TIP_PNPM_NO_MATCHING_VERSION",
45
+ TIP_PNPM_NO_MATCHING_VERSION_INSIDE_WORKSPACE = "TIP_PNPM_NO_MATCHING_VERSION_INSIDE_WORKSPACE",
46
+ TIP_PNPM_PEER_DEP_ISSUES = "TIP_PNPM_PEER_DEP_ISSUES",
47
+ TIP_PNPM_OUTDATED_LOCKFILE = "TIP_PNPM_OUTDATED_LOCKFILE",
48
+ TIP_PNPM_TARBALL_INTEGRITY = "TIP_PNPM_TARBALL_INTEGRITY",
49
+ TIP_PNPM_MISMATCHED_RELEASE_CHANNEL = "TIP_PNPM_MISMATCHED_RELEASE_CHANNEL",
50
+ TIP_PNPM_INVALID_NODE_VERSION = "TIP_PNPM_INVALID_NODE_VERSION"
51
+ }
52
+ /**
53
+ * The severity of a custom tip.
54
+ * It determines the printing severity ("Error" = red, "Warning" = yellow, "Info" = normal).
55
+ *
56
+ * @beta
57
+ */
58
+ export declare enum CustomTipSeverity {
59
+ Warning = "Warning",
60
+ Error = "Error",
61
+ Info = "Info"
62
+ }
63
+ /**
64
+ * The type of the custom tip.
65
+ *
66
+ * @remarks
67
+ * There might be types like `git` in the future.
68
+ *
69
+ * @beta
70
+ */
71
+ export declare enum CustomTipType {
72
+ rush = "rush",
73
+ pnpm = "pnpm"
74
+ }
75
+ /**
76
+ * Metadata for a custom tip.
77
+ *
78
+ * @remarks
79
+ * This differs from the {@link ICustomTipItemJson} interface in that these are not configurable by the user;
80
+ * it's the inherent state of a custom tip. For example, the custom tip for `ERR_PNPM_NO_MATCHING_VERSION`
81
+ * has a inherent severity of `Error`, and a inherent match function that rush maintainer defines.
82
+ *
83
+ * @beta
84
+ */
85
+ export interface ICustomTipInfo {
86
+ tipId: CustomTipId;
87
+ /**
88
+ * The severity of the custom tip. It will determine the printing severity ("Error" = red, "Warning" = yellow, "Info" = normal).
89
+ *
90
+ * @remarks
91
+ * The severity should be consistent with the original message, unless there are strong reasons not to.
92
+ */
93
+ severity: CustomTipSeverity;
94
+ /**
95
+ * The type of the custom tip.
96
+ */
97
+ type: CustomTipType;
98
+ /**
99
+ * The function to determine how to match this tipId.
100
+ *
101
+ * @remarks
102
+ * This function might need to be updated if the depending package is updated.
103
+ * For example, if `pnpm` change the error logs for "ERR_PNPM_NO_MATCHING_VERSION", we will need to update the match function accordingly.
104
+ */
105
+ isMatch?: (str: string) => boolean;
106
+ }
107
+ export declare const RUSH_CUSTOM_TIPS: Readonly<Record<`TIP_RUSH_${string}` & CustomTipId, ICustomTipInfo>>;
108
+ export declare const PNPM_CUSTOM_TIPS: Readonly<Record<`TIP_PNPM_${string}` & CustomTipId, ICustomTipInfo>>;
52
109
  /**
53
110
  * Used to access the `common/config/rush/custom-tips.json` config file,
54
111
  * which allows repo maintainers to configure extra details to be printed alongside
@@ -57,33 +114,57 @@ export type CustomTipId = 'TIP_RUSH_INCONSISTENT_VERSIONS' | string;
57
114
  */
58
115
  export declare class CustomTipsConfiguration {
59
116
  private static _jsonSchema;
60
- private readonly _tipMap;
61
- private readonly _jsonFileName;
117
+ readonly providedCustomTipsByTipId: ReadonlyMap<CustomTipId, ICustomTipItemJson>;
62
118
  /**
63
- * The JSON settings loaded from `custom-tips.json`.
119
+ * A registry mapping custom tip IDs to their corresponding metadata.
120
+ *
121
+ * @remarks
122
+ * This registry is used to look up metadata for custom tips based on their IDs. The metadata includes
123
+ * information such as the severity level, the type of tip, and an optional matching function.
124
+ *
125
+ * Each key in the registry corresponds to a `CustomTipIdEnum` value, and each value is an object
126
+ * implementing the `ICustomTipInfo` interface.
127
+ *
128
+ * @example
129
+ * ```typescript
130
+ * const tipInfo = CustomTipsConfiguration.customTipRegistry[CustomTipIdEnum.TIP_RUSH_INCONSISTENT_VERSIONS];
131
+ * console.log(tipInfo.severity); // Output: CustomTipSeverity.Error
132
+ * ```
133
+ *
134
+ * See {@link CustomTipId} for the list of custom tip IDs.
135
+ * See {@link ICustomTipInfo} for the structure of the metadata.
64
136
  */
65
- readonly configuration: Readonly<ICustomTipsJson>;
137
+ static customTipRegistry: Readonly<Record<CustomTipId, ICustomTipInfo>>;
138
+ constructor(configFilePath: string);
66
139
  /**
67
- * The list of identifiers that are allowed to be used in the "tipId" field
68
- * of the config file.
140
+ * If custom-tips.json defines a tip for the specified tipId,
141
+ * display the tip on the terminal.
142
+ *
143
+ * @remarks
144
+ * The severity of the tip is defined in ${@link CustomTipsConfiguration.customTipRegistry}.
145
+ * If you want to change the severity specifically for this call, use other API like {@link CustomTipsConfiguration._showErrorTip}.
146
+ *
147
+ * @internal
69
148
  */
70
- static readonly supportedTipIds: ReadonlySet<string>;
71
- constructor(configFilename: string);
72
- private _formatTipMessage;
149
+ _showTip(terminal: ITerminal, tipId: CustomTipId): void;
73
150
  /**
74
151
  * If custom-tips.json defines a tip for the specified tipId,
75
152
  * display the tip on the terminal.
153
+ * @internal
76
154
  */
77
- showInfoTip(terminal: ITerminal, tipId: CustomTipId): void;
155
+ _showInfoTip(terminal: ITerminal, tipId: CustomTipId): void;
78
156
  /**
79
157
  * If custom-tips.json defines a tip for the specified tipId,
80
158
  * display the tip on the terminal.
159
+ * @internal
81
160
  */
82
- showWarningTip(terminal: ITerminal, tipId: CustomTipId): void;
161
+ _showWarningTip(terminal: ITerminal, tipId: CustomTipId): void;
83
162
  /**
84
163
  * If custom-tips.json defines a tip for the specified tipId,
85
164
  * display the tip on the terminal.
165
+ * @internal
86
166
  */
87
- showErrorTip(terminal: ITerminal, tipId: CustomTipId): void;
167
+ _showErrorTip(terminal: ITerminal, tipId: CustomTipId): void;
168
+ private _writeMessageWithPipes;
88
169
  }
89
170
  //# sourceMappingURL=CustomTipsConfiguration.d.ts.map
@@ -53,6 +53,7 @@ export declare class PhasedScriptAction extends BaseScriptAction<IPhasedCommandC
53
53
  constructor(options: IPhasedScriptActionOptions);
54
54
  runAsync(): Promise<void>;
55
55
  private _runInitialPhases;
56
+ private _registerWatchModeInterface;
56
57
  /**
57
58
  * Runs the command in watch mode. Fundamentally is a simple loop:
58
59
  * 1) Wait for a change to one or more projects in the selection
package/lib/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export { RushConfiguration, ITryFindRushJsonLocationOptions } from './api/RushCo
7
7
  export { IPackageManagerOptionsJsonBase, IConfigurationEnvironment, IConfigurationEnvironmentVariable, PackageManagerOptionsConfigurationBase } from './logic/base/BasePackageManagerOptionsConfiguration';
8
8
  export { INpmOptionsJson as _INpmOptionsJson, NpmOptionsConfiguration } from './logic/npm/NpmOptionsConfiguration';
9
9
  export { IYarnOptionsJson as _IYarnOptionsJson, YarnOptionsConfiguration } from './logic/yarn/YarnOptionsConfiguration';
10
- export { IPnpmOptionsJson as _IPnpmOptionsJson, PnpmStoreOptions, PnpmOptionsConfiguration } from './logic/pnpm/PnpmOptionsConfiguration';
10
+ export { IPnpmOptionsJson as _IPnpmOptionsJson, PnpmStoreLocation, PnpmStoreOptions, PnpmOptionsConfiguration, PnpmResolutionMode } from './logic/pnpm/PnpmOptionsConfiguration';
11
11
  export { BuildCacheConfiguration } from './api/BuildCacheConfiguration';
12
12
  export { CobuildConfiguration, ICobuildJson } from './api/CobuildConfiguration';
13
13
  export { GetCacheEntryIdFunction, IGenerateCacheEntryIdOptions } from './logic/buildCache/CacheEntryId';
@@ -33,7 +33,7 @@ export { VersionPolicyConfiguration } from './api/VersionPolicyConfiguration';
33
33
  export { ILaunchOptions, Rush } from './api/Rush';
34
34
  export { RushInternals as _RushInternals } from './api/RushInternals';
35
35
  export { ExperimentsConfiguration, IExperimentsJson } from './api/ExperimentsConfiguration';
36
- export { CustomTipsConfiguration, CustomTipId, ICustomTipsJson, ICustomTipItemJson } from './api/CustomTipsConfiguration';
36
+ export { CustomTipsConfiguration, CustomTipId, ICustomTipsJson, ICustomTipInfo, ICustomTipItemJson, CustomTipSeverity, CustomTipType } from './api/CustomTipsConfiguration';
37
37
  export { ProjectChangeAnalyzer, IGetChangedProjectsOptions, IRawRepoState as _IRawRepoState } from './logic/ProjectChangeAnalyzer';
38
38
  export { IOperationRunner, IOperationRunnerContext } from './logic/operations/IOperationRunner';
39
39
  export { IExecutionResult, IOperationExecutionResult } from './logic/operations/IOperationExecutionResult';
@@ -24,13 +24,6 @@ export declare class OperationExecutionRecord implements IOperationRunnerContext
24
24
  * The associated operation.
25
25
  */
26
26
  readonly operation: Operation;
27
- /**
28
- * The current execution status of an operation. Operations start in the 'ready' state,
29
- * but can be 'blocked' if an upstream operation failed. It is 'executing' when
30
- * the operation is executing. Once execution is complete, it is either 'success' or
31
- * 'failure'.
32
- */
33
- status: OperationStatus;
34
27
  /**
35
28
  * The error which occurred while executing this operation, this is stored in case we need
36
29
  * it later (for example to re-print errors at end of execution).
@@ -85,6 +78,7 @@ export declare class OperationExecutionRecord implements IOperationRunnerContext
85
78
  readonly _operationMetadataManager: OperationMetadataManager | undefined;
86
79
  private readonly _context;
87
80
  private _collatedWriter;
81
+ private _status;
88
82
  constructor(operation: Operation, context: IOperationExecutionRecordContext);
89
83
  get name(): string;
90
84
  get debugMode(): boolean;
@@ -93,6 +87,14 @@ export declare class OperationExecutionRecord implements IOperationRunnerContext
93
87
  get collatedWriter(): CollatedWriter;
94
88
  get nonCachedDurationMs(): number | undefined;
95
89
  get cobuildRunnerId(): string | undefined;
90
+ /**
91
+ * The current execution status of an operation. Operations start in the 'ready' state,
92
+ * but can be 'blocked' if an upstream operation failed. It is 'executing' when
93
+ * the operation is executing. Once execution is complete, it is either 'success' or
94
+ * 'failure'.
95
+ */
96
+ get status(): OperationStatus;
97
+ set status(newStatus: OperationStatus);
96
98
  executeAsync({ onStart, onResult }: {
97
99
  onStart: (record: OperationExecutionRecord) => Promise<OperationStatus | undefined>;
98
100
  onResult: (record: OperationExecutionRecord) => Promise<void>;
@@ -4,9 +4,13 @@
4
4
  */
5
5
  export declare enum OperationStatus {
6
6
  /**
7
- * The Operation is on the queue, ready to execute (but may be waiting for dependencies)
7
+ * The Operation is ready to execute. All its dependencies have succeeded.
8
8
  */
9
9
  Ready = "READY",
10
+ /**
11
+ * The Operation is waiting for one or more dependencies to complete.
12
+ */
13
+ Waiting = "WAITING",
10
14
  /**
11
15
  * The Operation is Queued
12
16
  */
@@ -3,7 +3,21 @@ import { IPackageManagerOptionsJsonBase, PackageManagerOptionsConfigurationBase
3
3
  * This represents the available PNPM store options
4
4
  * @public
5
5
  */
6
- export type PnpmStoreOptions = 'local' | 'global';
6
+ export type PnpmStoreLocation = 'local' | 'global';
7
+ /**
8
+ * @deprecated Use {@link PnpmStoreLocation} instead
9
+ * @public
10
+ */
11
+ export type PnpmStoreOptions = PnpmStoreLocation;
12
+ /**
13
+ * Possible values for the `resolutionMode` setting in Rush's pnpm-config.json file.
14
+ * @remarks
15
+ * These modes correspond to PNPM's `resolution-mode` values, which are documented here:
16
+ * {@link https://pnpm.io/npmrc#resolution-mode}
17
+ *
18
+ * @public
19
+ */
20
+ export type PnpmResolutionMode = 'highest' | 'time-based' | 'lowest-direct';
7
21
  /**
8
22
  * @beta
9
23
  */
@@ -31,7 +45,7 @@ export interface IPnpmOptionsJson extends IPackageManagerOptionsJsonBase {
31
45
  /**
32
46
  * {@inheritDoc PnpmOptionsConfiguration.pnpmStore}
33
47
  */
34
- pnpmStore?: PnpmStoreOptions;
48
+ pnpmStore?: PnpmStoreLocation;
35
49
  /**
36
50
  * {@inheritDoc PnpmOptionsConfiguration.strictPeerDependencies}
37
51
  */
@@ -72,6 +86,10 @@ export interface IPnpmOptionsJson extends IPackageManagerOptionsJsonBase {
72
86
  * {@inheritDoc PnpmOptionsConfiguration.unsupportedPackageJsonSettings}
73
87
  */
74
88
  unsupportedPackageJsonSettings?: unknown;
89
+ /**
90
+ * {@inheritDoc PnpmOptionsConfiguration.resolutionMode}
91
+ */
92
+ resolutionMode?: PnpmResolutionMode;
75
93
  }
76
94
  /**
77
95
  * Options that are only used when the PNPM package manager is selected.
@@ -96,7 +114,19 @@ export declare class PnpmOptionsConfiguration extends PackageManagerOptionsConfi
96
114
  * - local: Use the standard Rush store path: common/temp/pnpm-store
97
115
  * - global: Use PNPM's global store path
98
116
  */
99
- readonly pnpmStore: PnpmStoreOptions;
117
+ readonly pnpmStore: PnpmStoreLocation;
118
+ /**
119
+ * This setting determines PNPM's `resolution-mode` option. The default value is `highest`.
120
+ *
121
+ * @remarks
122
+ * Be aware that the PNPM 8 initially defaulted to `lowest` instead of `highest`, but PNPM
123
+ * reverted this decision in 8.6.12 because it caused confusion for users. Rush 5.106.0 and newer
124
+ * avoids this confusion by consistently defaulting to `highest` when `resolutionMode` is not
125
+ * explicitly set in pnpm-config.json or .npmrc, regardless of your PNPM version.
126
+ *
127
+ * PNPM documentation: https://pnpm.io/npmrc#resolution-mode
128
+ */
129
+ readonly resolutionMode: PnpmResolutionMode | undefined;
100
130
  /**
101
131
  * The path for PNPM to use as the store directory.
102
132
  *
@@ -108,6 +108,13 @@ export declare class Utilities {
108
108
  * The current directory will be set to the specified workingDirectory.
109
109
  */
110
110
  static executeCommand(options: IExecuteCommandOptions): void;
111
+ /**
112
+ * Executes the command with the specified command-line parameters, and waits for it to complete.
113
+ * The current directory will be set to the specified workingDirectory.
114
+ *
115
+ * It's basically the same as executeCommand() except that it returns a Promise.
116
+ */
117
+ static executeCommandAndInspectOutputAsync(options: IExecuteCommandOptions, onStdoutStreamChunk?: (chunkString: string) => void): Promise<void>;
111
118
  /**
112
119
  * Executes the command with the specified command-line parameters, and waits for it to complete.
113
120
  * The current directory will be set to the specified workingDirectory.
@@ -117,6 +124,13 @@ export declare class Utilities {
117
124
  * Attempts to run Utilities.executeCommand() up to maxAttempts times before giving up.
118
125
  */
119
126
  static executeCommandWithRetry(options: IExecuteCommandOptions, maxAttempts: number, retryCallback?: () => void): void;
127
+ /**
128
+ * Attempts to run Utilities.executeCommand() up to maxAttempts times before giving up.
129
+ * Using `onStdoutStreamChunk` to process the output of the command.
130
+ *
131
+ * Note: This is similar to {@link executeCommandWithRetry} except that it returns a Promise and provides a callback to process the output.
132
+ */
133
+ static executeCommandAndProcessOutputWithRetryAsync(options: IExecuteCommandOptions, maxAttempts: number, onStdoutStreamChunk?: (chunkString: string) => void, retryCallback?: () => void): Promise<void>;
120
134
  /**
121
135
  * Executes the command using cmd if running on windows, or using sh if running on a non-windows OS.
122
136
  * @param command - the command to run on shell
@@ -163,6 +177,13 @@ export declare class Utilities {
163
177
  * "/foobar/node_modules/.bin:/bin"
164
178
  */
165
179
  private static _prependNodeModulesBinToPath;
180
+ /**
181
+ * Executes the command with the specified command-line parameters, and waits for it to complete.
182
+ * The current directory will be set to the specified workingDirectory.
183
+ *
184
+ * It's the same as _executeCommandInternal except that it returns a promise.
185
+ */
186
+ private static _executeCommandAndInspectOutputInternalAsync;
166
187
  /**
167
188
  * Executes the command with the specified command-line parameters, and waits for it to complete.
168
189
  * The current directory will be set to the specified workingDirectory.
@@ -12,4 +12,5 @@ export interface ILogger {
12
12
  * The text of the the synced .npmrc, if one exists. If one does not exist, then undefined is returned.
13
13
  */
14
14
  export declare function syncNpmrc(sourceNpmrcFolder: string, targetNpmrcFolder: string, useNpmrcPublish?: boolean, logger?: ILogger): string | undefined;
15
+ export declare function isVariableSetInNpmrcFile(sourceNpmrcFolder: string, variableKey: string): boolean;
15
16
  //# sourceMappingURL=npmrcUtilities.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA8MA;;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":"AA6MA;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAO1E"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,oEAQsC;AAEtC,uCAQmB;AAEnB,MAAM,cAAc,GAAY,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,GAAG,CAAC;AACrG,MAAM,QAAQ,GAAa,IAAI,4BAAQ,CACrC,IAAI,2CAAuB,CAAC;IAC1B,cAAc;CACf,CAAC,CACH,CAAC;AASF,IAAI,YAAY,GAAW,EAAE,CAAC;AAE9B,qGAAqG;AACrG,gGAAgG;AAChG,IAAI,oBAAU,CAAC,aAAa,KAAK,SAAS,EAAE;IAC1C,oBAAU,CAAC,aAAa;QACtB,MAAM,CAAC,uBAAuB;YAC9B,MAAM,CAAC,sCAAsC;YAC7C,MAAM,CAAC,4CAA4C,CAAC;CACvD;AAED,6FAA6F;AAC7F,+FAA+F;AAC/F,IAAI,oBAAU,CAAC,aAAa,KAAK,SAAS,EAAE;IAC1C,MAAM,aAAa,GAA8B,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,0CAAE,QAAQ,CAAC;IAC1E,IAAI,aAAa,EAAE;QACjB,MAAM,mBAAmB,GACvB,qCAAiB,CAAC,QAAQ,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC;QAEnE,IAAI,mBAAmB,KAAK,SAAS,EAAE;YACrC,MAAM,iB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C,IAAI,CAAC,CAAC,CAAC,CAAC;CACjB;AAED,uCAAuC;AACvC,KAAK,MAAM,QAAQ,IAAI,oBAAU,CAAC,aAAa,EAAE;IAC/C,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;QAC/D,MAAM,uBAAuB,GAAsB,oBAAU,CAAC,aAAa,CAAC;QAE5E,0CAA0C;QAC1C,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE;YACvC,UAAU,EAAE,IAAI;YAChB,GAAG,EAAE;gBACH,OAAO,uBAAuB,CAAC,QAAQ,CAAC,CAAC;YAC3C,CAAC;SACF,CAAC,CAAC;KACJ;CACF;AAED;;GAEG;AACH,SAAgB,2BAA2B,CAAC,aAAqB;IAC/D,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE;QAC3B,MAAM,IAAI,KAAK,CACb,gBAAgB,OAAO,CAAC,IAAI,CAAC,OAAO,qDAAqD,CAC1F,CAAC;KACH;IACD,OAAO,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAC1D,CAAC;AAPD,kEAOC","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 IPackageJson,\n PackageJsonLookup,\n Executable,\n Terminal,\n ConsoleTerminalProvider\n} from '@rushstack/node-core-library';\nimport type { SpawnSyncReturns } from 'child_process';\nimport {\n RUSH_LIB_NAME,\n RUSH_LIB_PATH_ENV_VAR_NAME,\n RushLibModuleType,\n _require,\n requireRushLibUnderFolderPath,\n tryFindRushJsonLocation,\n sdkContext\n} from './helpers';\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\ndeclare const global: NodeJS.Global &\n typeof globalThis & {\n ___rush___rushLibModule?: RushLibModuleType;\n ___rush___rushLibModuleFromEnvironment?: RushLibModuleType;\n ___rush___rushLibModuleFromInstallAndRunRush?: RushLibModuleType;\n };\n\nlet errorMessage: string = '';\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.\nif (sdkContext.rushLibModule === undefined) {\n sdkContext.rushLibModule =\n global.___rush___rushLibModule ||\n global.___rush___rushLibModuleFromEnvironment ||\n global.___rush___rushLibModuleFromInstallAndRunRush;\n}\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 (sdkContext.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 sdkContext.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 (sdkContext.rushLibModule !== undefined) {\n // to track which scenario is active and how it got initialized.\n global.___rush___rushLibModule = sdkContext.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 (sdkContext.rushLibModule === undefined) {\n const rushLibPath: string | undefined = process.env[RUSH_LIB_PATH_ENV_VAR_NAME];\n if (rushLibPath) {\n terminal.writeVerboseLine(\n `Try to load ${RUSH_LIB_NAME} from process.env.${RUSH_LIB_PATH_ENV_VAR_NAME} from caller package`\n );\n try {\n sdkContext.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(\n `Failed to load ${RUSH_LIB_NAME} via process.env.${RUSH_LIB_PATH_ENV_VAR_NAME}`\n );\n }\n\n if (sdkContext.rushLibModule !== undefined) {\n // to track which scenario is active and how it got initialized.\n global.___rush___rushLibModuleFromEnvironment = sdkContext.rushLibModule;\n terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} from process.env.${RUSH_LIB_PATH_ENV_VAR_NAME}`);\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 (sdkContext.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 sdkContext.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 installAndRunRushProcess: SpawnSyncReturns<string> = Executable.spawnSync(\n 'node',\n [installAndRunRushJSPath, '--help'],\n {\n stdio: 'pipe'\n }\n );\n\n installAndRunRushStderrContent = installAndRunRushProcess.stderr;\n if (installAndRunRushProcess.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 sdkContext.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 (sdkContext.rushLibModule !== undefined) {\n // to track which scenario is active and how it got initialized.\n global.___rush___rushLibModuleFromInstallAndRunRush = sdkContext.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 (sdkContext.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 sdkContext.rushLibModule) {\n if (property !== 'default' && !exports.hasOwnProperty(property)) {\n const rushLibModuleForClosure: RushLibModuleType = sdkContext.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"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,oEAQsC;AAEtC,uCAQmB;AAEnB,MAAM,cAAc,GAAY,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,GAAG,CAAC;AACrG,MAAM,QAAQ,GAAa,IAAI,4BAAQ,CACrC,IAAI,2CAAuB,CAAC;IAC1B,cAAc;CACf,CAAC,CACH,CAAC;AAQF,IAAI,YAAY,GAAW,EAAE,CAAC;AAE9B,qGAAqG;AACrG,gGAAgG;AAChG,IAAI,oBAAU,CAAC,aAAa,KAAK,SAAS,EAAE;IAC1C,oBAAU,CAAC,aAAa;QACtB,MAAM,CAAC,uBAAuB;YAC9B,MAAM,CAAC,sCAAsC;YAC7C,MAAM,CAAC,4CAA4C,CAAC;CACvD;AAED,6FAA6F;AAC7F,+FAA+F;AAC/F,IAAI,oBAAU,CAAC,aAAa,KAAK,SAAS,EAAE;IAC1C,MAAM,aAAa,GAA8B,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,0CAAE,QAAQ,CAAC;IAC1E,IAAI,aAAa,EAAE;QACjB,MAAM,mBAAmB,GACv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AC1C,qGAAqG;IACrG,wGAAwG;IACxG,2CAA2C;IAC3C,OAAO,CAAC,KAAK,CAAC;EACd,YAAY;CACb,CAAC,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACjB;AAED,uCAAuC;AACvC,KAAK,MAAM,QAAQ,IAAI,oBAAU,CAAC,aAAa,EAAE;IAC/C,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;QAC/D,MAAM,uBAAuB,GAAsB,oBAAU,CAAC,aAAa,CAAC;QAE5E,0CAA0C;QAC1C,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE;YACvC,UAAU,EAAE,IAAI;YAChB,GAAG,EAAE;gBACH,OAAO,uBAAuB,CAAC,QAAQ,CAAC,CAAC;YAC3C,CAAC;SACF,CAAC,CAAC;KACJ;CACF;AAED;;GAEG;AACH,SAAgB,2BAA2B,CAAC,aAAqB;IAC/D,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE;QAC3B,MAAM,IAAI,KAAK,CACb,gBAAgB,OAAO,CAAC,IAAI,CAAC,OAAO,qDAAqD,CAC1F,CAAC;KACH;IACD,OAAO,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAC1D,CAAC;AAPD,kEAOC","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 IPackageJson,\n PackageJsonLookup,\n Executable,\n Terminal,\n ConsoleTerminalProvider\n} from '@rushstack/node-core-library';\nimport type { SpawnSyncReturns } from 'child_process';\nimport {\n RUSH_LIB_NAME,\n RUSH_LIB_PATH_ENV_VAR_NAME,\n RushLibModuleType,\n _require,\n requireRushLibUnderFolderPath,\n tryFindRushJsonLocation,\n sdkContext\n} from './helpers';\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\ndeclare const global: typeof globalThis & {\n ___rush___rushLibModule?: RushLibModuleType;\n ___rush___rushLibModuleFromEnvironment?: RushLibModuleType;\n ___rush___rushLibModuleFromInstallAndRunRush?: RushLibModuleType;\n};\n\nlet errorMessage: string = '';\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.\nif (sdkContext.rushLibModule === undefined) {\n sdkContext.rushLibModule =\n global.___rush___rushLibModule ||\n global.___rush___rushLibModuleFromEnvironment ||\n global.___rush___rushLibModuleFromInstallAndRunRush;\n}\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 (sdkContext.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 sdkContext.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 (sdkContext.rushLibModule !== undefined) {\n // to track which scenario is active and how it got initialized.\n global.___rush___rushLibModule = sdkContext.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 (sdkContext.rushLibModule === undefined) {\n const rushLibPath: string | undefined = process.env[RUSH_LIB_PATH_ENV_VAR_NAME];\n if (rushLibPath) {\n terminal.writeVerboseLine(\n `Try to load ${RUSH_LIB_NAME} from process.env.${RUSH_LIB_PATH_ENV_VAR_NAME} from caller package`\n );\n try {\n sdkContext.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(\n `Failed to load ${RUSH_LIB_NAME} via process.env.${RUSH_LIB_PATH_ENV_VAR_NAME}`\n );\n }\n\n if (sdkContext.rushLibModule !== undefined) {\n // to track which scenario is active and how it got initialized.\n global.___rush___rushLibModuleFromEnvironment = sdkContext.rushLibModule;\n terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} from process.env.${RUSH_LIB_PATH_ENV_VAR_NAME}`);\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 (sdkContext.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 sdkContext.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 installAndRunRushProcess: SpawnSyncReturns<string> = Executable.spawnSync(\n 'node',\n [installAndRunRushJSPath, '--help'],\n {\n stdio: 'pipe'\n }\n );\n\n installAndRunRushStderrContent = installAndRunRushProcess.stderr;\n if (installAndRunRushProcess.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 sdkContext.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 (sdkContext.rushLibModule !== undefined) {\n // to track which scenario is active and how it got initialized.\n global.___rush___rushLibModuleFromInstallAndRunRush = sdkContext.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 (sdkContext.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 sdkContext.rushLibModule) {\n if (property !== 'default' && !exports.hasOwnProperty(property)) {\n const rushLibModuleForClosure: RushLibModuleType = sdkContext.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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":";AAsBA;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,UAAU,EAAE,8BAA8B,GAAG,SAAS,CAAC;IAEvD;;;;;;;;OAQG;IACH,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;AAE3E;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B;;OAEG;IACH,aAAa,CAAC,EAAE,sBAAsB,CAAC;CACxC;AAED;;;;GAIG;AACH,qBAAa,aAAa;IACxB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAwB9B;;OAEG;IACH,WAAkB,QAAQ,IAAI,OAAO,CAEpC;IAED;;;;;;;OAOG;WACiB,SAAS,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;CA+I7E"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":";AAqBA;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,UAAU,EAAE,8BAA8B,GAAG,SAAS,CAAC;IAEvD;;;;;;;;OAQG;IACH,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;AAE3E;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B;;OAEG;IACH,aAAa,CAAC,EAAE,sBAAsB,CAAC;CACxC;AAED;;;;GAIG;AACH,qBAAa,aAAa;IACxB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAwB9B;;OAEG;IACH,WAAkB,QAAQ,IAAI,OAAO,CAEpC;IAED;;;;;;;OAOG;WACiB,SAAS,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;CAiJ7E"}
@@ -39,7 +39,7 @@ class RushSdkLoader {
39
39
  * Throws an "AbortError" exception if abortSignal.aborted is true.
40
40
  */
41
41
  static _checkForCancel(abortSignal, onNotifyEvent, progressPercent) {
42
- if (!abortSignal.aborted) {
42
+ if (!(abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.aborted)) {
43
43
  return;
44
44
  }
45
45
  if (onNotifyEvent) {
@@ -71,7 +71,7 @@ class RushSdkLoader {
71
71
  */
72
72
  static async loadAsync(options) {
73
73
  // SCENARIO 5: The rush-lib engine is loaded manually using rushSdkLoader.loadAsync().
74
- var _a, _b, _c;
74
+ var _a, _b;
75
75
  if (!options) {
76
76
  options = {};
77
77
  }
@@ -80,9 +80,9 @@ class RushSdkLoader {
80
80
  }
81
81
  const onNotifyEvent = options.onNotifyEvent;
82
82
  let progressPercent = undefined;
83
- const abortSignal = (_a = options.abortSignal) !== null && _a !== void 0 ? _a : { aborted: false };
83
+ const abortSignal = options.abortSignal;
84
84
  try {
85
- const rushJsonSearchFolder = (_b = options.rushJsonSearchFolder) !== null && _b !== void 0 ? _b : process.cwd();
85
+ const rushJsonSearchFolder = (_a = options.rushJsonSearchFolder) !== null && _a !== void 0 ? _a : process.cwd();
86
86
  if (onNotifyEvent) {
87
87
  onNotifyEvent({
88
88
  logMessage: {
@@ -136,7 +136,9 @@ class RushSdkLoader {
136
136
  if (installAndRunRushProcess.status !== 0) {
137
137
  throw new Error(`The ${helpers_1.RUSH_LIB_NAME} package failed to install`);
138
138
  }
139
- RushSdkLoader._checkForCancel(abortSignal, onNotifyEvent, progressPercent);
139
+ if (abortSignal) {
140
+ RushSdkLoader._checkForCancel(abortSignal, onNotifyEvent, progressPercent);
141
+ }
140
142
  // TODO: Implement incremental progress updates
141
143
  progressPercent = 90;
142
144
  // Retry to load "rush-lib" after install-run-rush run
@@ -176,7 +178,7 @@ class RushSdkLoader {
176
178
  onNotifyEvent({
177
179
  logMessage: {
178
180
  kind: 'info',
179
- text: 'The operation failed: ' + ((_c = e.message) !== null && _c !== void 0 ? _c : 'An unknown error occurred')
181
+ text: 'The operation failed: ' + ((_b = e.message) !== null && _b !== void 0 ? _b : 'An unknown error occurred')
180
182
  },
181
183
  progressPercent
182
184
  });
@@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E,UAAU,uBAAa,gCAAgC;yBAC9D;wBACD,eAAe;qBAChB,CAAC,CAAC;iBACJ;aACF;SACF;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,aAAa,EAAE;gBACjB,aAAa,CAAC;oBACZ,UAAU,EAAE;wBACV,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,wBAAwB,GAAG,CAAC,MAAA,CAAC,CAAC,OAAO,mCAAI,2BAA2B,CAAC;qBAC5E;oBACD,eAAe;iBAChB,CAAC,CAAC;aACJ;YACD,MAAM,CAAC,CAAC;SACT;IACH,CAAC;CACF;AA1LD,sCA0LC","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 type { SpawnSyncReturns } from 'child_process';\nimport { JsonFile, JsonObject, Executable } from '@rushstack/node-core-library';\n\nimport {\n tryFindRushJsonLocation,\n RUSH_LIB_NAME,\n RushLibModuleType,\n requireRushLibUnderFolderPath,\n sdkContext\n} from './helpers';\n\ndeclare const global: NodeJS.Global &\n typeof globalThis & {\n ___rush___rushLibModule?: RushLibModuleType;\n ___rush___rushLibModuleFromEnvironment?: RushLibModuleType;\n ___rush___rushLibModuleFromInstallAndRunRush?: RushLibModuleType;\n };\n\n/**\n * Type of {@link ISdkCallbackEvent.logMessage}\n * @public\n */\nexport interface IProgressBarCallbackLogMessage {\n /**\n * A status message to print in the log window, or `undefined` if there are\n * no further messages. This string may contain newlines.\n */\n text: string;\n\n /**\n * The type of message. More message types may be added in the future.\n */\n kind: 'info' | 'debug';\n}\n\n/**\n * Event options for {@link ILoadSdkAsyncOptions.onNotifyEvent}\n * @public\n */\nexport interface ISdkCallbackEvent {\n /**\n * Allows the caller to display log information about the operation.\n */\n logMessage: IProgressBarCallbackLogMessage | undefined;\n\n /**\n * Allows the caller to display a progress bar for long-running operations.\n *\n * @remarks\n * If a long-running operation is required, then `progressPercent` will\n * start at 0.0 and count upwards and finish at 100.0 if the operation completes\n * successfully. If the long-running operation has not yet started, or\n * is not required, then the value will be `undefined`.\n */\n progressPercent: number | undefined;\n}\n\n/**\n * Type of {@link ILoadSdkAsyncOptions.onNotifyEvent}\n * @public\n */\nexport type SdkNotifyEventCallback = (sdkEvent: ISdkCallbackEvent) => void;\n\n/**\n * Options for {@link RushSdkLoader.loadAsync}\n * @public\n */\nexport interface ILoadSdkAsyncOptions {\n /**\n * The folder to start from when searching for the Rush workspace configuration.\n * If this folder does not contain a `rush.json` file, then each parent folder\n * will be searched. If `rush.json` is not found, then the SDK fails to load.\n */\n rushJsonSearchFolder?: string;\n\n /**\n * A cancellation token that the caller can use to prematurely abort the operation.\n */\n abortSignal?: AbortSignal;\n\n /**\n * Allows the caller to monitor the progress of the operation.\n */\n onNotifyEvent?: SdkNotifyEventCallback;\n}\n\n/**\n * Exposes operations that control how the `@microsoft/rush-lib` engine is\n * located and loaded.\n * @public\n */\nexport class RushSdkLoader {\n /**\n * Throws an \"AbortError\" exception if abortSignal.aborted is true.\n */\n private static _checkForCancel(\n abortSignal: AbortSignal,\n onNotifyEvent: SdkNotifyEventCallback | undefined,\n progressPercent: number | undefined\n ): void {\n if (!abortSignal.aborted) {\n return;\n }\n\n if (onNotifyEvent) {\n onNotifyEvent({\n logMessage: {\n kind: 'info',\n text: `The operation was canceled`\n },\n progressPercent\n });\n }\n\n const error: Error = new Error('The operation was canceled');\n error.name = 'AbortError';\n throw error;\n }\n\n /**\n * Returns true if the Rush engine has already been loaded.\n */\n public static get isLoaded(): boolean {\n return sdkContext.rushLibModule !== undefined;\n }\n\n /**\n * Manually load the Rush engine based on rush.json found for `rushJsonSearchFolder`.\n * Throws an exception if {@link RushSdkLoader.isLoaded} is already `true`.\n *\n * @remarks\n * This API supports an callback that can be used display a progress bar,\n * log of operations, and allow the operation to be canceled prematurely.\n */\n public static async loadAsync(options?: ILoadSdkAsyncOptions): Promise<void> {\n // SCENARIO 5: The rush-lib engine is loaded manually using rushSdkLoader.loadAsync().\n\n if (!options) {\n options = {};\n }\n\n if (RushSdkLoader.isLoaded) {\n throw new Error('RushSdkLoader.loadAsync() failed because the Rush engine has already been loaded');\n }\n\n const onNotifyEvent: SdkNotifyEventCallback | undefined = options.onNotifyEvent;\n let progressPercent: number | undefined = undefined;\n\n const abortSignal: AbortSignal = options.abortSignal ?? { aborted: false };\n\n try {\n const rushJsonSearchFolder: string = options.rushJsonSearchFolder ?? process.cwd();\n\n if (onNotifyEvent) {\n onNotifyEvent({\n logMessage: {\n kind: 'debug',\n text: `Searching for rush.json starting from: ` + rushJsonSearchFolder\n },\n progressPercent\n });\n }\n\n const rushJsonPath: string | undefined = tryFindRushJsonLocation(rushJsonSearchFolder);\n if (!rushJsonPath) {\n throw new Error(\n 'Unable to find rush.json in the specified folder or its parent folders:\\n' +\n `${rushJsonSearchFolder}\\n`\n );\n }\n const monorepoRoot: string = path.dirname(rushJsonPath);\n\n const rushJson: JsonObject = await JsonFile.loadAsync(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 if (onNotifyEvent) {\n onNotifyEvent({\n logMessage: {\n kind: 'info',\n text: `Trying to load ${RUSH_LIB_NAME} installed by install-run-rush`\n },\n progressPercent\n });\n }\n sdkContext.rushLibModule = requireRushLibUnderFolderPath(installRunNodeModuleFolder);\n } catch (e) {\n let installAndRunRushStderrContent: string = '';\n try {\n const installAndRunRushJSPath: string = path.join(\n monorepoRoot,\n 'common/scripts/install-run-rush.js'\n );\n\n if (onNotifyEvent) {\n onNotifyEvent({\n logMessage: {\n kind: 'info',\n text: 'The Rush engine has not been installed yet. Invoking install-run-rush.js...'\n },\n progressPercent\n });\n }\n\n // Start the installation\n progressPercent = 0;\n\n const installAndRunRushProcess: SpawnSyncReturns<string> = Executable.spawnSync(\n 'node',\n [installAndRunRushJSPath, '--help'],\n {\n stdio: 'pipe'\n }\n );\n\n installAndRunRushStderrContent = installAndRunRushProcess.stderr;\n if (installAndRunRushProcess.status !== 0) {\n throw new Error(`The ${RUSH_LIB_NAME} package failed to install`);\n }\n\n RushSdkLoader._checkForCancel(abortSignal, onNotifyEvent, progressPercent);\n\n // TODO: Implement incremental progress updates\n progressPercent = 90;\n\n // Retry to load \"rush-lib\" after install-run-rush run\n if (onNotifyEvent) {\n onNotifyEvent({\n logMessage: {\n kind: 'debug',\n text: `Trying to load ${RUSH_LIB_NAME} installed by install-run-rush a second time`\n },\n progressPercent\n });\n }\n\n sdkContext.rushLibModule = requireRushLibUnderFolderPath(installRunNodeModuleFolder);\n\n progressPercent = 100;\n } catch (e) {\n console.error(`${installAndRunRushStderrContent}`);\n throw new Error(`The ${RUSH_LIB_NAME} package failed to load`);\n }\n }\n\n if (sdkContext.rushLibModule !== undefined) {\n // to track which scenario is active and how it got initialized.\n global.___rush___rushLibModuleFromInstallAndRunRush = sdkContext.rushLibModule;\n if (onNotifyEvent) {\n onNotifyEvent({\n logMessage: {\n kind: 'debug',\n text: `Loaded ${RUSH_LIB_NAME} installed by install-run-rush`\n },\n progressPercent\n });\n }\n }\n } catch (e) {\n if (onNotifyEvent) {\n onNotifyEvent({\n logMessage: {\n kind: 'info',\n text: 'The operation failed: ' + (e.message ?? 'An unknown error occurred')\n },\n progressPercent\n });\n }\n throw e;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAE7B,oEAAgF;AAEhF,uCAMmB;AA4EnB;;;;GAIG;AACH,MAAa,aAAa;IACxB;;OAEG;IACK,MAAM,CAAC,eAAe,CAC5B,WAAwB,EACxB,aAAiD,EACjD,eAAmC;QAEnC,IAAI,CAAC,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,CA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AC;SACT;IACH,CAAC;CACF;AA5LD,sCA4LC","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 type { SpawnSyncReturns } from 'child_process';\nimport { JsonFile, JsonObject, Executable } from '@rushstack/node-core-library';\n\nimport {\n tryFindRushJsonLocation,\n RUSH_LIB_NAME,\n RushLibModuleType,\n requireRushLibUnderFolderPath,\n sdkContext\n} from './helpers';\n\ndeclare const global: typeof globalThis & {\n ___rush___rushLibModule?: RushLibModuleType;\n ___rush___rushLibModuleFromEnvironment?: RushLibModuleType;\n ___rush___rushLibModuleFromInstallAndRunRush?: RushLibModuleType;\n};\n\n/**\n * Type of {@link ISdkCallbackEvent.logMessage}\n * @public\n */\nexport interface IProgressBarCallbackLogMessage {\n /**\n * A status message to print in the log window, or `undefined` if there are\n * no further messages. This string may contain newlines.\n */\n text: string;\n\n /**\n * The type of message. More message types may be added in the future.\n */\n kind: 'info' | 'debug';\n}\n\n/**\n * Event options for {@link ILoadSdkAsyncOptions.onNotifyEvent}\n * @public\n */\nexport interface ISdkCallbackEvent {\n /**\n * Allows the caller to display log information about the operation.\n */\n logMessage: IProgressBarCallbackLogMessage | undefined;\n\n /**\n * Allows the caller to display a progress bar for long-running operations.\n *\n * @remarks\n * If a long-running operation is required, then `progressPercent` will\n * start at 0.0 and count upwards and finish at 100.0 if the operation completes\n * successfully. If the long-running operation has not yet started, or\n * is not required, then the value will be `undefined`.\n */\n progressPercent: number | undefined;\n}\n\n/**\n * Type of {@link ILoadSdkAsyncOptions.onNotifyEvent}\n * @public\n */\nexport type SdkNotifyEventCallback = (sdkEvent: ISdkCallbackEvent) => void;\n\n/**\n * Options for {@link RushSdkLoader.loadAsync}\n * @public\n */\nexport interface ILoadSdkAsyncOptions {\n /**\n * The folder to start from when searching for the Rush workspace configuration.\n * If this folder does not contain a `rush.json` file, then each parent folder\n * will be searched. If `rush.json` is not found, then the SDK fails to load.\n */\n rushJsonSearchFolder?: string;\n\n /**\n * A cancellation token that the caller can use to prematurely abort the operation.\n */\n abortSignal?: AbortSignal;\n\n /**\n * Allows the caller to monitor the progress of the operation.\n */\n onNotifyEvent?: SdkNotifyEventCallback;\n}\n\n/**\n * Exposes operations that control how the `@microsoft/rush-lib` engine is\n * located and loaded.\n * @public\n */\nexport class RushSdkLoader {\n /**\n * Throws an \"AbortError\" exception if abortSignal.aborted is true.\n */\n private static _checkForCancel(\n abortSignal: AbortSignal,\n onNotifyEvent: SdkNotifyEventCallback | undefined,\n progressPercent: number | undefined\n ): void {\n if (!abortSignal?.aborted) {\n return;\n }\n\n if (onNotifyEvent) {\n onNotifyEvent({\n logMessage: {\n kind: 'info',\n text: `The operation was canceled`\n },\n progressPercent\n });\n }\n\n const error: Error = new Error('The operation was canceled');\n error.name = 'AbortError';\n throw error;\n }\n\n /**\n * Returns true if the Rush engine has already been loaded.\n */\n public static get isLoaded(): boolean {\n return sdkContext.rushLibModule !== undefined;\n }\n\n /**\n * Manually load the Rush engine based on rush.json found for `rushJsonSearchFolder`.\n * Throws an exception if {@link RushSdkLoader.isLoaded} is already `true`.\n *\n * @remarks\n * This API supports an callback that can be used display a progress bar,\n * log of operations, and allow the operation to be canceled prematurely.\n */\n public static async loadAsync(options?: ILoadSdkAsyncOptions): Promise<void> {\n // SCENARIO 5: The rush-lib engine is loaded manually using rushSdkLoader.loadAsync().\n\n if (!options) {\n options = {};\n }\n\n if (RushSdkLoader.isLoaded) {\n throw new Error('RushSdkLoader.loadAsync() failed because the Rush engine has already been loaded');\n }\n\n const onNotifyEvent: SdkNotifyEventCallback | undefined = options.onNotifyEvent;\n let progressPercent: number | undefined = undefined;\n\n const abortSignal: AbortSignal | undefined = options.abortSignal;\n\n try {\n const rushJsonSearchFolder: string = options.rushJsonSearchFolder ?? process.cwd();\n\n if (onNotifyEvent) {\n onNotifyEvent({\n logMessage: {\n kind: 'debug',\n text: `Searching for rush.json starting from: ` + rushJsonSearchFolder\n },\n progressPercent\n });\n }\n\n const rushJsonPath: string | undefined = tryFindRushJsonLocation(rushJsonSearchFolder);\n if (!rushJsonPath) {\n throw new Error(\n 'Unable to find rush.json in the specified folder or its parent folders:\\n' +\n `${rushJsonSearchFolder}\\n`\n );\n }\n const monorepoRoot: string = path.dirname(rushJsonPath);\n\n const rushJson: JsonObject = await JsonFile.loadAsync(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 if (onNotifyEvent) {\n onNotifyEvent({\n logMessage: {\n kind: 'info',\n text: `Trying to load ${RUSH_LIB_NAME} installed by install-run-rush`\n },\n progressPercent\n });\n }\n sdkContext.rushLibModule = requireRushLibUnderFolderPath(installRunNodeModuleFolder);\n } catch (e) {\n let installAndRunRushStderrContent: string = '';\n try {\n const installAndRunRushJSPath: string = path.join(\n monorepoRoot,\n 'common/scripts/install-run-rush.js'\n );\n\n if (onNotifyEvent) {\n onNotifyEvent({\n logMessage: {\n kind: 'info',\n text: 'The Rush engine has not been installed yet. Invoking install-run-rush.js...'\n },\n progressPercent\n });\n }\n\n // Start the installation\n progressPercent = 0;\n\n const installAndRunRushProcess: SpawnSyncReturns<string> = Executable.spawnSync(\n 'node',\n [installAndRunRushJSPath, '--help'],\n {\n stdio: 'pipe'\n }\n );\n\n installAndRunRushStderrContent = installAndRunRushProcess.stderr;\n if (installAndRunRushProcess.status !== 0) {\n throw new Error(`The ${RUSH_LIB_NAME} package failed to install`);\n }\n\n if (abortSignal) {\n RushSdkLoader._checkForCancel(abortSignal, onNotifyEvent, progressPercent);\n }\n\n // TODO: Implement incremental progress updates\n progressPercent = 90;\n\n // Retry to load \"rush-lib\" after install-run-rush run\n if (onNotifyEvent) {\n onNotifyEvent({\n logMessage: {\n kind: 'debug',\n text: `Trying to load ${RUSH_LIB_NAME} installed by install-run-rush a second time`\n },\n progressPercent\n });\n }\n\n sdkContext.rushLibModule = requireRushLibUnderFolderPath(installRunNodeModuleFolder);\n\n progressPercent = 100;\n } catch (e) {\n console.error(`${installAndRunRushStderrContent}`);\n throw new Error(`The ${RUSH_LIB_NAME} package failed to load`);\n }\n }\n\n if (sdkContext.rushLibModule !== undefined) {\n // to track which scenario is active and how it got initialized.\n global.___rush___rushLibModuleFromInstallAndRunRush = sdkContext.rushLibModule;\n if (onNotifyEvent) {\n onNotifyEvent({\n logMessage: {\n kind: 'debug',\n text: `Loaded ${RUSH_LIB_NAME} installed by install-run-rush`\n },\n progressPercent\n });\n }\n }\n } catch (e) {\n if (onNotifyEvent) {\n onNotifyEvent({\n logMessage: {\n kind: 'info',\n text: 'The operation failed: ' + (e.message ?? 'An unknown error occurred')\n },\n progressPercent\n });\n }\n throw e;\n }\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/rush-sdk",
3
- "version": "5.105.0",
3
+ "version": "5.107.0",
4
4
  "description": "An API for interacting with the Rush engine",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,19 +25,19 @@
25
25
  "dependencies": {
26
26
  "@types/node-fetch": "2.6.2",
27
27
  "tapable": "2.2.1",
28
- "@rushstack/node-core-library": "3.59.7"
28
+ "@rushstack/node-core-library": "3.60.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@types/node": "14.18.36",
31
+ "@types/node": "18.17.15",
32
32
  "@types/semver": "7.5.0",
33
33
  "@types/webpack-env": "1.18.0",
34
- "@microsoft/rush-lib": "5.105.0",
35
- "@rushstack/eslint-config": "3.3.3",
36
- "@rushstack/heft": "0.58.2",
37
- "@rushstack/heft-node-rig": "2.2.22",
38
- "@rushstack/stream-collator": "4.0.263",
39
- "@rushstack/ts-command-line": "4.15.2",
40
- "@rushstack/terminal": "0.5.38"
34
+ "@microsoft/rush-lib": "5.107.0",
35
+ "@rushstack/eslint-config": "3.3.4",
36
+ "@rushstack/heft": "0.59.0",
37
+ "@rushstack/heft-node-rig": "2.2.23",
38
+ "@rushstack/stream-collator": "4.1.1",
39
+ "@rushstack/ts-command-line": "4.16.0",
40
+ "@rushstack/terminal": "0.7.0"
41
41
  },
42
42
  "scripts": {
43
43
  "build": "heft build --clean",