@rushstack/rush-sdk 5.112.2 → 5.113.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 +243 -89
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/api/ExperimentsConfiguration.d.ts +2 -2
- package/lib/api/LastInstallFlag.d.ts +2 -1
- package/lib/api/LastLinkFlag.d.ts +2 -2
- package/lib/api/PackageJsonEditor.d.ts +15 -0
- package/lib/api/RushConfiguration.d.ts +56 -74
- package/lib/api/RushConfigurationProject.d.ts +14 -8
- package/lib/api/Subspace.d.ts +117 -0
- package/lib/api/{SubspaceConfiguration.js → Subspace.js} +1 -1
- package/lib/api/SubspacesConfiguration.d.ts +58 -0
- package/lib/api/SubspacesConfiguration.js +1 -0
- package/lib/api/VersionPolicyConfiguration.d.ts +1 -1
- package/lib/api/packageManager/PnpmPackageManager.d.ts +7 -0
- package/lib/cli/actions/BaseInstallAction.d.ts +4 -0
- package/lib/index.d.ts +3 -2
- package/lib/logic/ChangeManager.d.ts +1 -1
- package/lib/logic/ChangelogGenerator.d.ts +2 -2
- package/lib/logic/PublishUtilities.d.ts +2 -2
- package/lib/logic/RepoStateFile.d.ts +5 -3
- package/lib/logic/RushConstants.d.ts +8 -0
- package/lib/logic/base/BaseInstallManagerTypes.d.ts +5 -0
- package/lib/logic/base/BaseShrinkwrapFile.d.ts +3 -2
- package/lib/logic/installManager/InstallHelpers.d.ts +2 -1
- package/lib/logic/npm/NpmShrinkwrapFile.d.ts +2 -1
- package/lib/logic/pnpm/IPnpmfile.d.ts +15 -0
- package/lib/logic/pnpm/PnpmShrinkwrapFile.d.ts +8 -2
- package/lib/logic/pnpm/PnpmfileConfiguration.d.ts +3 -2
- package/lib/logic/policy/PolicyValidator.d.ts +2 -1
- package/lib/logic/policy/ShrinkwrapFilePolicy.d.ts +2 -1
- package/lib/logic/selectors/SubspaceSelectorParser.d.ts +10 -0
- package/lib/logic/selectors/SubspaceSelectorParser.js +1 -0
- package/lib/logic/versionMismatch/VersionMismatchFinder.d.ts +2 -0
- package/lib/logic/yarn/YarnShrinkwrapFile.d.ts +2 -1
- package/lib/utilities/PathConstants.d.ts +1 -0
- package/lib/utilities/Utilities.d.ts +4 -0
- package/lib/utilities/npmrcUtilities.d.ts +1 -1
- 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 +6 -6
- package/lib/api/SubspaceConfiguration.d.ts +0 -26
|
@@ -5,6 +5,7 @@ import type { IExperimentsJson } from '../../api/ExperimentsConfiguration';
|
|
|
5
5
|
import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
|
|
6
6
|
import type { BaseProjectShrinkwrapFile } from './BaseProjectShrinkwrapFile';
|
|
7
7
|
import type { PackageManagerOptionsConfigurationBase } from './BasePackageManagerOptionsConfiguration';
|
|
8
|
+
import type { Subspace } from '../../api/Subspace';
|
|
8
9
|
/**
|
|
9
10
|
* This class is a parser for both npm's npm-shrinkwrap.json and pnpm's pnpm-lock.yaml file formats.
|
|
10
11
|
*/
|
|
@@ -64,7 +65,7 @@ export declare abstract class BaseShrinkwrapFile {
|
|
|
64
65
|
*
|
|
65
66
|
* @returns a list of orphaned projects.
|
|
66
67
|
*/
|
|
67
|
-
findOrphanedProjects(rushConfiguration: RushConfiguration): ReadonlyArray<string>;
|
|
68
|
+
findOrphanedProjects(rushConfiguration: RushConfiguration, subspace: Subspace): ReadonlyArray<string>;
|
|
68
69
|
/**
|
|
69
70
|
* Returns a project shrinkwrap file for the specified project that contains all dependencies and transitive
|
|
70
71
|
* dependencies.
|
|
@@ -81,7 +82,7 @@ export declare abstract class BaseShrinkwrapFile {
|
|
|
81
82
|
*
|
|
82
83
|
* @virtual
|
|
83
84
|
*/
|
|
84
|
-
abstract isWorkspaceProjectModifiedAsync(project: RushConfigurationProject, variant?: string): Promise<boolean>;
|
|
85
|
+
abstract isWorkspaceProjectModifiedAsync(project: RushConfigurationProject, subspace: Subspace, variant?: string): Promise<boolean>;
|
|
85
86
|
/** @virtual */
|
|
86
87
|
protected abstract serialize(): string;
|
|
87
88
|
protected _getTempProjectNames(dependencies: {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { RushConfiguration } from '../../api/RushConfiguration';
|
|
3
3
|
import type { RushGlobalFolder } from '../../api/RushGlobalFolder';
|
|
4
|
+
import type { Subspace } from '../../api/Subspace';
|
|
4
5
|
export declare class InstallHelpers {
|
|
5
|
-
static generateCommonPackageJson(rushConfiguration: RushConfiguration, dependencies?: Map<string, string>): void;
|
|
6
|
+
static generateCommonPackageJson(rushConfiguration: RushConfiguration, subspace: Subspace, dependencies?: Map<string, string>): void;
|
|
6
7
|
static getPackageManagerEnvironment(rushConfiguration: RushConfiguration, options?: {
|
|
7
8
|
debug?: boolean;
|
|
8
9
|
}): NodeJS.ProcessEnv;
|
|
@@ -2,6 +2,7 @@ import { BaseShrinkwrapFile } from '../base/BaseShrinkwrapFile';
|
|
|
2
2
|
import { DependencySpecifier } from '../DependencySpecifier';
|
|
3
3
|
import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
|
|
4
4
|
import type { BaseProjectShrinkwrapFile } from '../base/BaseProjectShrinkwrapFile';
|
|
5
|
+
import type { Subspace } from '../../api/Subspace';
|
|
5
6
|
export declare class NpmShrinkwrapFile extends BaseShrinkwrapFile {
|
|
6
7
|
readonly isWorkspaceCompatible: boolean;
|
|
7
8
|
private _shrinkwrapJson;
|
|
@@ -24,6 +25,6 @@ export declare class NpmShrinkwrapFile extends BaseShrinkwrapFile {
|
|
|
24
25
|
/** @override */
|
|
25
26
|
getProjectShrinkwrap(project: RushConfigurationProject): BaseProjectShrinkwrapFile<NpmShrinkwrapFile> | undefined;
|
|
26
27
|
/** @override */
|
|
27
|
-
isWorkspaceProjectModifiedAsync(project: RushConfigurationProject, variant?: string): Promise<boolean>;
|
|
28
|
+
isWorkspaceProjectModifiedAsync(project: RushConfigurationProject, subspace: Subspace, variant?: string): Promise<boolean>;
|
|
28
29
|
}
|
|
29
30
|
//# sourceMappingURL=NpmShrinkwrapFile.d.ts.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { LogBase } from '@pnpm/logger';
|
|
2
2
|
import type { IPackageJson } from '@rushstack/node-core-library';
|
|
3
3
|
import type { IPnpmShrinkwrapYaml } from './PnpmShrinkwrapFile';
|
|
4
|
+
import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
|
|
4
5
|
/**
|
|
5
6
|
* The `settings` parameter passed to {@link IPnpmfileShim.hooks.readPackage} and
|
|
6
7
|
* {@link IPnpmfileShim.hooks.afterAllResolved}.
|
|
@@ -19,6 +20,19 @@ 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 ISubspacePnpmfileShimSettings {
|
|
31
|
+
semverPath: string;
|
|
32
|
+
workspaceProjects: Record<string, IWorkspaceProjectInfo>;
|
|
33
|
+
subspaceProjects: Record<string, IWorkspaceProjectInfo>;
|
|
34
|
+
userPnpmfilePath?: string;
|
|
35
|
+
}
|
|
22
36
|
/**
|
|
23
37
|
* The `context` parameter passed to {@link IPnpmfile.hooks.readPackage}, as defined by the
|
|
24
38
|
* pnpmfile API contract.
|
|
@@ -26,6 +40,7 @@ export interface IPnpmfileShimSettings {
|
|
|
26
40
|
export interface IPnpmfileContext {
|
|
27
41
|
log: (message: string) => void;
|
|
28
42
|
pnpmfileShimSettings?: IPnpmfileShimSettings;
|
|
43
|
+
subspacePnpmfileShimSettings?: ISubspacePnpmfileShimSettings;
|
|
29
44
|
}
|
|
30
45
|
/**
|
|
31
46
|
* The `log` parameter passed to {@link IPnpmfile.hooks.filterLog}.
|
|
@@ -6,9 +6,13 @@ import type { IExperimentsJson } from '../../api/ExperimentsConfiguration';
|
|
|
6
6
|
import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
|
|
7
7
|
import { PnpmProjectShrinkwrapFile } from './PnpmProjectShrinkwrapFile';
|
|
8
8
|
import type { PackageManagerOptionsConfigurationBase } from '../base/BasePackageManagerOptionsConfiguration';
|
|
9
|
+
import type { Subspace } from '../../api/Subspace';
|
|
9
10
|
export interface IPeerDependenciesMetaYaml {
|
|
10
11
|
optional?: boolean;
|
|
11
12
|
}
|
|
13
|
+
export interface IDependenciesMetaYaml {
|
|
14
|
+
injected?: boolean;
|
|
15
|
+
}
|
|
12
16
|
export type IPnpmV7VersionSpecifier = string;
|
|
13
17
|
export interface IPnpmV8VersionSpecifier {
|
|
14
18
|
version: string;
|
|
@@ -42,6 +46,8 @@ export interface IPnpmShrinkwrapImporterYaml {
|
|
|
42
46
|
devDependencies?: Record<string, IPnpmVersionSpecifier>;
|
|
43
47
|
/** The list of resolved version numbers for optional dependencies */
|
|
44
48
|
optionalDependencies?: Record<string, IPnpmVersionSpecifier>;
|
|
49
|
+
/** The list of metadata for dependencies declared inside dependencies, optionalDependencies, and devDependencies. */
|
|
50
|
+
dependenciesMeta?: Record<string, IDependenciesMetaYaml>;
|
|
45
51
|
/**
|
|
46
52
|
* The list of specifiers used to resolve dependency versions
|
|
47
53
|
*
|
|
@@ -201,7 +207,7 @@ export declare class PnpmShrinkwrapFile extends BaseShrinkwrapFile {
|
|
|
201
207
|
*/
|
|
202
208
|
protected tryEnsureDependencyVersion(dependencySpecifier: DependencySpecifier, tempProjectName: string): DependencySpecifier | undefined;
|
|
203
209
|
/** @override */
|
|
204
|
-
findOrphanedProjects(rushConfiguration: RushConfiguration): ReadonlyArray<string>;
|
|
210
|
+
findOrphanedProjects(rushConfiguration: RushConfiguration, subspace: Subspace): ReadonlyArray<string>;
|
|
205
211
|
/** @override */
|
|
206
212
|
getProjectShrinkwrap(project: RushConfigurationProject): PnpmProjectShrinkwrapFile;
|
|
207
213
|
getImporterKeys(): Iterable<string>;
|
|
@@ -209,7 +215,7 @@ export declare class PnpmShrinkwrapFile extends BaseShrinkwrapFile {
|
|
|
209
215
|
getImporter(importerKey: string): IPnpmShrinkwrapImporterYaml | undefined;
|
|
210
216
|
getIntegrityForImporter(importerKey: string): Map<string, string> | undefined;
|
|
211
217
|
/** @override */
|
|
212
|
-
isWorkspaceProjectModifiedAsync(project: RushConfigurationProject, variant?: string): Promise<boolean>;
|
|
218
|
+
isWorkspaceProjectModifiedAsync(project: RushConfigurationProject, subspace: Subspace, variant?: string): Promise<boolean>;
|
|
213
219
|
private _getIntegrityForPackage;
|
|
214
220
|
private _addIntegrities;
|
|
215
221
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type IPackageJson } from '@rushstack/node-core-library';
|
|
2
2
|
import type { RushConfiguration } from '../../api/RushConfiguration';
|
|
3
|
+
import type { Subspace } from '../../api/Subspace';
|
|
3
4
|
/**
|
|
4
5
|
* Options used when generating the pnpmfile shim settings file.
|
|
5
6
|
*/
|
|
@@ -16,8 +17,8 @@ export interface IPnpmfileShimOptions {
|
|
|
16
17
|
export declare class PnpmfileConfiguration {
|
|
17
18
|
private _context;
|
|
18
19
|
private constructor();
|
|
19
|
-
static initializeAsync(rushConfiguration: RushConfiguration, pnpmfileShimOptions?: IPnpmfileShimOptions): Promise<PnpmfileConfiguration>;
|
|
20
|
-
static writeCommonTempPnpmfileShimAsync(rushConfiguration: RushConfiguration, options?: IPnpmfileShimOptions): Promise<void>;
|
|
20
|
+
static initializeAsync(rushConfiguration: RushConfiguration, subspace: Subspace, pnpmfileShimOptions?: IPnpmfileShimOptions): Promise<PnpmfileConfiguration>;
|
|
21
|
+
static writeCommonTempPnpmfileShimAsync(rushConfiguration: RushConfiguration, targetDir: string, subspace: Subspace, options?: IPnpmfileShimOptions): Promise<void>;
|
|
21
22
|
private static _getPnpmfileShimSettingsAsync;
|
|
22
23
|
/**
|
|
23
24
|
* Transform a package.json file using the pnpmfile.js hook.
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { RushConfiguration } from '../../api/RushConfiguration';
|
|
2
|
+
import type { Subspace } from '../../api/Subspace';
|
|
2
3
|
export interface IPolicyValidatorOptions {
|
|
3
4
|
bypassPolicyAllowed?: boolean;
|
|
4
5
|
bypassPolicy?: boolean;
|
|
5
6
|
allowShrinkwrapUpdates?: boolean;
|
|
6
7
|
shrinkwrapVariant?: string;
|
|
7
8
|
}
|
|
8
|
-
export declare function validatePolicyAsync(rushConfiguration: RushConfiguration, options: IPolicyValidatorOptions): Promise<void>;
|
|
9
|
+
export declare function validatePolicyAsync(rushConfiguration: RushConfiguration, subspace: Subspace, options: IPolicyValidatorOptions): Promise<void>;
|
|
9
10
|
//# sourceMappingURL=PolicyValidator.d.ts.map
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { RushConfiguration } from '../../api/RushConfiguration';
|
|
2
2
|
import type { IPolicyValidatorOptions } from './PolicyValidator';
|
|
3
3
|
import type { RepoStateFile } from '../RepoStateFile';
|
|
4
|
+
import type { Subspace } from '../../api/Subspace';
|
|
4
5
|
export interface IShrinkwrapFilePolicyValidatorOptions extends IPolicyValidatorOptions {
|
|
5
6
|
repoState: RepoStateFile;
|
|
6
7
|
}
|
|
7
8
|
/**
|
|
8
9
|
* A policy that validates shrinkwrap files used by package managers.
|
|
9
10
|
*/
|
|
10
|
-
export declare function validate(rushConfiguration: RushConfiguration, options: IPolicyValidatorOptions): void;
|
|
11
|
+
export declare function validate(rushConfiguration: RushConfiguration, subspace: Subspace, options: IPolicyValidatorOptions): void;
|
|
11
12
|
//# sourceMappingURL=ShrinkwrapFilePolicy.d.ts.map
|
|
@@ -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 SubspaceSelectorParser implements ISelectorParser<RushConfigurationProject> {
|
|
5
|
+
private readonly _rushConfiguration;
|
|
6
|
+
constructor(rushConfiguration: RushConfiguration);
|
|
7
|
+
evaluateSelectorAsync({ unscopedSelector }: IEvaluateSelectorOptions): Promise<Iterable<RushConfigurationProject>>;
|
|
8
|
+
getCompletions(): Iterable<string>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=SubspaceSelectorParser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/selectors/SubspaceSelectorParser");
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type ITerminal } from '@rushstack/node-core-library';
|
|
2
2
|
import type { RushConfiguration } from '../../api/RushConfiguration';
|
|
3
3
|
import type { VersionMismatchFinderEntity } from './VersionMismatchFinderEntity';
|
|
4
|
+
import type { Subspace } from '../../api/Subspace';
|
|
4
5
|
export interface IVersionMismatchFinderOptions {
|
|
5
6
|
variant?: string | undefined;
|
|
7
|
+
subspace?: Subspace;
|
|
6
8
|
}
|
|
7
9
|
export interface IVersionMismatchFinderRushCheckOptions extends IVersionMismatchFinderOptions {
|
|
8
10
|
printAsJson?: boolean | undefined;
|
|
@@ -2,6 +2,7 @@ import { BaseShrinkwrapFile } from '../base/BaseShrinkwrapFile';
|
|
|
2
2
|
import type { DependencySpecifier } from '../DependencySpecifier';
|
|
3
3
|
import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
|
|
4
4
|
import type { BaseProjectShrinkwrapFile } from '../base/BaseProjectShrinkwrapFile';
|
|
5
|
+
import type { Subspace } from '../../api/Subspace';
|
|
5
6
|
/**
|
|
6
7
|
* Support for consuming the "yarn.lock" file.
|
|
7
8
|
*
|
|
@@ -50,6 +51,6 @@ export declare class YarnShrinkwrapFile extends BaseShrinkwrapFile {
|
|
|
50
51
|
/** @override */
|
|
51
52
|
getProjectShrinkwrap(project: RushConfigurationProject): BaseProjectShrinkwrapFile<YarnShrinkwrapFile> | undefined;
|
|
52
53
|
/** @override */
|
|
53
|
-
isWorkspaceProjectModifiedAsync(project: RushConfigurationProject, variant?: string): Promise<boolean>;
|
|
54
|
+
isWorkspaceProjectModifiedAsync(project: RushConfigurationProject, subspace: Subspace, variant?: string): Promise<boolean>;
|
|
54
55
|
}
|
|
55
56
|
//# sourceMappingURL=YarnShrinkwrapFile.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 subspacePnpmfileShimFilename: string;
|
|
14
15
|
export declare const installRunScriptFilename: string;
|
|
15
16
|
export declare const installRunRushScriptFilename: string;
|
|
16
17
|
export declare const installRunRushxScriptFilename: string;
|
|
@@ -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
|
/**
|
|
@@ -11,6 +11,6 @@ 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, logger?: ILogger, extraLines?: string[]): string | undefined;
|
|
15
15
|
export declare function isVariableSetInNpmrcFile(sourceNpmrcFolder: string, variableKey: string): boolean;
|
|
16
16
|
//# sourceMappingURL=npmrcUtilities.d.ts.map
|
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/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,oEAQsC;AAEtC,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AC3C,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(src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O,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;SACJ;QAED,MAAM,KAAK,GAAU,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAC7D,KAAK,CAAC,IAAI,GAAG,YAAY,CAAC;QAC1B,M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AAO;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,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,OAA8B;QAC1D,sFAAsF;;QAEtF,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,GAAG,EAAE,CAA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6B,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.
|
|
3
|
+
"version": "5.113.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.64.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/semver": "7.5.0",
|
|
32
32
|
"@types/webpack-env": "1.18.0",
|
|
33
|
-
"@microsoft/rush-lib": "5.
|
|
34
|
-
"@rushstack/heft": "0.63.4",
|
|
33
|
+
"@microsoft/rush-lib": "5.113.0",
|
|
35
34
|
"local-node-rig": "1.0.0",
|
|
36
|
-
"@rushstack/terminal": "0.7.14",
|
|
37
35
|
"@rushstack/ts-command-line": "4.17.1",
|
|
38
|
-
"@rushstack/
|
|
36
|
+
"@rushstack/terminal": "0.7.20",
|
|
37
|
+
"@rushstack/stream-collator": "4.1.21",
|
|
38
|
+
"@rushstack/heft": "0.64.3"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "heft build --clean",
|
|
@@ -1,26 +0,0 @@
|
|
|
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
|