@rushstack/rush-sdk 5.96.0 → 5.97.1-pr3949
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 +279 -29
- package/lib/api/CobuildConfiguration.d.ts +63 -0
- package/lib/api/CobuildConfiguration.js +1 -0
- package/lib/api/EnvironmentConfiguration.d.ts +61 -20
- package/lib/index.d.ts +3 -1
- package/lib/logic/RushConstants.d.ts +9 -0
- package/lib/logic/buildCache/ProjectBuildCache.d.ts +5 -4
- package/lib/logic/cobuild/CobuildLock.d.ts +24 -0
- package/lib/logic/cobuild/CobuildLock.js +1 -0
- package/lib/logic/cobuild/ICobuildLockProvider.d.ts +46 -0
- package/lib/logic/cobuild/ICobuildLockProvider.js +1 -0
- package/lib/logic/operations/AsyncOperationQueue.d.ts +23 -4
- package/lib/logic/operations/CacheableOperationPlugin.d.ts +21 -0
- package/lib/logic/operations/CacheableOperationPlugin.js +1 -0
- package/lib/logic/operations/IOperationRunner.d.ts +29 -10
- package/lib/logic/operations/OperationExecutionManager.d.ts +5 -0
- package/lib/logic/operations/OperationExecutionRecord.d.ts +7 -1
- package/lib/logic/operations/OperationRunnerHooks.d.ts +50 -0
- package/lib/logic/operations/OperationRunnerHooks.js +1 -0
- package/lib/logic/operations/OperationStatus.d.ts +8 -0
- package/lib/logic/operations/PeriodicCallback.d.ts +20 -0
- package/lib/logic/operations/PeriodicCallback.js +1 -0
- package/lib/logic/operations/ShellOperationRunner.d.ts +4 -13
- package/lib/pluginFramework/PhasedCommandHooks.d.ts +15 -1
- package/lib/pluginFramework/RushSession.d.ts +11 -2
- package/lib-shim/index.d.ts.map +1 -1
- package/lib-shim/index.js +5 -5
- package/lib-shim/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/operations/PeriodicCallback");
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { OperationStatus } from './OperationStatus';
|
|
2
2
|
import { IOperationRunner, IOperationRunnerContext } from './IOperationRunner';
|
|
3
|
+
import { PeriodicCallback } from './PeriodicCallback';
|
|
4
|
+
import { OperationRunnerHooks } from './OperationRunnerHooks';
|
|
3
5
|
import type { RushConfiguration } from '../../api/RushConfiguration';
|
|
4
6
|
import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
|
|
5
7
|
import type { ProjectChangeAnalyzer } from '../ProjectChangeAnalyzer';
|
|
6
|
-
import type { BuildCacheConfiguration } from '../../api/BuildCacheConfiguration';
|
|
7
8
|
import type { IPhase } from '../../api/CommandLineConfiguration';
|
|
8
9
|
export interface IProjectDeps {
|
|
9
10
|
files: {
|
|
@@ -14,9 +15,7 @@ export interface IProjectDeps {
|
|
|
14
15
|
export interface IOperationRunnerOptions {
|
|
15
16
|
rushProject: RushConfigurationProject;
|
|
16
17
|
rushConfiguration: RushConfiguration;
|
|
17
|
-
buildCacheConfiguration: BuildCacheConfiguration | undefined;
|
|
18
18
|
commandToRun: string;
|
|
19
|
-
isIncrementalBuildAllowed: boolean;
|
|
20
19
|
projectChangeAnalyzer: ProjectChangeAnalyzer;
|
|
21
20
|
displayName: string;
|
|
22
21
|
phase: IPhase;
|
|
@@ -32,31 +31,23 @@ export interface IOperationRunnerOptions {
|
|
|
32
31
|
*/
|
|
33
32
|
export declare class ShellOperationRunner implements IOperationRunner {
|
|
34
33
|
readonly name: string;
|
|
35
|
-
isCacheWriteAllowed: boolean;
|
|
36
|
-
isSkipAllowed: boolean;
|
|
37
34
|
readonly reportTiming: boolean;
|
|
38
35
|
readonly silent: boolean;
|
|
39
36
|
readonly warningsAreAllowed: boolean;
|
|
37
|
+
readonly hooks: OperationRunnerHooks;
|
|
38
|
+
readonly periodicCallback: PeriodicCallback;
|
|
40
39
|
private readonly _rushProject;
|
|
41
40
|
private readonly _phase;
|
|
42
41
|
private readonly _rushConfiguration;
|
|
43
|
-
private readonly _buildCacheConfiguration;
|
|
44
42
|
private readonly _commandName;
|
|
45
43
|
private readonly _commandToRun;
|
|
46
|
-
private readonly _isCacheReadAllowed;
|
|
47
44
|
private readonly _projectChangeAnalyzer;
|
|
48
45
|
private readonly _packageDepsFilename;
|
|
49
46
|
private readonly _logFilenameIdentifier;
|
|
50
47
|
private readonly _selectedPhases;
|
|
51
|
-
/**
|
|
52
|
-
* UNINITIALIZED === we haven't tried to initialize yet
|
|
53
|
-
* undefined === we didn't create one because the feature is not enabled
|
|
54
|
-
*/
|
|
55
|
-
private _projectBuildCache;
|
|
56
48
|
constructor(options: IOperationRunnerOptions);
|
|
57
49
|
executeAsync(context: IOperationRunnerContext): Promise<OperationStatus>;
|
|
58
50
|
private _executeAsync;
|
|
59
|
-
private _tryGetProjectBuildCacheAsync;
|
|
60
51
|
}
|
|
61
52
|
/**
|
|
62
53
|
* When running a command from the "scripts" block in package.json, if the command
|
|
@@ -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
|
package/lib-shim/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
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
|
|
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.${
|
|
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.${
|
|
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.${
|
|
106
|
+
terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} from process.env.${RUSH_LIB_PATH_ENV_VAR_NAME}`);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
}
|
package/lib-shim/index.js.map
CHANGED
|
@@ -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;QAC3F,mBAAmB;QACnB,OAAO,uBAAuB,CAAC,UAAU,CAAC,CAAC;KAC5C;SAAM;QACL,OAAO,OAAO,CAAC,UAAU,CAAC,CAAC;KAC5B;AACH,CAAC;AAED,qGAAqG;AACrG,gGAAgG;AAChG,IAAI,aAAa,GACf,MAAM,CAAC,uBAAuB;IAC9B,MAAM,CAAC,sCAAsC;IAC7C,MAAM,CAAC,4CAA4C,CAAC;AACtD,IAAI,YAAY,GAAW,EAAE,CAAC;AAE9B,6FAA6F;AAC7F,+FAA+F;AAC/F,IAAI,aAAa,KAAK,SAAS,EAAE;IAC/B,MAAM,aAAa,GAA8B,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,0CAAE,QAAQ,CAAC;IAC1E,IAAI,aAAa,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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,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;QAC3F,mBAAmB;QACnB,OAAO,uBAAuB,CAAC,UAAU,CAAC,CAAC;KAC5C;SAAM;QACL,OAAO,OAAO,CAAC,UAAU,CAAC,CAAC;KAC5B;AACH,CAAC;AAED,qGAAqG;AACrG,gGAAgG;AAChG,IAAI,aAAa,GACf,MAAM,CAAC,uBAAu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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.
|
|
3
|
+
"version": "5.97.1-pr3949",
|
|
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.
|
|
23
|
+
"@microsoft/rush-lib": "5.97.1-pr3949",
|
|
24
24
|
"@rushstack/eslint-config": "3.2.0",
|
|
25
25
|
"@rushstack/heft": "0.50.0",
|
|
26
|
-
"@rushstack/heft-node-rig": "1.12.
|
|
27
|
-
"@rushstack/stream-collator": "4.0.
|
|
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.
|
|
29
|
+
"@rushstack/terminal": "0.5.4"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "heft build --clean",
|