@rushstack/rush-sdk 5.96.0 → 5.97.1-pr3481.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/rush-lib.d.ts +445 -49
  2. package/lib/api/CobuildConfiguration.d.ts +63 -0
  3. package/lib/api/CobuildConfiguration.js +1 -0
  4. package/lib/api/EnvironmentConfiguration.d.ts +61 -20
  5. package/lib/api/ExperimentsConfiguration.d.ts +5 -0
  6. package/lib/api/LastInstallFlag.d.ts +58 -21
  7. package/lib/api/LastLinkFlag.d.ts +3 -7
  8. package/lib/api/RushConfiguration.d.ts +52 -0
  9. package/lib/api/RushConfigurationProject.d.ts +6 -0
  10. package/lib/api/base/BaseFlag.d.ts +50 -0
  11. package/lib/api/base/BaseFlag.js +1 -0
  12. package/lib/api/packageManager/PnpmPackageManager.d.ts +14 -0
  13. package/lib/cli/actions/InstallAction.d.ts +7 -0
  14. package/lib/cli/actions/ListAction.d.ts +4 -0
  15. package/lib/cli/actions/UpdateAction.d.ts +7 -0
  16. package/lib/cli/parsing/SelectionParameterSet.d.ts +17 -3
  17. package/lib/index.d.ts +5 -2
  18. package/lib/logic/PurgeManager.d.ts +1 -0
  19. package/lib/logic/RushConstants.d.ts +15 -0
  20. package/lib/logic/base/BaseInstallManagerTypes.d.ts +23 -0
  21. package/lib/logic/buildCache/ProjectBuildCache.d.ts +5 -4
  22. package/lib/logic/cobuild/CobuildLock.d.ts +24 -0
  23. package/lib/logic/cobuild/CobuildLock.js +1 -0
  24. package/lib/logic/cobuild/ICobuildLockProvider.d.ts +46 -0
  25. package/lib/logic/cobuild/ICobuildLockProvider.js +1 -0
  26. package/lib/logic/installManager/InstallHelpers.d.ts +1 -0
  27. package/lib/logic/operations/AsyncOperationQueue.d.ts +23 -4
  28. package/lib/logic/operations/CacheableOperationPlugin.d.ts +21 -0
  29. package/lib/logic/operations/CacheableOperationPlugin.js +1 -0
  30. package/lib/logic/operations/IOperationRunner.d.ts +29 -10
  31. package/lib/logic/operations/OperationExecutionManager.d.ts +5 -0
  32. package/lib/logic/operations/OperationExecutionRecord.d.ts +7 -1
  33. package/lib/logic/operations/OperationRunnerHooks.d.ts +50 -0
  34. package/lib/logic/operations/OperationRunnerHooks.js +1 -0
  35. package/lib/logic/operations/OperationStatus.d.ts +8 -0
  36. package/lib/logic/operations/PeriodicCallback.d.ts +20 -0
  37. package/lib/logic/operations/PeriodicCallback.js +1 -0
  38. package/lib/logic/operations/ShellOperationRunner.d.ts +4 -13
  39. package/lib/logic/pnpm/IPnpmfile.d.ts +16 -0
  40. package/lib/logic/pnpm/PnpmProjectShrinkwrapFile.d.ts +7 -0
  41. package/lib/logic/pnpm/PnpmShrinkwrapFile.d.ts +26 -0
  42. package/lib/logic/pnpm/SplitWorkspaceGlobalPnpmfileShim.d.ts +3 -0
  43. package/lib/logic/pnpm/SplitWorkspaceGlobalPnpmfileShim.js +1 -0
  44. package/lib/logic/pnpm/SplitWorkspacePnpmfileConfiguration.d.ts +23 -0
  45. package/lib/logic/pnpm/SplitWorkspacePnpmfileConfiguration.js +1 -0
  46. package/lib/logic/selectors/SplitWorkspaceProjectSelectorParser.d.ts +10 -0
  47. package/lib/logic/selectors/SplitWorkspaceProjectSelectorParser.js +1 -0
  48. package/lib/logic/versionMismatch/VersionMismatchFinderProject.d.ts +2 -0
  49. package/lib/pluginFramework/PhasedCommandHooks.d.ts +15 -1
  50. package/lib/pluginFramework/RushSession.d.ts +11 -2
  51. package/lib/utilities/PathConstants.d.ts +1 -0
  52. package/lib/utilities/npmrcUtilities.d.ts +1 -1
  53. package/lib-shim/index.d.ts.map +1 -1
  54. package/lib-shim/index.js +5 -5
  55. package/lib-shim/index.js.map +1 -1
  56. package/package.json +5 -5
@@ -1,5 +1,6 @@
1
1
  import type { LogBase } from '@pnpm/logger';
2
2
  import type { IPackageJson } from '@rushstack/node-core-library';
3
+ import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
3
4
  import type { IPnpmShrinkwrapYaml } from './PnpmShrinkwrapFile';
4
5
  /**
5
6
  * The `settings` parameter passed to {@link IPnpmfileShim.hooks.readPackage} and
@@ -19,6 +20,20 @@ export interface IPnpmfileShimSettings {
19
20
  workspaceVersions: Record<string, string>;
20
21
  userPnpmfilePath?: string;
21
22
  }
23
+ export interface IWorkspaceProjectInfo extends Pick<RushConfigurationProject, 'packageName' | 'projectRelativeFolder'> {
24
+ packageVersion: RushConfigurationProject['packageJson']['version'];
25
+ }
26
+ /**
27
+ * The `settings` parameter passed to {@link IPnpmfileShim.hooks.readPackage} and
28
+ * {@link IPnpmfileShim.hooks.afterAllResolved}.
29
+ */
30
+ export interface ISplitWorkspacePnpmfileShimSettings {
31
+ semverPath: string;
32
+ pathNormalizerPath: string;
33
+ workspaceProjects: Record<string, IWorkspaceProjectInfo>;
34
+ splitWorkspaceProjects: Record<string, IWorkspaceProjectInfo>;
35
+ userPnpmfilePath?: string;
36
+ }
22
37
  /**
23
38
  * The `context` parameter passed to {@link IPnpmfile.hooks.readPackage}, as defined by the
24
39
  * pnpmfile API contract.
@@ -26,6 +41,7 @@ export interface IPnpmfileShimSettings {
26
41
  export interface IPnpmfileContext {
27
42
  log: (message: string) => void;
28
43
  pnpmfileShimSettings?: IPnpmfileShimSettings;
44
+ splitWorkspacePnpmfileShimSettings?: ISplitWorkspacePnpmfileShimSettings;
29
45
  }
30
46
  /**
31
47
  * The `log` parameter passed to {@link IPnpmfile.hooks.filterLog}.
@@ -1,9 +1,15 @@
1
1
  import { BaseProjectShrinkwrapFile } from '../base/BaseProjectShrinkwrapFile';
2
2
  import { PnpmShrinkwrapFile } from './PnpmShrinkwrapFile';
3
+ import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
3
4
  /**
4
5
  *
5
6
  */
6
7
  export declare class PnpmProjectShrinkwrapFile extends BaseProjectShrinkwrapFile<PnpmShrinkwrapFile> {
8
+ /**
9
+ * When split workspace projects turn off shared-workspace-lockfiles, Pnpm creates individual
10
+ * shrinkwrap files for each project.
11
+ */
12
+ static generateIndividualProjectShrinkwrapAsync(project: RushConfigurationProject): Promise<void>;
7
13
  /**
8
14
  * Generate and write the project shrinkwrap file to <project>/.rush/temp/shrinkwrap-deps.json.
9
15
  * @returns True if the project shrinkwrap was created or updated, false otherwise.
@@ -16,6 +22,7 @@ export declare class PnpmProjectShrinkwrapFile extends BaseProjectShrinkwrapFile
16
22
  protected generateProjectShrinkwrapMap(): Map<string, string> | undefined;
17
23
  protected generateWorkspaceProjectShrinkwrapMap(): Map<string, string> | undefined;
18
24
  protected generateLegacyProjectShrinkwrapMap(): Map<string, string>;
25
+ protected generateIndividualProjectShrinkwrapMap(): Map<string, string>;
19
26
  private _addDependencyRecursive;
20
27
  private _resolveAndAddPeerDependencies;
21
28
  /**
@@ -4,6 +4,7 @@ import { RushConfiguration } from '../../api/RushConfiguration';
4
4
  import { IShrinkwrapFilePolicyValidatorOptions } from '../policy/ShrinkwrapFilePolicy';
5
5
  import { IExperimentsJson } from '../../api/ExperimentsConfiguration';
6
6
  import { RushConfigurationProject } from '../../api/RushConfigurationProject';
7
+ import { SplitWorkspacePnpmfileConfiguration } from './SplitWorkspacePnpmfileConfiguration';
7
8
  import { PnpmProjectShrinkwrapFile } from './PnpmProjectShrinkwrapFile';
8
9
  import { PackageManagerOptionsConfigurationBase } from '../base/BasePackageManagerOptionsConfiguration';
9
10
  export interface IPeerDependenciesMetaYaml {
@@ -91,6 +92,14 @@ export interface IPnpmShrinkwrapYaml {
91
92
  dependencies: {
92
93
  [dependency: string]: string;
93
94
  };
95
+ /** The list of resolved version numbers for develop dependencies */
96
+ devDependencies: {
97
+ [dependency: string]: string;
98
+ };
99
+ /** The list of resolved version numbers for optional dependencies */
100
+ optionalDependencies: {
101
+ [dependency: string]: string;
102
+ };
94
103
  /** The list of importers for local workspace projects */
95
104
  importers: {
96
105
  [relativePath: string]: IPnpmShrinkwrapImporterYaml;
@@ -105,6 +114,10 @@ export interface IPnpmShrinkwrapYaml {
105
114
  specifiers: {
106
115
  [dependency: string]: string;
107
116
  };
117
+ /** The list of override version number for dependencies */
118
+ overrides: {
119
+ [dependency: string]: string;
120
+ };
108
121
  }
109
122
  /**
110
123
  * Given an encoded "dependency key" from the PNPM shrinkwrap file, this parses it into an equivalent
@@ -117,15 +130,23 @@ export declare class PnpmShrinkwrapFile extends BaseShrinkwrapFile {
117
130
  readonly isWorkspaceCompatible: boolean;
118
131
  readonly registry: string;
119
132
  readonly dependencies: ReadonlyMap<string, string>;
133
+ readonly devDependencies: ReadonlyMap<string, string>;
134
+ readonly optionalDependencies: ReadonlyMap<string, string>;
120
135
  readonly importers: ReadonlyMap<string, IPnpmShrinkwrapImporterYaml>;
121
136
  readonly specifiers: ReadonlyMap<string, string>;
122
137
  readonly packages: ReadonlyMap<string, IPnpmShrinkwrapDependencyYaml>;
138
+ readonly overrides: ReadonlyMap<string, string>;
123
139
  private readonly _shrinkwrapJson;
124
140
  private readonly _integrities;
125
141
  private _pnpmfileConfiguration;
142
+ private _splitWorkspaceGlobalPnpmfileConfiguration;
143
+ private _individualPackageName;
144
+ private _individualShrinkwrapImporter;
126
145
  private constructor();
127
146
  static loadFromFile(shrinkwrapYamlFilename: string): PnpmShrinkwrapFile | undefined;
128
147
  static loadFromString(shrinkwrapContent: string): PnpmShrinkwrapFile;
148
+ setIndividualPackage(packageName: string, splitWorkspaceGlobalPnpmfileConfiguration?: SplitWorkspacePnpmfileConfiguration): void;
149
+ get isIndividual(): boolean;
129
150
  getShrinkwrapHash(experimentsConfig?: IExperimentsJson): string;
130
151
  /** @override */
131
152
  validate(packageManagerOptionsConfig: PackageManagerOptionsConfigurationBase, policyOptions: IShrinkwrapFilePolicyValidatorOptions, experimentsConfig?: IExperimentsJson): void;
@@ -192,8 +213,12 @@ export declare class PnpmShrinkwrapFile extends BaseShrinkwrapFile {
192
213
  getImporterKeyByPath(workspaceRoot: string, projectFolder: string): string;
193
214
  getImporter(importerKey: string): IPnpmShrinkwrapImporterYaml | undefined;
194
215
  getIntegrityForImporter(importerKey: string): Map<string, string> | undefined;
216
+ getIntegrityForIndividualProject(): Map<string, string>;
195
217
  /** @override */
196
218
  isWorkspaceProjectModifiedAsync(project: RushConfigurationProject, variant?: string): Promise<boolean>;
219
+ isSplitWorkspaceProjectModified(project: RushConfigurationProject): boolean;
220
+ isSplitWorkspaceIndividualProjectModified(project: RushConfigurationProject): boolean;
221
+ private _isProjectModified;
197
222
  private _getIntegrityForPackage;
198
223
  private _addIntegrities;
199
224
  /**
@@ -203,5 +228,6 @@ export declare class PnpmShrinkwrapFile extends BaseShrinkwrapFile {
203
228
  private _getPackageId;
204
229
  private _parsePnpmDependencyKey;
205
230
  private _serializeInternal;
231
+ private _getIndividualShrinkwrapImporter;
206
232
  }
207
233
  //# sourceMappingURL=PnpmShrinkwrapFile.d.ts.map
@@ -0,0 +1,3 @@
1
+ import type { IPnpmfileHooks } from './IPnpmfile';
2
+ export declare const hooks: IPnpmfileHooks;
3
+ //# sourceMappingURL=SplitWorkspaceGlobalPnpmfileShim.d.ts.map
@@ -0,0 +1 @@
1
+ module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/pnpm/SplitWorkspaceGlobalPnpmfileShim");
@@ -0,0 +1,23 @@
1
+ import { IPackageJson } from '@rushstack/node-core-library';
2
+ import type { RushConfiguration } from '../../api/RushConfiguration';
3
+ /**
4
+ * Loads PNPM's pnpmfile.js configuration, and invokes it to preprocess package.json files,
5
+ * optionally utilizing a pnpmfile shim to inject preferred versions.
6
+ */
7
+ export declare class SplitWorkspacePnpmfileConfiguration {
8
+ private _context;
9
+ constructor(rushConfiguration: RushConfiguration);
10
+ /**
11
+ * Split workspace use global pnpmfile, because in split workspace, user may set `shared-workspace-lockfile=false`.
12
+ * That means each project owns their individual pnpmfile under project folder. While the global pnpmfile could be
13
+ * under the common/temp-split/ folder and be used by all split workspace projects.
14
+ */
15
+ static writeCommonTempSplitGlobalPnpmfileAsync(rushConfiguration: RushConfiguration): Promise<void>;
16
+ private static _getSplitWorkspacePnpmfileShimSettings;
17
+ /**
18
+ * Transform a package.json file using the pnpmfile.js hook.
19
+ * @returns the tranformed object, or the original input if pnpmfile.js was not found.
20
+ */
21
+ transform(packageJson: IPackageJson): IPackageJson;
22
+ }
23
+ //# sourceMappingURL=SplitWorkspacePnpmfileConfiguration.d.ts.map
@@ -0,0 +1 @@
1
+ module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/pnpm/SplitWorkspacePnpmfileConfiguration");
@@ -0,0 +1,10 @@
1
+ import type { RushConfiguration } from '../../api/RushConfiguration';
2
+ import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
3
+ import type { IEvaluateSelectorOptions, ISelectorParser } from './ISelectorParser';
4
+ export declare class SplitWorkspaceProjectSelectorParser implements ISelectorParser<RushConfigurationProject> {
5
+ private readonly _rushConfiguration;
6
+ constructor(rushConfiguration: RushConfiguration);
7
+ evaluateSelectorAsync({ unscopedSelector, terminal, parameterName }: IEvaluateSelectorOptions): Promise<Iterable<RushConfigurationProject>>;
8
+ getCompletions(): Iterable<string>;
9
+ }
10
+ //# sourceMappingURL=SplitWorkspaceProjectSelectorParser.d.ts.map
@@ -0,0 +1 @@
1
+ module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/selectors/SplitWorkspaceProjectSelectorParser");
@@ -4,8 +4,10 @@ import { RushConfigurationProject } from '../../api/RushConfigurationProject';
4
4
  export declare class VersionMismatchFinderProject extends VersionMismatchFinderEntity {
5
5
  packageName: string;
6
6
  private _fileManager;
7
+ private _project;
7
8
  constructor(project: RushConfigurationProject);
8
9
  get filePath(): string;
10
+ get project(): RushConfigurationProject;
9
11
  get allDependencies(): ReadonlyArray<PackageJsonDependency>;
10
12
  tryGetDependency(packageName: string): PackageJsonDependency | undefined;
11
13
  tryGetDevDependency(packageName: string): PackageJsonDependency | undefined;
@@ -6,7 +6,9 @@ import type { RushConfiguration } from '../api/RushConfiguration';
6
6
  import type { RushConfigurationProject } from '../api/RushConfigurationProject';
7
7
  import type { Operation } from '../logic/operations/Operation';
8
8
  import type { ProjectChangeAnalyzer } from '../logic/ProjectChangeAnalyzer';
9
- import { IExecutionResult, IOperationExecutionResult } from '../logic/operations/IOperationExecutionResult';
9
+ import type { IExecutionResult, IOperationExecutionResult } from '../logic/operations/IOperationExecutionResult';
10
+ import type { CobuildConfiguration } from '../api/CobuildConfiguration';
11
+ import type { IOperationRunnerContext } from '../logic/operations/IOperationRunner';
10
12
  /**
11
13
  * A plugin that interacts with a phased commands.
12
14
  * @alpha
@@ -26,6 +28,10 @@ export interface ICreateOperationsContext {
26
28
  * The configuration for the build cache, if the feature is enabled.
27
29
  */
28
30
  readonly buildCacheConfiguration: BuildCacheConfiguration | undefined;
31
+ /**
32
+ * The configuration for the cobuild, if cobuild feature and build cache feature are both enabled.
33
+ */
34
+ readonly cobuildConfiguration: CobuildConfiguration | undefined;
29
35
  /**
30
36
  * The set of custom parameters for the executing command.
31
37
  * Maps from the `longName` field in command-line.json to the parser configuration in ts-command-line.
@@ -97,6 +103,14 @@ export declare class PhasedCommandHooks {
97
103
  * Hook is series for stable output.
98
104
  */
99
105
  readonly afterExecuteOperations: AsyncSeriesHook<[IExecutionResult, ICreateOperationsContext]>;
106
+ /**
107
+ * Hook invoked before executing a operation.
108
+ */
109
+ readonly beforeExecuteOperation: AsyncSeriesHook<[IOperationRunnerContext]>;
110
+ /**
111
+ * Hook invoked after executing a operation.
112
+ */
113
+ readonly afterExecuteOperation: AsyncSeriesHook<[IOperationRunnerContext]>;
100
114
  /**
101
115
  * Hook invoked after a run has finished and the command is watching for changes.
102
116
  * May be used to display additional relevant data to the user.
@@ -1,8 +1,10 @@
1
1
  import { ITerminalProvider } from '@rushstack/node-core-library';
2
- import { IBuildCacheJson } from '../api/BuildCacheConfiguration';
3
- import { ICloudBuildCacheProvider } from '../logic/buildCache/ICloudBuildCacheProvider';
4
2
  import { ILogger } from './logging/Logger';
5
3
  import { RushLifecycleHooks } from './RushLifeCycle';
4
+ import type { IBuildCacheJson } from '../api/BuildCacheConfiguration';
5
+ import type { ICloudBuildCacheProvider } from '../logic/buildCache/ICloudBuildCacheProvider';
6
+ import type { ICobuildJson } from '../api/CobuildConfiguration';
7
+ import type { ICobuildLockProvider } from '../logic/cobuild/ICobuildLockProvider';
6
8
  /**
7
9
  * @beta
8
10
  */
@@ -14,17 +16,24 @@ export interface IRushSessionOptions {
14
16
  * @beta
15
17
  */
16
18
  export declare type CloudBuildCacheProviderFactory = (buildCacheJson: IBuildCacheJson) => ICloudBuildCacheProvider;
19
+ /**
20
+ * @beta
21
+ */
22
+ export declare type CobuildLockProviderFactory = (cobuildJson: ICobuildJson) => ICobuildLockProvider;
17
23
  /**
18
24
  * @beta
19
25
  */
20
26
  export declare class RushSession {
21
27
  private readonly _options;
22
28
  private readonly _cloudBuildCacheProviderFactories;
29
+ private readonly _cobuildLockProviderFactories;
23
30
  readonly hooks: RushLifecycleHooks;
24
31
  constructor(options: IRushSessionOptions);
25
32
  getLogger(name: string): ILogger;
26
33
  get terminalProvider(): ITerminalProvider;
27
34
  registerCloudBuildCacheProviderFactory(cacheProviderName: string, factory: CloudBuildCacheProviderFactory): void;
28
35
  getCloudBuildCacheProviderFactory(cacheProviderName: string): CloudBuildCacheProviderFactory | undefined;
36
+ registerCobuildLockProviderFactory(cobuildLockProviderName: string, factory: CobuildLockProviderFactory): void;
37
+ getCobuildLockProviderFactory(cobuildLockProviderName: string): CobuildLockProviderFactory | undefined;
29
38
  }
30
39
  //# sourceMappingURL=RushSession.d.ts.map
@@ -11,6 +11,7 @@ export declare const assetsFolderPath: string;
11
11
  */
12
12
  export declare const scriptsFolderName: string;
13
13
  export declare const pnpmfileShimFilename: string;
14
+ export declare const splitWorkspacePnpmfileShimFilename: string;
14
15
  export declare const installRunScriptFilename: string;
15
16
  export declare const installRunRushScriptFilename: string;
16
17
  export declare const installRunRushxScriptFilename: string;
@@ -11,5 +11,5 @@ export interface ILogger {
11
11
  * @returns
12
12
  * The text of the the synced .npmrc, if one exists. If one does not exist, then undefined is returned.
13
13
  */
14
- export declare function syncNpmrc(sourceNpmrcFolder: string, targetNpmrcFolder: string, useNpmrcPublish?: boolean, logger?: ILogger): string | undefined;
14
+ export declare function syncNpmrc(sourceNpmrcFolder: string, targetNpmrcFolder: string, useNpmrcPublish?: boolean, sourceNpmrcFilename?: string, logger?: ILogger): string | undefined;
15
15
  //# sourceMappingURL=npmrcUtilities.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAkNA;;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":"AAqNA;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAO1E"}
package/lib-shim/index.js CHANGED
@@ -30,6 +30,7 @@ exports._rushSdk_loadInternalModule = void 0;
30
30
  const path = __importStar(require("path"));
31
31
  const node_core_library_1 = require("@rushstack/node-core-library");
32
32
  const RUSH_LIB_NAME = '@microsoft/rush-lib';
33
+ const RUSH_LIB_PATH_ENV_VAR_NAME = '_RUSH_LIB_PATH';
33
34
  const verboseEnabled = typeof process !== 'undefined' && process.env.RUSH_SDK_DEBUG === '1';
34
35
  const terminal = new node_core_library_1.Terminal(new node_core_library_1.ConsoleTerminalProvider({
35
36
  verboseEnabled
@@ -89,21 +90,20 @@ if (rushLibModule === undefined) {
89
90
  // SCENARIO 3: A tool or script has been invoked as a child process by an instance of "rush-lib" and can use the
90
91
  // version that invoked it. In this case, use process.env._RUSH_LIB_PATH to find "rush-lib".
91
92
  if (rushLibModule === undefined) {
92
- const rushLibVariable = '_RUSH_LIB_PATH';
93
- const rushLibPath = process.env[rushLibVariable];
93
+ const rushLibPath = process.env[RUSH_LIB_PATH_ENV_VAR_NAME];
94
94
  if (rushLibPath) {
95
- terminal.writeVerboseLine(`Try to load ${RUSH_LIB_NAME} from process.env.${rushLibVariable} from caller package`);
95
+ terminal.writeVerboseLine(`Try to load ${RUSH_LIB_NAME} from process.env.${RUSH_LIB_PATH_ENV_VAR_NAME} from caller package`);
96
96
  try {
97
97
  rushLibModule = _require(rushLibPath);
98
98
  }
99
99
  catch (error) {
100
100
  // Log this as a warning, since it is unexpected to define an incorrect value of the variable.
101
- terminal.writeWarningLine(`Failed to load ${RUSH_LIB_NAME} via process.env.${rushLibVariable}`);
101
+ terminal.writeWarningLine(`Failed to load ${RUSH_LIB_NAME} via process.env.${RUSH_LIB_PATH_ENV_VAR_NAME}`);
102
102
  }
103
103
  if (rushLibModule !== undefined) {
104
104
  // to track which scenario is active and how it got initialized.
105
105
  global.___rush___rushLibModuleFromEnvironment = rushLibModule;
106
- terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} from process.env.${rushLibVariable}`);
106
+ terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} from process.env.${RUSH_LIB_PATH_ENV_VAR_NAME}`);
107
107
  }
108
108
  }
109
109
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,oEAUsC;AAGtC,MAAM,aAAa,GAA0B,qBAAqB,CAAC;AAEnE,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;AAUF,SAAS,QAAQ,CAAU,UAAkB;IAC3C,IAAI,OAAO,uBAAuB,KAAK,UAAU,EAAE;QACjD,6FAA6F;QAC7F,kEAAkE;QAClE,2FAA2F;QAC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ACrD,UAAU,EAAE,aAAa;QACzB,cAAc,EAAE,UAAU;KAC3B,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,iBAAiB,CAAC,CAAC;AACrC,CAAC;AAED;;;;;GAKG;AACH,SAAS,uBAAuB,CAAC,cAAsB;IACrD,IAAI,aAAa,GAAW,cAAc,CAAC;IAE3C,6EAA6E;IAC7E,KAAK,IAAI,CAAC,GAAW,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;QACnC,MAAM,gBAAgB,GAAW,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;QAEvE,IAAI,8BAAU,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE;YACvC,OAAO,gBAAgB,CAAC;SACzB;QAED,MAAM,YAAY,GAAW,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QACzD,IAAI,YAAY,KAAK,aAAa,EAAE;YAClC,MAAM;SACP;QAED,aAAa,GAAG,YAAY,CAAC;KAC9B;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'path';\nimport {\n JsonFile,\n JsonObject,\n Import,\n IPackageJson,\n PackageJsonLookup,\n Executable,\n FileSystem,\n Terminal,\n ConsoleTerminalProvider\n} from '@rushstack/node-core-library';\nimport type { SpawnSyncReturns } from 'child_process';\n\nconst RUSH_LIB_NAME: '@microsoft/rush-lib' = '@microsoft/rush-lib';\n\nconst verboseEnabled: boolean = typeof process !== 'undefined' && process.env.RUSH_SDK_DEBUG === '1';\nconst terminal: Terminal = new Terminal(\n new ConsoleTerminalProvider({\n verboseEnabled\n })\n);\n\ntype RushLibModuleType = Record<string, unknown>;\ndeclare const global: NodeJS.Global &\n typeof globalThis & {\n ___rush___rushLibModule?: RushLibModuleType;\n ___rush___rushLibModuleFromEnvironment?: RushLibModuleType;\n ___rush___rushLibModuleFromInstallAndRunRush?: RushLibModuleType;\n };\n\nfunction _require<TResult>(moduleName: string): TResult {\n if (typeof __non_webpack_require__ === 'function') {\n // If this library has been bundled with Webpack, we need to call the real `require` function\n // that doesn't get turned into a `__webpack_require__` statement.\n // `__non_webpack_require__` is a Webpack macro that gets turned into a `require` statement\n // during bundling.\n return __non_webpack_require__(moduleName);\n } else {\n return require(moduleName);\n }\n}\n\n// SCENARIO 1: Rush's PluginManager has initialized \"rush-sdk\" with Rush's own instance of rush-lib.\n// The Rush host process will assign \"global.___rush___rushLibModule\" before loading the plugin.\nlet rushLibModule: RushLibModuleType | undefined =\n global.___rush___rushLibModule ||\n global.___rush___rushLibModuleFromEnvironment ||\n global.___rush___rushLibModuleFromInstallAndRunRush;\nlet errorMessage: string = '';\n\n// SCENARIO 2: The project importing \"rush-sdk\" has installed its own instance of \"rush-lib\"\n// as a package.json dependency. For example, this is used by the Jest tests for Rush plugins.\nif (rushLibModule === undefined) {\n const importingPath: string | null | undefined = module?.parent?.filename;\n if (importingPath) {\n const callerPackageFolder: string | undefined =\n PackageJsonLookup.instance.tryGetPackageFolderFor(importingPath);\n\n if (callerPackageFolder !== undefined) {\n const callerPackageJson: IPackageJson = _require(path.join(callerPackageFolder, 'package.json'));\n\n // Does the caller properly declare a dependency on rush-lib?\n if (\n (callerPackageJson.dependencies && callerPackageJson.dependencies[RUSH_LIB_NAME] !== undefined) ||\n (callerPackageJson.devDependencies &&\n callerPackageJson.devDependencies[RUSH_LIB_NAME] !== undefined) ||\n (callerPackageJson.peerDependencies &&\n callerPackageJson.peerDependencies[RUSH_LIB_NAME] !== undefined)\n ) {\n // Try to resolve rush-lib from the caller's folder\n terminal.writeVerboseLine(`Try to load ${RUSH_LIB_NAME} from caller package`);\n try {\n rushLibModule = requireRushLibUnderFolderPath(callerPackageFolder);\n } catch (error) {\n // If we fail to resolve it, ignore the error\n terminal.writeVerboseLine(`Failed to load ${RUSH_LIB_NAME} from caller package`);\n }\n\n // If two different libraries invoke `rush-sdk`, and one of them provides \"rush-lib\"\n // then the first version to be loaded wins. We do not support side-by-side instances of \"rush-lib\".\n if (rushLibModule !== undefined) {\n // to track which scenario is active and how it got initialized.\n global.___rush___rushLibModule = rushLibModule;\n terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} from caller`);\n }\n }\n }\n }\n}\n\n// SCENARIO 3: A tool or script has been invoked as a child process by an instance of \"rush-lib\" and can use the\n// version that invoked it. In this case, use process.env._RUSH_LIB_PATH to find \"rush-lib\".\nif (rushLibModule === undefined) {\n const rushLibVariable: '_RUSH_LIB_PATH' = '_RUSH_LIB_PATH';\n const rushLibPath: string | undefined = process.env[rushLibVariable];\n if (rushLibPath) {\n terminal.writeVerboseLine(\n `Try to load ${RUSH_LIB_NAME} from process.env.${rushLibVariable} from caller package`\n );\n try {\n rushLibModule = _require(rushLibPath);\n } catch (error) {\n // Log this as a warning, since it is unexpected to define an incorrect value of the variable.\n terminal.writeWarningLine(`Failed to load ${RUSH_LIB_NAME} via process.env.${rushLibVariable}`);\n }\n\n if (rushLibModule !== undefined) {\n // to track which scenario is active and how it got initialized.\n global.___rush___rushLibModuleFromEnvironment = rushLibModule;\n terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} from process.env.${rushLibVariable}`);\n }\n }\n}\n\n// SCENARIO 4: A standalone tool or script depends on \"rush-sdk\", and is meant to be used inside a monorepo folder.\n// In this case, we can use install-run-rush.js to obtain the appropriate rush-lib version for the monorepo.\nif (rushLibModule === undefined) {\n try {\n const rushJsonPath: string | undefined = tryFindRushJsonLocation(process.cwd());\n if (!rushJsonPath) {\n throw new Error(\n 'Unable to find rush.json in the current folder or its parent folders.\\n' +\n 'This tool is meant to be invoked from a working directory inside a Rush repository.'\n );\n }\n const monorepoRoot: string = path.dirname(rushJsonPath);\n\n const rushJson: JsonObject = JsonFile.load(rushJsonPath);\n const { rushVersion } = rushJson;\n\n const installRunNodeModuleFolder: string = path.join(\n monorepoRoot,\n `common/temp/install-run/@microsoft+rush@${rushVersion}`\n );\n\n try {\n // First, try to load the version of \"rush-lib\" that was installed by install-run-rush.js\n terminal.writeVerboseLine(`Trying to load ${RUSH_LIB_NAME} installed by install-run-rush`);\n rushLibModule = requireRushLibUnderFolderPath(installRunNodeModuleFolder);\n } catch (e) {\n let installAndRunRushStderrContent: string = '';\n try {\n const installAndRunRushJSPath: string = path.join(monorepoRoot, 'common/scripts/install-run-rush.js');\n\n terminal.writeLine('The Rush engine has not been installed yet. Invoking install-run-rush.js...');\n\n const installAndRuhRushProcess: SpawnSyncReturns<string> = Executable.spawnSync(\n 'node',\n [installAndRunRushJSPath, '--help'],\n {\n stdio: 'pipe'\n }\n );\n\n installAndRunRushStderrContent = installAndRuhRushProcess.stderr;\n if (installAndRuhRushProcess.status !== 0) {\n throw new Error(`The ${RUSH_LIB_NAME} package failed to install`);\n }\n\n // Retry to load \"rush-lib\" after install-run-rush run\n terminal.writeVerboseLine(\n `Trying to load ${RUSH_LIB_NAME} installed by install-run-rush a second time`\n );\n rushLibModule = requireRushLibUnderFolderPath(installRunNodeModuleFolder);\n } catch (e) {\n console.error(`${installAndRunRushStderrContent}`);\n throw new Error(`The ${RUSH_LIB_NAME} package failed to load`);\n }\n }\n\n if (rushLibModule !== undefined) {\n // to track which scenario is active and how it got initialized.\n global.___rush___rushLibModuleFromInstallAndRunRush = rushLibModule;\n terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} installed by install-run-rush`);\n }\n } catch (e) {\n // no-catch\n errorMessage = (e as Error).message;\n }\n}\n\nif (rushLibModule === undefined) {\n // This error indicates that a project is trying to import \"@rushstack/rush-sdk\", but the Rush engine\n // instance cannot be found. If you are writing Jest tests for a Rush plugin, add \"@microsoft/rush-lib\"\n // to the devDependencies for your project.\n console.error(`Error: The @rushstack/rush-sdk package was not able to load the Rush engine:\n${errorMessage}\n`);\n process.exit(1);\n}\n\n// Based on TypeScript's __exportStar()\nfor (const property in rushLibModule) {\n if (property !== 'default' && !exports.hasOwnProperty(property)) {\n const rushLibModuleForClosure: RushLibModuleType = rushLibModule;\n\n // Based on TypeScript's __createBinding()\n Object.defineProperty(exports, property, {\n enumerable: true,\n get: function () {\n return rushLibModuleForClosure[property];\n }\n });\n }\n}\n\n/**\n * Used by the .js stubs for path-based imports of `@microsoft/rush-lib` internal APIs.\n */\nexport function _rushSdk_loadInternalModule(srcImportPath: string): unknown {\n if (!exports._RushInternals) {\n throw new Error(\n `Rush version ${exports.Rush.version} does not support internal API imports via rush-sdk`\n );\n }\n return exports._RushInternals.loadModule(srcImportPath);\n}\n\n/**\n * Require `@microsoft/rush-lib` under the specified folder path.\n */\nfunction requireRushLibUnderFolderPath(folderPath: string): RushLibModuleType {\n const rushLibModulePath: string = Import.resolveModule({\n modulePath: RUSH_LIB_NAME,\n baseFolderPath: folderPath\n });\n\n return _require(rushLibModulePath);\n}\n\n/**\n * Find the rush.json location and return the path, or undefined if a rush.json can't be found.\n *\n * @privateRemarks\n * Keep this in sync with `RushConfiguration.tryFindRushJsonLocation`.\n */\nfunction tryFindRushJsonLocation(startingFolder: string): string | undefined {\n let currentFolder: string = startingFolder;\n\n // Look upwards at parent folders until we find a folder containing rush.json\n for (let i: number = 0; i < 10; ++i) {\n const rushJsonFilename: string = path.join(currentFolder, 'rush.json');\n\n if (FileSystem.exists(rushJsonFilename)) {\n return rushJsonFilename;\n }\n\n const parentFolder: string = path.dirname(currentFolder);\n if (parentFolder === currentFolder) {\n break;\n }\n\n currentFolder = parentFolder;\n }\n\n return undefined;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,oEAUsC;AAItC,MAAM,aAAa,GAA0B,qBAAqB,CAAC;AACnE,MAAM,0BAA0B,GAAkD,gBAAgB,CAAC;AAEnG,MAAM,cAAc,GAAY,OAAO,OAAO,KAAK,WAAW,IAAI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AO,CAAC,IAAI,CAAC,OAAO,qDAAqD,CAC1F,CAAC;KACH;IACD,OAAO,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAC1D,CAAC;AAPD,kEAOC;AAED;;GAEG;AACH,SAAS,6BAA6B,CAAC,UAAkB;IACvD,MAAM,iBAAiB,GAAW,0BAAM,CAAC,aAAa,CAAC;QACrD,UAAU,EAAE,aAAa;QACzB,cAAc,EAAE,UAAU;KAC3B,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,iBAAiB,CAAC,CAAC;AACrC,CAAC;AAED;;;;;GAKG;AACH,SAAS,uBAAuB,CAAC,cAAsB;IACrD,IAAI,aAAa,GAAW,cAAc,CAAC;IAE3C,6EAA6E;IAC7E,KAAK,IAAI,CAAC,GAAW,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;QACnC,MAAM,gBAAgB,GAAW,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;QAEvE,IAAI,8BAAU,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE;YACvC,OAAO,gBAAgB,CAAC;SACzB;QAED,MAAM,YAAY,GAAW,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QACzD,IAAI,YAAY,KAAK,aAAa,EAAE;YAClC,MAAM;SACP;QAED,aAAa,GAAG,YAAY,CAAC;KAC9B;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'path';\nimport {\n JsonFile,\n JsonObject,\n Import,\n IPackageJson,\n PackageJsonLookup,\n Executable,\n FileSystem,\n Terminal,\n ConsoleTerminalProvider\n} from '@rushstack/node-core-library';\nimport type { SpawnSyncReturns } from 'child_process';\nimport type { EnvironmentVariableNames } from '@microsoft/rush-lib';\n\nconst RUSH_LIB_NAME: '@microsoft/rush-lib' = '@microsoft/rush-lib';\nconst RUSH_LIB_PATH_ENV_VAR_NAME: typeof EnvironmentVariableNames.RUSH_LIB_PATH = '_RUSH_LIB_PATH';\n\nconst verboseEnabled: boolean = typeof process !== 'undefined' && process.env.RUSH_SDK_DEBUG === '1';\nconst terminal: Terminal = new Terminal(\n new ConsoleTerminalProvider({\n verboseEnabled\n })\n);\n\ntype RushLibModuleType = Record<string, unknown>;\ndeclare const global: NodeJS.Global &\n typeof globalThis & {\n ___rush___rushLibModule?: RushLibModuleType;\n ___rush___rushLibModuleFromEnvironment?: RushLibModuleType;\n ___rush___rushLibModuleFromInstallAndRunRush?: RushLibModuleType;\n };\n\nfunction _require<TResult>(moduleName: string): TResult {\n if (typeof __non_webpack_require__ === 'function') {\n // If this library has been bundled with Webpack, we need to call the real `require` function\n // that doesn't get turned into a `__webpack_require__` statement.\n // `__non_webpack_require__` is a Webpack macro that gets turned into a `require` statement\n // during bundling.\n return __non_webpack_require__(moduleName);\n } else {\n return require(moduleName);\n }\n}\n\n// SCENARIO 1: Rush's PluginManager has initialized \"rush-sdk\" with Rush's own instance of rush-lib.\n// The Rush host process will assign \"global.___rush___rushLibModule\" before loading the plugin.\nlet rushLibModule: RushLibModuleType | undefined =\n global.___rush___rushLibModule ||\n global.___rush___rushLibModuleFromEnvironment ||\n global.___rush___rushLibModuleFromInstallAndRunRush;\nlet errorMessage: string = '';\n\n// SCENARIO 2: The project importing \"rush-sdk\" has installed its own instance of \"rush-lib\"\n// as a package.json dependency. For example, this is used by the Jest tests for Rush plugins.\nif (rushLibModule === undefined) {\n const importingPath: string | null | undefined = module?.parent?.filename;\n if (importingPath) {\n const callerPackageFolder: string | undefined =\n PackageJsonLookup.instance.tryGetPackageFolderFor(importingPath);\n\n if (callerPackageFolder !== undefined) {\n const callerPackageJson: IPackageJson = _require(path.join(callerPackageFolder, 'package.json'));\n\n // Does the caller properly declare a dependency on rush-lib?\n if (\n (callerPackageJson.dependencies && callerPackageJson.dependencies[RUSH_LIB_NAME] !== undefined) ||\n (callerPackageJson.devDependencies &&\n callerPackageJson.devDependencies[RUSH_LIB_NAME] !== undefined) ||\n (callerPackageJson.peerDependencies &&\n callerPackageJson.peerDependencies[RUSH_LIB_NAME] !== undefined)\n ) {\n // Try to resolve rush-lib from the caller's folder\n terminal.writeVerboseLine(`Try to load ${RUSH_LIB_NAME} from caller package`);\n try {\n rushLibModule = requireRushLibUnderFolderPath(callerPackageFolder);\n } catch (error) {\n // If we fail to resolve it, ignore the error\n terminal.writeVerboseLine(`Failed to load ${RUSH_LIB_NAME} from caller package`);\n }\n\n // If two different libraries invoke `rush-sdk`, and one of them provides \"rush-lib\"\n // then the first version to be loaded wins. We do not support side-by-side instances of \"rush-lib\".\n if (rushLibModule !== undefined) {\n // to track which scenario is active and how it got initialized.\n global.___rush___rushLibModule = rushLibModule;\n terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} from caller`);\n }\n }\n }\n }\n}\n\n// SCENARIO 3: A tool or script has been invoked as a child process by an instance of \"rush-lib\" and can use the\n// version that invoked it. In this case, use process.env._RUSH_LIB_PATH to find \"rush-lib\".\nif (rushLibModule === undefined) {\n const 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 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 (rushLibModule !== undefined) {\n // to track which scenario is active and how it got initialized.\n global.___rush___rushLibModuleFromEnvironment = rushLibModule;\n terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} from process.env.${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 (rushLibModule === undefined) {\n try {\n const rushJsonPath: string | undefined = tryFindRushJsonLocation(process.cwd());\n if (!rushJsonPath) {\n throw new Error(\n 'Unable to find rush.json in the current folder or its parent folders.\\n' +\n 'This tool is meant to be invoked from a working directory inside a Rush repository.'\n );\n }\n const monorepoRoot: string = path.dirname(rushJsonPath);\n\n const rushJson: JsonObject = JsonFile.load(rushJsonPath);\n const { rushVersion } = rushJson;\n\n const installRunNodeModuleFolder: string = path.join(\n monorepoRoot,\n `common/temp/install-run/@microsoft+rush@${rushVersion}`\n );\n\n try {\n // First, try to load the version of \"rush-lib\" that was installed by install-run-rush.js\n terminal.writeVerboseLine(`Trying to load ${RUSH_LIB_NAME} installed by install-run-rush`);\n rushLibModule = requireRushLibUnderFolderPath(installRunNodeModuleFolder);\n } catch (e) {\n let installAndRunRushStderrContent: string = '';\n try {\n const installAndRunRushJSPath: string = path.join(monorepoRoot, 'common/scripts/install-run-rush.js');\n\n terminal.writeLine('The Rush engine has not been installed yet. Invoking install-run-rush.js...');\n\n const installAndRuhRushProcess: SpawnSyncReturns<string> = Executable.spawnSync(\n 'node',\n [installAndRunRushJSPath, '--help'],\n {\n stdio: 'pipe'\n }\n );\n\n installAndRunRushStderrContent = installAndRuhRushProcess.stderr;\n if (installAndRuhRushProcess.status !== 0) {\n throw new Error(`The ${RUSH_LIB_NAME} package failed to install`);\n }\n\n // Retry to load \"rush-lib\" after install-run-rush run\n terminal.writeVerboseLine(\n `Trying to load ${RUSH_LIB_NAME} installed by install-run-rush a second time`\n );\n rushLibModule = requireRushLibUnderFolderPath(installRunNodeModuleFolder);\n } catch (e) {\n console.error(`${installAndRunRushStderrContent}`);\n throw new Error(`The ${RUSH_LIB_NAME} package failed to load`);\n }\n }\n\n if (rushLibModule !== undefined) {\n // to track which scenario is active and how it got initialized.\n global.___rush___rushLibModuleFromInstallAndRunRush = rushLibModule;\n terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} installed by install-run-rush`);\n }\n } catch (e) {\n // no-catch\n errorMessage = (e as Error).message;\n }\n}\n\nif (rushLibModule === undefined) {\n // This error indicates that a project is trying to import \"@rushstack/rush-sdk\", but the Rush engine\n // instance cannot be found. If you are writing Jest tests for a Rush plugin, add \"@microsoft/rush-lib\"\n // to the devDependencies for your project.\n console.error(`Error: The @rushstack/rush-sdk package was not able to load the Rush engine:\n${errorMessage}\n`);\n process.exit(1);\n}\n\n// Based on TypeScript's __exportStar()\nfor (const property in rushLibModule) {\n if (property !== 'default' && !exports.hasOwnProperty(property)) {\n const rushLibModuleForClosure: RushLibModuleType = rushLibModule;\n\n // Based on TypeScript's __createBinding()\n Object.defineProperty(exports, property, {\n enumerable: true,\n get: function () {\n return rushLibModuleForClosure[property];\n }\n });\n }\n}\n\n/**\n * Used by the .js stubs for path-based imports of `@microsoft/rush-lib` internal APIs.\n */\nexport function _rushSdk_loadInternalModule(srcImportPath: string): unknown {\n if (!exports._RushInternals) {\n throw new Error(\n `Rush version ${exports.Rush.version} does not support internal API imports via rush-sdk`\n );\n }\n return exports._RushInternals.loadModule(srcImportPath);\n}\n\n/**\n * Require `@microsoft/rush-lib` under the specified folder path.\n */\nfunction requireRushLibUnderFolderPath(folderPath: string): RushLibModuleType {\n const rushLibModulePath: string = Import.resolveModule({\n modulePath: RUSH_LIB_NAME,\n baseFolderPath: folderPath\n });\n\n return _require(rushLibModulePath);\n}\n\n/**\n * Find the rush.json location and return the path, or undefined if a rush.json can't be found.\n *\n * @privateRemarks\n * Keep this in sync with `RushConfiguration.tryFindRushJsonLocation`.\n */\nfunction tryFindRushJsonLocation(startingFolder: string): string | undefined {\n let currentFolder: string = startingFolder;\n\n // Look upwards at parent folders until we find a folder containing rush.json\n for (let i: number = 0; i < 10; ++i) {\n const rushJsonFilename: string = path.join(currentFolder, 'rush.json');\n\n if (FileSystem.exists(rushJsonFilename)) {\n return rushJsonFilename;\n }\n\n const parentFolder: string = path.dirname(currentFolder);\n if (parentFolder === currentFolder) {\n break;\n }\n\n currentFolder = parentFolder;\n }\n\n return undefined;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/rush-sdk",
3
- "version": "5.96.0",
3
+ "version": "5.97.1-pr3481.18",
4
4
  "description": "An API for interacting with the Rush engine",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,13 +20,13 @@
20
20
  "@types/heft-jest": "1.0.1",
21
21
  "@types/semver": "7.3.5",
22
22
  "@types/webpack-env": "1.18.0",
23
- "@microsoft/rush-lib": "5.96.0",
23
+ "@microsoft/rush-lib": "5.97.1-pr3481.18",
24
24
  "@rushstack/eslint-config": "3.2.0",
25
25
  "@rushstack/heft": "0.50.0",
26
- "@rushstack/heft-node-rig": "1.12.5",
27
- "@rushstack/stream-collator": "4.0.228",
26
+ "@rushstack/heft-node-rig": "1.12.6",
27
+ "@rushstack/stream-collator": "4.0.229",
28
28
  "@rushstack/ts-command-line": "4.13.2",
29
- "@rushstack/terminal": "0.5.3"
29
+ "@rushstack/terminal": "0.5.4"
30
30
  },
31
31
  "scripts": {
32
32
  "build": "heft build --clean",