@rushstack/rush-sdk 5.112.1 → 5.112.2-pr4485.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.
- package/dist/rush-lib.d.ts +99 -2
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/api/ExperimentsConfiguration.d.ts +2 -2
- package/lib/api/RushConfiguration.d.ts +49 -0
- package/lib/api/RushConfigurationProject.d.ts +13 -0
- package/lib/api/RushProjectConfiguration.d.ts +7 -0
- package/lib/api/SubspaceConfiguration.d.ts +26 -0
- package/lib/api/SubspaceConfiguration.js +1 -0
- package/lib/api/VersionPolicy.d.ts +8 -0
- package/lib/cli/actions/InitAction.d.ts +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/logic/PublishUtilities.d.ts +0 -1
- package/lib/logic/RushConstants.d.ts +4 -0
- package/lib/logic/operations/IOperationRunner.d.ts +7 -0
- package/lib/logic/operations/OperationExecutionRecord.d.ts +6 -1
- package/lib/logic/operations/ProjectLogWritable.d.ts +0 -1
- package/lib/logic/operations/ShellOperationRunner.d.ts +3 -10
- package/lib/utilities/Utilities.d.ts +4 -0
- package/lib-shim/helpers.js.map +1 -1
- package/lib-shim/index.js.map +1 -1
- package/lib-shim/loader.js.map +1 -1
- package/package.json +7 -7
package/dist/rush-lib.d.ts
CHANGED
|
@@ -181,11 +181,19 @@ export declare class BuildCacheConfiguration {
|
|
|
181
181
|
/**
|
|
182
182
|
* Type of version bumps
|
|
183
183
|
* @public
|
|
184
|
+
*
|
|
185
|
+
* @internalRemarks
|
|
186
|
+
* This is a copy of the semver ReleaseType enum, but with the `none` value added and
|
|
187
|
+
* the `premajor` and `prepatch` omitted.
|
|
188
|
+
* See {@link LockStepVersionPolicy._getReleaseType}.
|
|
189
|
+
*
|
|
190
|
+
* TODO: Consider supporting `premajor` and `prepatch` in the future.
|
|
184
191
|
*/
|
|
185
192
|
export declare enum BumpType {
|
|
186
193
|
'none' = 0,
|
|
187
194
|
'prerelease' = 1,
|
|
188
195
|
'patch' = 2,
|
|
196
|
+
'preminor' = 3,
|
|
189
197
|
'minor' = 4,
|
|
190
198
|
'major' = 5
|
|
191
199
|
}
|
|
@@ -1272,12 +1280,12 @@ export declare interface IExecutionResult {
|
|
|
1272
1280
|
export declare interface IExperimentsJson {
|
|
1273
1281
|
/**
|
|
1274
1282
|
* By default, 'rush install' passes --no-prefer-frozen-lockfile to 'pnpm install'.
|
|
1275
|
-
* Set this option to true to pass '--frozen-lockfile' instead.
|
|
1283
|
+
* Set this option to true to pass '--frozen-lockfile' instead for faster installs.
|
|
1276
1284
|
*/
|
|
1277
1285
|
usePnpmFrozenLockfileForRushInstall?: boolean;
|
|
1278
1286
|
/**
|
|
1279
1287
|
* By default, 'rush update' passes --no-prefer-frozen-lockfile to 'pnpm install'.
|
|
1280
|
-
* Set this option to true to pass '--prefer-frozen-lockfile' instead.
|
|
1288
|
+
* Set this option to true to pass '--prefer-frozen-lockfile' instead to minimize shrinkwrap changes.
|
|
1281
1289
|
*/
|
|
1282
1290
|
usePnpmPreferFrozenLockfileForRushUpdate?: boolean;
|
|
1283
1291
|
/**
|
|
@@ -1686,6 +1694,12 @@ export declare interface IOperationRunnerContext {
|
|
|
1686
1694
|
* ignore dependent projects.
|
|
1687
1695
|
*/
|
|
1688
1696
|
readonly changedProjectsOnly: boolean;
|
|
1697
|
+
/**
|
|
1698
|
+
* Invokes the specified callback with a terminal that is associated with this operation.
|
|
1699
|
+
*
|
|
1700
|
+
* Will write to a log file corresponding to the phase and project, and clean it up upon completion.
|
|
1701
|
+
*/
|
|
1702
|
+
withTerminalAsync<T>(callback: (terminal: ITerminal, terminalProvider: ITerminalProvider) => Promise<T>, createLogFile: boolean, logFileSuffix?: string): Promise<T>;
|
|
1689
1703
|
}
|
|
1690
1704
|
|
|
1691
1705
|
/**
|
|
@@ -1734,6 +1748,13 @@ export declare interface IOperationSettings {
|
|
|
1734
1748
|
* calculating final hash value when reading and writing the build cache
|
|
1735
1749
|
*/
|
|
1736
1750
|
dependsOnAdditionalFiles?: string[];
|
|
1751
|
+
/**
|
|
1752
|
+
* When running this operation in watch mode, enable IPC functionality. This allows reusing a long-lived child
|
|
1753
|
+
* process instead of spawning a new child process for each incremental build.
|
|
1754
|
+
*
|
|
1755
|
+
* Implicitly disables the build cache for this operation.
|
|
1756
|
+
*/
|
|
1757
|
+
useIPCInWatchMode?: boolean;
|
|
1737
1758
|
}
|
|
1738
1759
|
|
|
1739
1760
|
/**
|
|
@@ -1989,6 +2010,7 @@ declare interface IRushConfigurationProjectJson {
|
|
|
1989
2010
|
skipRushCheck?: boolean;
|
|
1990
2011
|
publishFolder?: string;
|
|
1991
2012
|
tags?: string[];
|
|
2013
|
+
subspaceName?: string;
|
|
1992
2014
|
}
|
|
1993
2015
|
|
|
1994
2016
|
/**
|
|
@@ -3264,6 +3286,7 @@ export declare class RushConfiguration {
|
|
|
3264
3286
|
private _projects;
|
|
3265
3287
|
private _projectsByName;
|
|
3266
3288
|
private _projectsByTag;
|
|
3289
|
+
private _rushProjectsBySubspaceName;
|
|
3267
3290
|
private _commonVersionsConfigurationsByVariant;
|
|
3268
3291
|
/**
|
|
3269
3292
|
* The name of the package manager being used to install dependencies
|
|
@@ -3372,6 +3395,11 @@ export declare class RushConfiguration {
|
|
|
3372
3395
|
* or `C:\MyRepo\common\temp\pnpm-lock-preinstall.yaml`
|
|
3373
3396
|
*/
|
|
3374
3397
|
readonly tempShrinkwrapPreinstallFilename: string;
|
|
3398
|
+
/**
|
|
3399
|
+
* The object that specifies subspace configurations if they are provided in the rush workspace.
|
|
3400
|
+
* @beta
|
|
3401
|
+
*/
|
|
3402
|
+
readonly subspaceConfiguration?: SubspaceConfiguration;
|
|
3375
3403
|
/**
|
|
3376
3404
|
* The filename of the variant dependency data file. By default this is
|
|
3377
3405
|
* called 'current-variant.json' resides in the Rush common folder.
|
|
@@ -3610,6 +3638,25 @@ export declare class RushConfiguration {
|
|
|
3610
3638
|
* shrinkwrap file name for a given active variant.
|
|
3611
3639
|
*/
|
|
3612
3640
|
get committedShrinkwrapFilename(): string;
|
|
3641
|
+
/**
|
|
3642
|
+
* Returns full path of the temporary shrinkwrap file for a specific subspace.
|
|
3643
|
+
* @remarks
|
|
3644
|
+
* This function takes the subspace name, and returns the full path for the subspace's shrinkwrap file.
|
|
3645
|
+
* This function also consults the deprecated option to allow for shrinkwraps to be stored under a package folder.
|
|
3646
|
+
* This shrinkwrap file is used during "rush install", and may be rewritten by the package manager during installation
|
|
3647
|
+
* This property merely reports the filename, the file itself may not actually exist.
|
|
3648
|
+
* example: `C:\MyRepo\common\<subspace_name>\pnpm-lock.yaml`
|
|
3649
|
+
* @beta
|
|
3650
|
+
*/
|
|
3651
|
+
getTempSubspaceShrinkwrapFileName(subspaceName: string): string;
|
|
3652
|
+
/**
|
|
3653
|
+
* The filename (without any path) of the shrinkwrap file used for individual subspaces, used by the package manager.
|
|
3654
|
+
* @remarks
|
|
3655
|
+
* This property merely reports the filename; The file itself may not actually exist.
|
|
3656
|
+
* Example: From "pnpm-lock.yaml" to "subspace-pnpm-lock.yaml"
|
|
3657
|
+
* @beta
|
|
3658
|
+
*/
|
|
3659
|
+
subspaceShrinkwrapFilenames(subspaceName: string): string;
|
|
3613
3660
|
/**
|
|
3614
3661
|
* Returns an English phrase such as "shrinkwrap file" that can be used in logging messages
|
|
3615
3662
|
* to refer to the shrinkwrap file using appropriate terminology for the currently selected
|
|
@@ -3632,6 +3679,14 @@ export declare class RushConfiguration {
|
|
|
3632
3679
|
*/
|
|
3633
3680
|
get repositoryDefaultFullyQualifiedRemoteBranch(): string;
|
|
3634
3681
|
get projects(): RushConfigurationProject[];
|
|
3682
|
+
/**
|
|
3683
|
+
* A list of all the available subspaces in this workspace.
|
|
3684
|
+
* @beta
|
|
3685
|
+
*/
|
|
3686
|
+
get subspaceNames(): Iterable<string>;
|
|
3687
|
+
/**
|
|
3688
|
+
* @beta
|
|
3689
|
+
*/
|
|
3635
3690
|
get projectsByName(): Map<string, RushConfigurationProject>;
|
|
3636
3691
|
/**
|
|
3637
3692
|
* Obtains the mapping from custom tags to projects.
|
|
@@ -3661,6 +3716,12 @@ export declare class RushConfiguration {
|
|
|
3661
3716
|
* @param variant - The name of the current variant in use by the active command.
|
|
3662
3717
|
*/
|
|
3663
3718
|
getCommonVersionsFilePath(variant?: string | undefined): string;
|
|
3719
|
+
/**
|
|
3720
|
+
* Returns `true` if the subspaces feature is enabled and at least one subspaces is defined
|
|
3721
|
+
* in the `subspaces.json` config file.
|
|
3722
|
+
* @beta
|
|
3723
|
+
*/
|
|
3724
|
+
get hasSubspaces(): boolean;
|
|
3664
3725
|
/**
|
|
3665
3726
|
* Gets the settings from the common-versions.json config file for a specific variant.
|
|
3666
3727
|
* @param variant - The name of the current variant in use by the active command.
|
|
@@ -3838,6 +3899,18 @@ export declare class RushConfigurationProject {
|
|
|
3838
3899
|
* @beta
|
|
3839
3900
|
*/
|
|
3840
3901
|
readonly tags: ReadonlySet<string>;
|
|
3902
|
+
/**
|
|
3903
|
+
* Returns the name of the subspace that this project belongs to, as assigned by the `"subspaceName"`
|
|
3904
|
+
* property in `rush.json`.
|
|
3905
|
+
*
|
|
3906
|
+
* @remarks
|
|
3907
|
+
* If the Rush subspaces feature is disabled, the value is still return.
|
|
3908
|
+
* When the Rush subspaces feature is enabled, an undefined `subspaceName` specifies that
|
|
3909
|
+
* the project belongs to the default subspace (whose name is `"default"`).
|
|
3910
|
+
*
|
|
3911
|
+
* @beta
|
|
3912
|
+
*/
|
|
3913
|
+
readonly subspaceName: string | undefined;
|
|
3841
3914
|
/** @internal */
|
|
3842
3915
|
constructor(options: IRushConfigurationProjectOptions);
|
|
3843
3916
|
/**
|
|
@@ -4049,6 +4122,10 @@ export declare class RushConstants {
|
|
|
4049
4122
|
* The artifactory.json configuration file name.
|
|
4050
4123
|
*/
|
|
4051
4124
|
static readonly artifactoryFilename: string;
|
|
4125
|
+
/**
|
|
4126
|
+
* The subspaces.json configuration file name
|
|
4127
|
+
*/
|
|
4128
|
+
static readonly subspacesConfigFilename: string;
|
|
4052
4129
|
/**
|
|
4053
4130
|
* Build cache configuration file.
|
|
4054
4131
|
*/
|
|
@@ -4313,6 +4390,26 @@ export declare class RushUserConfiguration {
|
|
|
4313
4390
|
static getRushUserFolderPath(): string;
|
|
4314
4391
|
}
|
|
4315
4392
|
|
|
4393
|
+
/**
|
|
4394
|
+
* This represents the subspace configurations for a repository, based on the "subspaces.json"
|
|
4395
|
+
* configuration file.
|
|
4396
|
+
* @beta
|
|
4397
|
+
*/
|
|
4398
|
+
export declare class SubspaceConfiguration {
|
|
4399
|
+
private static _jsonSchema;
|
|
4400
|
+
/**
|
|
4401
|
+
* The absolute path to the "subspaces.json" configuration file that was loaded to construct this object.
|
|
4402
|
+
*/
|
|
4403
|
+
readonly subspaceJsonFilePath: string;
|
|
4404
|
+
/**
|
|
4405
|
+
* A set of the available subspaces
|
|
4406
|
+
*/
|
|
4407
|
+
readonly subspaceNames: Set<string>;
|
|
4408
|
+
private constructor();
|
|
4409
|
+
static tryLoadFromConfigurationFile(subspaceJsonFilePath: string): SubspaceConfiguration | undefined;
|
|
4410
|
+
static tryLoadFromDefaultLocation(rushConfiguration: RushConfiguration): SubspaceConfiguration | undefined;
|
|
4411
|
+
}
|
|
4412
|
+
|
|
4316
4413
|
declare enum VersionFormatForCommit {
|
|
4317
4414
|
wildcard = "wildcard",
|
|
4318
4415
|
original = "original"
|
package/dist/tsdoc-metadata.json
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
export interface IExperimentsJson {
|
|
7
7
|
/**
|
|
8
8
|
* By default, 'rush install' passes --no-prefer-frozen-lockfile to 'pnpm install'.
|
|
9
|
-
* Set this option to true to pass '--frozen-lockfile' instead.
|
|
9
|
+
* Set this option to true to pass '--frozen-lockfile' instead for faster installs.
|
|
10
10
|
*/
|
|
11
11
|
usePnpmFrozenLockfileForRushInstall?: boolean;
|
|
12
12
|
/**
|
|
13
13
|
* By default, 'rush update' passes --no-prefer-frozen-lockfile to 'pnpm install'.
|
|
14
|
-
* Set this option to true to pass '--prefer-frozen-lockfile' instead.
|
|
14
|
+
* Set this option to true to pass '--prefer-frozen-lockfile' instead to minimize shrinkwrap changes.
|
|
15
15
|
*/
|
|
16
16
|
usePnpmPreferFrozenLockfileForRushUpdate?: boolean;
|
|
17
17
|
/**
|
|
@@ -14,6 +14,7 @@ import { type INpmOptionsJson, NpmOptionsConfiguration } from '../logic/npm/NpmO
|
|
|
14
14
|
import { type IYarnOptionsJson, YarnOptionsConfiguration } from '../logic/yarn/YarnOptionsConfiguration';
|
|
15
15
|
import type { PackageManagerOptionsConfigurationBase } from '../logic/base/BasePackageManagerOptionsConfiguration';
|
|
16
16
|
import { CustomTipsConfiguration } from './CustomTipsConfiguration';
|
|
17
|
+
import { SubspaceConfiguration } from './SubspaceConfiguration';
|
|
17
18
|
/**
|
|
18
19
|
* Part of IRushConfigurationJson.
|
|
19
20
|
*/
|
|
@@ -118,6 +119,15 @@ export interface IRushConfigurationJson {
|
|
|
118
119
|
export interface ICurrentVariantJson {
|
|
119
120
|
variant: string | JsonNull;
|
|
120
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* The filter parameters to search from all projects
|
|
124
|
+
*/
|
|
125
|
+
export interface IRushConfigurationProjectsFilter {
|
|
126
|
+
/**
|
|
127
|
+
* A string representation of the subspace to filter for
|
|
128
|
+
*/
|
|
129
|
+
subspace: string;
|
|
130
|
+
}
|
|
121
131
|
/**
|
|
122
132
|
* Options for `RushConfiguration.tryFindRushJsonLocation`.
|
|
123
133
|
* @public
|
|
@@ -144,6 +154,7 @@ export declare class RushConfiguration {
|
|
|
144
154
|
private _projects;
|
|
145
155
|
private _projectsByName;
|
|
146
156
|
private _projectsByTag;
|
|
157
|
+
private _rushProjectsBySubspaceName;
|
|
147
158
|
private _commonVersionsConfigurationsByVariant;
|
|
148
159
|
/**
|
|
149
160
|
* The name of the package manager being used to install dependencies
|
|
@@ -252,6 +263,11 @@ export declare class RushConfiguration {
|
|
|
252
263
|
* or `C:\MyRepo\common\temp\pnpm-lock-preinstall.yaml`
|
|
253
264
|
*/
|
|
254
265
|
readonly tempShrinkwrapPreinstallFilename: string;
|
|
266
|
+
/**
|
|
267
|
+
* The object that specifies subspace configurations if they are provided in the rush workspace.
|
|
268
|
+
* @beta
|
|
269
|
+
*/
|
|
270
|
+
readonly subspaceConfiguration?: SubspaceConfiguration;
|
|
255
271
|
/**
|
|
256
272
|
* The filename of the variant dependency data file. By default this is
|
|
257
273
|
* called 'current-variant.json' resides in the Rush common folder.
|
|
@@ -490,6 +506,25 @@ export declare class RushConfiguration {
|
|
|
490
506
|
* shrinkwrap file name for a given active variant.
|
|
491
507
|
*/
|
|
492
508
|
get committedShrinkwrapFilename(): string;
|
|
509
|
+
/**
|
|
510
|
+
* Returns full path of the temporary shrinkwrap file for a specific subspace.
|
|
511
|
+
* @remarks
|
|
512
|
+
* This function takes the subspace name, and returns the full path for the subspace's shrinkwrap file.
|
|
513
|
+
* This function also consults the deprecated option to allow for shrinkwraps to be stored under a package folder.
|
|
514
|
+
* This shrinkwrap file is used during "rush install", and may be rewritten by the package manager during installation
|
|
515
|
+
* This property merely reports the filename, the file itself may not actually exist.
|
|
516
|
+
* example: `C:\MyRepo\common\<subspace_name>\pnpm-lock.yaml`
|
|
517
|
+
* @beta
|
|
518
|
+
*/
|
|
519
|
+
getTempSubspaceShrinkwrapFileName(subspaceName: string): string;
|
|
520
|
+
/**
|
|
521
|
+
* The filename (without any path) of the shrinkwrap file used for individual subspaces, used by the package manager.
|
|
522
|
+
* @remarks
|
|
523
|
+
* This property merely reports the filename; The file itself may not actually exist.
|
|
524
|
+
* Example: From "pnpm-lock.yaml" to "subspace-pnpm-lock.yaml"
|
|
525
|
+
* @beta
|
|
526
|
+
*/
|
|
527
|
+
subspaceShrinkwrapFilenames(subspaceName: string): string;
|
|
493
528
|
/**
|
|
494
529
|
* Returns an English phrase such as "shrinkwrap file" that can be used in logging messages
|
|
495
530
|
* to refer to the shrinkwrap file using appropriate terminology for the currently selected
|
|
@@ -512,6 +547,14 @@ export declare class RushConfiguration {
|
|
|
512
547
|
*/
|
|
513
548
|
get repositoryDefaultFullyQualifiedRemoteBranch(): string;
|
|
514
549
|
get projects(): RushConfigurationProject[];
|
|
550
|
+
/**
|
|
551
|
+
* A list of all the available subspaces in this workspace.
|
|
552
|
+
* @beta
|
|
553
|
+
*/
|
|
554
|
+
get subspaceNames(): Iterable<string>;
|
|
555
|
+
/**
|
|
556
|
+
* @beta
|
|
557
|
+
*/
|
|
515
558
|
get projectsByName(): Map<string, RushConfigurationProject>;
|
|
516
559
|
/**
|
|
517
560
|
* Obtains the mapping from custom tags to projects.
|
|
@@ -541,6 +584,12 @@ export declare class RushConfiguration {
|
|
|
541
584
|
* @param variant - The name of the current variant in use by the active command.
|
|
542
585
|
*/
|
|
543
586
|
getCommonVersionsFilePath(variant?: string | undefined): string;
|
|
587
|
+
/**
|
|
588
|
+
* Returns `true` if the subspaces feature is enabled and at least one subspaces is defined
|
|
589
|
+
* in the `subspaces.json` config file.
|
|
590
|
+
* @beta
|
|
591
|
+
*/
|
|
592
|
+
get hasSubspaces(): boolean;
|
|
544
593
|
/**
|
|
545
594
|
* Gets the settings from the common-versions.json config file for a specific variant.
|
|
546
595
|
* @param variant - The name of the current variant in use by the active command.
|
|
@@ -16,6 +16,7 @@ export interface IRushConfigurationProjectJson {
|
|
|
16
16
|
skipRushCheck?: boolean;
|
|
17
17
|
publishFolder?: string;
|
|
18
18
|
tags?: string[];
|
|
19
|
+
subspaceName?: string;
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
21
22
|
* @internal
|
|
@@ -151,6 +152,18 @@ export declare class RushConfigurationProject {
|
|
|
151
152
|
* @beta
|
|
152
153
|
*/
|
|
153
154
|
readonly tags: ReadonlySet<string>;
|
|
155
|
+
/**
|
|
156
|
+
* Returns the name of the subspace that this project belongs to, as assigned by the `"subspaceName"`
|
|
157
|
+
* property in `rush.json`.
|
|
158
|
+
*
|
|
159
|
+
* @remarks
|
|
160
|
+
* If the Rush subspaces feature is disabled, the value is still return.
|
|
161
|
+
* When the Rush subspaces feature is enabled, an undefined `subspaceName` specifies that
|
|
162
|
+
* the project belongs to the default subspace (whose name is `"default"`).
|
|
163
|
+
*
|
|
164
|
+
* @beta
|
|
165
|
+
*/
|
|
166
|
+
readonly subspaceName: string | undefined;
|
|
154
167
|
/** @internal */
|
|
155
168
|
constructor(options: IRushConfigurationProjectOptions);
|
|
156
169
|
/**
|
|
@@ -73,6 +73,13 @@ export interface IOperationSettings {
|
|
|
73
73
|
* calculating final hash value when reading and writing the build cache
|
|
74
74
|
*/
|
|
75
75
|
dependsOnAdditionalFiles?: string[];
|
|
76
|
+
/**
|
|
77
|
+
* When running this operation in watch mode, enable IPC functionality. This allows reusing a long-lived child
|
|
78
|
+
* process instead of spawning a new child process for each incremental build.
|
|
79
|
+
*
|
|
80
|
+
* Implicitly disables the build cache for this operation.
|
|
81
|
+
*/
|
|
82
|
+
useIPCInWatchMode?: boolean;
|
|
76
83
|
}
|
|
77
84
|
/**
|
|
78
85
|
* Use this class to load the "config/rush-project.json" config file.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { RushConfiguration } from './RushConfiguration';
|
|
2
|
+
/**
|
|
3
|
+
* The allowed naming convention for subspace names.
|
|
4
|
+
* Allows for names to be formed of letters, numbers, and hyphens (-)
|
|
5
|
+
*/
|
|
6
|
+
export declare const SUBSPACE_NAME_REGEXP: RegExp;
|
|
7
|
+
/**
|
|
8
|
+
* This represents the subspace configurations for a repository, based on the "subspaces.json"
|
|
9
|
+
* configuration file.
|
|
10
|
+
* @beta
|
|
11
|
+
*/
|
|
12
|
+
export declare class SubspaceConfiguration {
|
|
13
|
+
private static _jsonSchema;
|
|
14
|
+
/**
|
|
15
|
+
* The absolute path to the "subspaces.json" configuration file that was loaded to construct this object.
|
|
16
|
+
*/
|
|
17
|
+
readonly subspaceJsonFilePath: string;
|
|
18
|
+
/**
|
|
19
|
+
* A set of the available subspaces
|
|
20
|
+
*/
|
|
21
|
+
readonly subspaceNames: Set<string>;
|
|
22
|
+
private constructor();
|
|
23
|
+
static tryLoadFromConfigurationFile(subspaceJsonFilePath: string): SubspaceConfiguration | undefined;
|
|
24
|
+
static tryLoadFromDefaultLocation(rushConfiguration: RushConfiguration): SubspaceConfiguration | undefined;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=SubspaceConfiguration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("../../lib-shim/index")._rushSdk_loadInternalModule("api/SubspaceConfiguration");
|
|
@@ -4,11 +4,19 @@ import type { RushConfiguration } from './RushConfiguration';
|
|
|
4
4
|
/**
|
|
5
5
|
* Type of version bumps
|
|
6
6
|
* @public
|
|
7
|
+
*
|
|
8
|
+
* @internalRemarks
|
|
9
|
+
* This is a copy of the semver ReleaseType enum, but with the `none` value added and
|
|
10
|
+
* the `premajor` and `prepatch` omitted.
|
|
11
|
+
* See {@link LockStepVersionPolicy._getReleaseType}.
|
|
12
|
+
*
|
|
13
|
+
* TODO: Consider supporting `premajor` and `prepatch` in the future.
|
|
7
14
|
*/
|
|
8
15
|
export declare enum BumpType {
|
|
9
16
|
'none' = 0,
|
|
10
17
|
'prerelease' = 1,
|
|
11
18
|
'patch' = 2,
|
|
19
|
+
'preminor' = 3,
|
|
12
20
|
'minor' = 4,
|
|
13
21
|
'major' = 5
|
|
14
22
|
}
|
|
@@ -3,6 +3,7 @@ import { BaseConfiglessRushAction } from './BaseRushAction';
|
|
|
3
3
|
export declare class InitAction extends BaseConfiglessRushAction {
|
|
4
4
|
private readonly _overwriteParameter;
|
|
5
5
|
private readonly _rushExampleParameter;
|
|
6
|
+
private readonly _experimentsParameter;
|
|
6
7
|
private _commentedBySectionName;
|
|
7
8
|
constructor(parser: RushCommandLineParser);
|
|
8
9
|
protected runAsync(): Promise<void>;
|
package/lib/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { ApprovedPackagesPolicy } from './api/ApprovedPackagesPolicy';
|
|
6
6
|
export { RushConfiguration, ITryFindRushJsonLocationOptions } from './api/RushConfiguration';
|
|
7
|
+
export { SubspaceConfiguration } from './api/SubspaceConfiguration';
|
|
7
8
|
export { IPackageManagerOptionsJsonBase, IConfigurationEnvironment, IConfigurationEnvironmentVariable, PackageManagerOptionsConfigurationBase } from './logic/base/BasePackageManagerOptionsConfiguration';
|
|
8
9
|
export { INpmOptionsJson as _INpmOptionsJson, NpmOptionsConfiguration } from './logic/npm/NpmOptionsConfiguration';
|
|
9
10
|
export { IYarnOptionsJson as _IYarnOptionsJson, YarnOptionsConfiguration } from './logic/yarn/YarnOptionsConfiguration';
|
|
@@ -43,7 +43,6 @@ export declare class PublishUtilities {
|
|
|
43
43
|
[key: string]: string;
|
|
44
44
|
}, dependencyName: string, newProjectVersion: string): string;
|
|
45
45
|
private static _getReleaseType;
|
|
46
|
-
private static _getChangeTypeForSemverReleaseType;
|
|
47
46
|
private static _getNewRangeDependency;
|
|
48
47
|
private static _shouldSkipVersionBump;
|
|
49
48
|
private static _updateCommitDetails;
|
|
@@ -145,6 +145,10 @@ export declare class RushConstants {
|
|
|
145
145
|
* The artifactory.json configuration file name.
|
|
146
146
|
*/
|
|
147
147
|
static readonly artifactoryFilename: string;
|
|
148
|
+
/**
|
|
149
|
+
* The subspaces.json configuration file name
|
|
150
|
+
*/
|
|
151
|
+
static readonly subspacesConfigFilename: string;
|
|
148
152
|
/**
|
|
149
153
|
* Build cache configuration file.
|
|
150
154
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { StdioSummarizer } from '@rushstack/terminal';
|
|
2
2
|
import type { CollatedWriter } from '@rushstack/stream-collator';
|
|
3
|
+
import type { ITerminal, ITerminalProvider } from '@rushstack/node-core-library';
|
|
3
4
|
import type { OperationStatus } from './OperationStatus';
|
|
4
5
|
import type { OperationMetadataManager } from './OperationMetadataManager';
|
|
5
6
|
import type { IStopwatchResult } from '../../utilities/Stopwatch';
|
|
@@ -54,6 +55,12 @@ export interface IOperationRunnerContext {
|
|
|
54
55
|
* ignore dependent projects.
|
|
55
56
|
*/
|
|
56
57
|
readonly changedProjectsOnly: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Invokes the specified callback with a terminal that is associated with this operation.
|
|
60
|
+
*
|
|
61
|
+
* Will write to a log file corresponding to the phase and project, and clean it up upon completion.
|
|
62
|
+
*/
|
|
63
|
+
withTerminalAsync<T>(callback: (terminal: ITerminal, terminalProvider: ITerminalProvider) => Promise<T>, createLogFile: boolean, logFileSuffix?: string): Promise<T>;
|
|
57
64
|
}
|
|
58
65
|
/**
|
|
59
66
|
* The `Operation` class is a node in the dependency graph of work that needs to be scheduled by the
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { StdioSummarizer } from '@rushstack/terminal';
|
|
2
|
-
import type
|
|
2
|
+
import { type ITerminal, type ITerminalProvider } from '@rushstack/node-core-library';
|
|
3
|
+
import { type CollatedWriter, type StreamCollator } from '@rushstack/stream-collator';
|
|
3
4
|
import { OperationStatus } from './OperationStatus';
|
|
4
5
|
import type { IOperationRunner, IOperationRunnerContext } from './IOperationRunner';
|
|
5
6
|
import type { Operation } from './Operation';
|
|
@@ -95,6 +96,10 @@ export declare class OperationExecutionRecord implements IOperationRunnerContext
|
|
|
95
96
|
*/
|
|
96
97
|
get status(): OperationStatus;
|
|
97
98
|
set status(newStatus: OperationStatus);
|
|
99
|
+
/**
|
|
100
|
+
* {@inheritdoc IOperationRunnerContext.withTerminalAsync}
|
|
101
|
+
*/
|
|
102
|
+
withTerminalAsync<T>(callback: (terminal: ITerminal, terminalProvider: ITerminalProvider) => Promise<T>, createLogFile: boolean, logFileSuffix?: string): Promise<T>;
|
|
98
103
|
executeAsync({ onStart, onResult }: {
|
|
99
104
|
onStart: (record: OperationExecutionRecord) => Promise<OperationStatus | undefined>;
|
|
100
105
|
onResult: (record: OperationExecutionRecord) => Promise<void>;
|
|
@@ -2,7 +2,6 @@ import { TerminalWritable, type ITerminalChunk } from '@rushstack/terminal';
|
|
|
2
2
|
import type { CollatedTerminal } from '@rushstack/stream-collator';
|
|
3
3
|
import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
|
|
4
4
|
export declare class ProjectLogWritable extends TerminalWritable {
|
|
5
|
-
private readonly _project;
|
|
6
5
|
private readonly _terminal;
|
|
7
6
|
readonly logPath: string;
|
|
8
7
|
readonly errorLogPath: string;
|
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { IOperationRunner, IOperationRunnerContext } from './IOperationRunner';
|
|
1
|
+
import type { IPhase } from '../../api/CommandLineConfiguration';
|
|
3
2
|
import type { RushConfiguration } from '../../api/RushConfiguration';
|
|
4
3
|
import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
|
|
5
|
-
import type {
|
|
6
|
-
import
|
|
4
|
+
import type { IOperationRunner, IOperationRunnerContext } from './IOperationRunner';
|
|
5
|
+
import { OperationStatus } from './OperationStatus';
|
|
7
6
|
export interface IOperationRunnerOptions {
|
|
8
7
|
rushProject: RushConfigurationProject;
|
|
9
8
|
rushConfiguration: RushConfiguration;
|
|
10
9
|
commandToRun: string;
|
|
11
|
-
projectChangeAnalyzer: ProjectChangeAnalyzer;
|
|
12
10
|
displayName: string;
|
|
13
11
|
phase: IPhase;
|
|
14
|
-
/**
|
|
15
|
-
* The set of phases being executed in the current command, for validation of rush-project.json
|
|
16
|
-
*/
|
|
17
|
-
selectedPhases: Iterable<IPhase>;
|
|
18
12
|
}
|
|
19
13
|
/**
|
|
20
14
|
* An `IOperationRunner` subclass that performs an operation via a shell command.
|
|
@@ -28,7 +22,6 @@ export declare class ShellOperationRunner implements IOperationRunner {
|
|
|
28
22
|
readonly cacheable: boolean;
|
|
29
23
|
readonly warningsAreAllowed: boolean;
|
|
30
24
|
private readonly _commandToRun;
|
|
31
|
-
private readonly _logFilenameIdentifier;
|
|
32
25
|
private readonly _rushProject;
|
|
33
26
|
private readonly _rushConfiguration;
|
|
34
27
|
constructor(options: IOperationRunnerOptions);
|
|
@@ -55,6 +55,10 @@ export interface ILifecycleCommandOptions {
|
|
|
55
55
|
* Options for what should be added to the PATH variable
|
|
56
56
|
*/
|
|
57
57
|
environmentPathOptions: IEnvironmentPathOptions;
|
|
58
|
+
/**
|
|
59
|
+
* If true, attempt to establish a NodeJS IPC channel to the child process.
|
|
60
|
+
*/
|
|
61
|
+
ipc?: boolean;
|
|
58
62
|
}
|
|
59
63
|
export interface IEnvironmentPathOptions {
|
|
60
64
|
/**
|
package/lib-shim/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,oEAAkE;AAGrD,QAAA,aAAa,GAA0B,qBAAqB,CAAC;AAC7D,QAAA,0BAA0B,GAAmD,gBAAgB,CAAC;AAQ9F,QAAA,UAAU,GAAgB;IACrC,aAAa,EAAE,SAAS;CACzB,CAAC;AAEF;;;;;GAKG;AACH,SAAgB,uBAAuB,CAAC,cAAsB;IAC5D,IAAI,aAAa,GAAW,cAAc,CAAC;IAE3C,6EAA6E;IAC7E,KAAK,IAAI,CAAC,GAAW,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,oEAAkE;AAGrD,QAAA,aAAa,GAA0B,qBAAqB,CAAC;AAC7D,QAAA,0BAA0B,GAAmD,gBAAgB,CAAC;AAQ9F,QAAA,UAAU,GAAgB;IACrC,aAAa,EAAE,SAAS;CACzB,CAAC;AAEF;;;;;GAKG;AACH,SAAgB,uBAAuB,CAAC,cAAsB;IAC5D,IAAI,aAAa,GAAW,cAAc,CAAC;IAE3C,6EAA6E;IAC7E,KAAK,IAAI,CAAC,GAAW,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;QACpC,MAAM,gBAAgB,GAAW,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;QAEvE,IAAI,8BAAU,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC;YACxC,OAAO,gBAAgB,CAAC;QAC1B,CAAC;QAED,MAAM,YAAY,GAAW,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QACzD,IAAI,YAAY,KAAK,aAAa,EAAE,CAAC;YACnC,MAAM;QACR,CAAC;QAED,aAAa,GAAG,YAAY,CAAC;IAC/B,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AApBD,0DAoBC;AAED,SAAgB,QAAQ,CAAU,UAAkB;IAClD,IAAI,OAAO,uBAAuB,KAAK,UAAU,EAAE,CAAC;QAClD,6FAA6F;QAC7F,kEAAkE;QAClE,2FAA2F;QAC3F,mBAAmB;QACnB,OAAO,uBAAuB,CAAC,UAAU,CAAC,CAAC;IAC7C,CAAC;SAAM,CAAC;QACN,OAAO,OAAO,CAAC,UAAU,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC;AAVD,4BAUC;AAED;;GAEG;AACH,SAAgB,6BAA6B,CAAC,UAAkB;IAC9D,MAAM,iBAAiB,GAAW,0BAAM,CAAC,aAAa,CAAC;QACrD,UAAU,EAAE,qBAAa;QACzB,cAAc,EAAE,UAAU;KAC3B,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,iBAAiB,CAAC,CAAC;AACrC,CAAC;AAPD,sEAOC","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 { Import, FileSystem } from '@rushstack/node-core-library';\nimport type { EnvironmentVariableNames } from '@microsoft/rush-lib';\n\nexport const RUSH_LIB_NAME: '@microsoft/rush-lib' = '@microsoft/rush-lib';\nexport const RUSH_LIB_PATH_ENV_VAR_NAME: typeof EnvironmentVariableNames._RUSH_LIB_PATH = '_RUSH_LIB_PATH';\n\nexport type RushLibModuleType = Record<string, unknown>;\n\nexport interface ISdkContext {\n rushLibModule: RushLibModuleType | undefined;\n}\n\nexport const sdkContext: ISdkContext = {\n rushLibModule: undefined\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 */\nexport function 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\nexport function _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/**\n * Require `@microsoft/rush-lib` under the specified folder path.\n */\nexport function 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"]}
|
package/lib-shim/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/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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 type JsonObject,\n type 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 type 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 (e1) {\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 (e2) {\n // eslint-disable-next-line no-console\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 // eslint-disable-next-line no-console\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,CAAC;IAC3C,oBAAU,CAAC,aAAa;QACtB,MAAM,CAAC,uBAAuB;YAC9B,MAAM,CAAC,sCAAsC;YAC7C,MAAM,CAAC,4CAA4C,CAAC;AACxD,CAAC;AAED,6FAA6F;AAC7F,+FAA+F;AAC/F,IAAI,oBAAU,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;IAC3C,MAAM,aAAa,GAA8B,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,0CAAE,QAAQ,CAAC;IAC1E,IAAI,aAAa,EAAE,CAAC;QAClB,MAAM,mBAAmB,GACvB,qCAAiB,CAAC,QAAQ,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC;QAEnE,IAAI,mBAAmB,KAAK,SAAS,EAAE,CAAC;YACtC,MAAM,iBAAiB,GAAiB,IAAA,kBAAQ,EAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC,CAAC;YAEjG,6D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,IAAI,oBAAU,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;IAC3C,qGAAqG;IACrG,wGAAwG;IACxG,2CAA2C;IAC3C,sCAAsC;IACtC,OAAO,CAAC,KAAK,CAAC;EACd,YAAY;CACb,CAAC,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,uCAAuC;AACvC,KAAK,MAAM,QAAQ,IAAI,oBAAU,CAAC,aAAa,EAAE,CAAC;IAChD,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChE,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;IACL,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAgB,2BAA2B,CAAC,aAAqB;IAC/D,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CACb,gBAAgB,OAAO,CAAC,IAAI,CAAC,OAAO,qDAAqD,CAC1F,CAAC;IACJ,CAAC;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 type JsonObject,\n type 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 type 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 (e1) {\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 (e2) {\n // eslint-disable-next-line no-console\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 // eslint-disable-next-line no-console\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"]}
|
package/lib-shim/loader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAE7B,oEAAqF;AAErF,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,CAAA,EAAE;YACzB,OAAO;SACR;QAED,IAAI,aAAa,EAAE;YACjB,aAAa,CAAC;gBACZ,UAAU,EAAE;oBACV,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,4BAA4B;iBACnC;gBACD,eAAe;aAChB,CAAC,CAAC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Ae,GAAG,EAAE,CAAC;oBAErB,sDAAsD;oBACtD,IAAI,aAAa,EAAE;wBACjB,aAAa,CAAC;4BACZ,UAAU,EAAE;gCACV,IAAI,EAAE,OAAO;gCACb,IAAI,EAAE,mBAAmB,uBAAa,8CAA8C;6BACrF;4BACD,eAAe;yBAChB,CAAC,CAAC;qBACJ;oBAED,oBAAU,CAAC,aAAa,GAAG,IAAA,uCAA6B,EAAC,0BAA0B,CAAC,CAAC;oBAErF,eAAe,GAAG,GAAG,CAAC;iBACvB;gBAAC,OAAO,EAAE,EAAE;oBACX,sCAAsC;oBACtC,OAAO,CAAC,KAAK,CAAC,GAAG,8BAA8B,EAAE,CAAC,CAAC;oBACnD,MAAM,IAAI,KAAK,CAAC,OAAO,uBAAa,yBAAyB,CAAC,CAAC;iBAChE;aACF;YAED,IAAI,oBAAU,CAAC,aAAa,KAAK,SAAS,EAAE;gBAC1C,gEAAgE;gBAChE,MAAM,CAAC,4CAA4C,GAAG,oBAAU,CAAC,aAAa,CAAC;gBAC/E,IAAI,aAAa,EAAE;oBACjB,aAAa,CAAC;wBACZ,UAAU,EAAE;4BACV,IAAI,EAAE,OAAO;4BACb,IAAI,EAAE,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;AA7LD,sCA6LC","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, type JsonObject, Executable } from '@rushstack/node-core-library';\n\nimport {\n tryFindRushJsonLocation,\n RUSH_LIB_NAME,\n type 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 (e1) {\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 (e2) {\n // eslint-disable-next-line no-console\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,oEAAqF;AAErF,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,CAAA,EAAE,CAAC;YAC1B,OAAO;QACT,CAAC;QAED,IAAI,aAAa,EAAE,CAAC;YAClB,aAAa,CAAC;gBACZ,UAAU,EAAE;oBACV,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,4BAA4B;iBACnC;gBACD,eAAe;aAChB,CAAC,CAAC;QACL,CAAC;QAED,MAAM,KAAK,GAAU,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAC7D,KAAK,CAAC,IAAI,GAAG,YAAY,CAAC;QAC1B,MAAM,KAAK,CAAC;IACd,CAAC;IAED;;OAEG;IACI,MAAM,KAAK,QAAQ;QACxB,OAAO,oBAAU,CAAC,aAAa,KAAK,SAAS,CAAC;IAChD,CAAC;IAED;;;;;;;OAOG;IACI,MAA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AE,mBAAmB,uBAAa,8CAA8C;6BACrF;4BACD,eAAe;yBAChB,CAAC,CAAC;oBACL,CAAC;oBAED,oBAAU,CAAC,aAAa,GAAG,IAAA,uCAA6B,EAAC,0BAA0B,CAAC,CAAC;oBAErF,eAAe,GAAG,GAAG,CAAC;gBACxB,CAAC;gBAAC,OAAO,EAAE,EAAE,CAAC;oBACZ,sCAAsC;oBACtC,OAAO,CAAC,KAAK,CAAC,GAAG,8BAA8B,EAAE,CAAC,CAAC;oBACnD,MAAM,IAAI,KAAK,CAAC,OAAO,uBAAa,yBAAyB,CAAC,CAAC;gBACjE,CAAC;YACH,CAAC;YAED,IAAI,oBAAU,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;gBAC3C,gEAAgE;gBAChE,MAAM,CAAC,4CAA4C,GAAG,oBAAU,CAAC,aAAa,CAAC;gBAC/E,IAAI,aAAa,EAAE,CAAC;oBAClB,aAAa,CAAC;wBACZ,UAAU,EAAE;4BACV,IAAI,EAAE,OAAO;4BACb,IAAI,EAAE,UAAU,uBAAa,gCAAgC;yBAC9D;wBACD,eAAe;qBAChB,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,aAAa,EAAE,CAAC;gBAClB,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;YACL,CAAC;YACD,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;CACF;AA7LD,sCA6LC","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, type JsonObject, Executable } from '@rushstack/node-core-library';\n\nimport {\n tryFindRushJsonLocation,\n RUSH_LIB_NAME,\n type 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 (e1) {\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 (e2) {\n // eslint-disable-next-line no-console\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.112.
|
|
3
|
+
"version": "5.112.2-pr4485.0",
|
|
4
4
|
"description": "An API for interacting with the Rush engine",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,17 +25,17 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@types/node-fetch": "2.6.2",
|
|
27
27
|
"tapable": "2.2.1",
|
|
28
|
-
"@rushstack/node-core-library": "3.
|
|
28
|
+
"@rushstack/node-core-library": "3.63.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/semver": "7.5.0",
|
|
32
32
|
"@types/webpack-env": "1.18.0",
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"local-node-rig": "1.0.0",
|
|
36
|
-
"@rushstack/stream-collator": "4.1.13",
|
|
33
|
+
"@microsoft/rush-lib": "5.112.2-pr4485.0",
|
|
34
|
+
"@rushstack/heft": "0.64.0",
|
|
37
35
|
"@rushstack/ts-command-line": "4.17.1",
|
|
38
|
-
"
|
|
36
|
+
"local-node-rig": "1.0.0",
|
|
37
|
+
"@rushstack/stream-collator": "4.1.18",
|
|
38
|
+
"@rushstack/terminal": "0.7.17"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "heft build --clean",
|