@rushstack/rush-sdk 5.112.2-pr4476.0 → 5.112.2-pr4485.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1112,10 +1112,6 @@ export declare interface ICreateOperationsContext {
1112
1112
  * Maps from the `longName` field in command-line.json to the parser configuration in ts-command-line.
1113
1113
  */
1114
1114
  readonly customParameters: ReadonlyMap<string, CommandLineParameter>;
1115
- /**
1116
- * The current state of the repository, if available
1117
- */
1118
- readonly inputSnapshot?: IInputSnapshot;
1119
1115
  /**
1120
1116
  * If true, projects may read their output from cache or be skipped if already up to date.
1121
1117
  * If false, neither of the above may occur, e.g. "rush rebuild"
@@ -1138,6 +1134,10 @@ export declare interface ICreateOperationsContext {
1138
1134
  * The set of phases selected for the current command execution.
1139
1135
  */
1140
1136
  readonly phaseSelection: ReadonlySet<IPhase>;
1137
+ /**
1138
+ * The current state of the repository
1139
+ */
1140
+ readonly projectChangeAnalyzer: ProjectChangeAnalyzer;
1141
1141
  /**
1142
1142
  * The set of Rush projects selected for the current command execution.
1143
1143
  */
@@ -1399,32 +1399,6 @@ declare interface IIndividualVersionJson extends IVersionPolicyJson {
1399
1399
  lockedMajor?: number;
1400
1400
  }
1401
1401
 
1402
- /**
1403
- * Represents a synchronously-queryable in-memory snapshot of the state of the inputs to a Rush repository.
1404
- *
1405
- * The methods on this interface are idempotent and will return the same result regardless of when they are executed.
1406
- * @beta
1407
- */
1408
- export declare interface IInputSnapshot {
1409
- /**
1410
- * Gets the map of file paths to Git hashes that will be used to compute the local state hash of the operation.
1411
- * Exposed separately from the final state hash to facilitate detailed change detection.
1412
- *
1413
- * @param project - The Rush project to get hashes for
1414
- * @param operationName - The name of the operation (phase) to get hashes for. If omitted, returns a default set for the project, as used for bulk commands.
1415
- * @returns A map of file name to Git hash. For local files paths will be relative. Configured additional files may be absolute paths.
1416
- */
1417
- getTrackedFileHashesForOperation(project: IRushConfigurationProjectForSnapshot, operationName?: string): ReadonlyMap<string, string>;
1418
- /**
1419
- * Gets the local state hash for the operation. This will later be combined with the hash of the command being executed and the final hashes of the operation's dependencies to compute
1420
- * the final hash for the operation.
1421
- * @param project - The Rush project to compute the state hash for
1422
- * @param operationName - The name of the operation (phase) to get hashes for. If omitted, returns a generic hash for the whole project, as used for bulk commands.
1423
- * @returns The local state hash for the project. This is a hash of the environment, the project's tracked files, and any additional files.
1424
- */
1425
- getLocalStateHashForOperation(project: IRushConfigurationProjectForSnapshot, operationName?: string): string;
1426
- }
1427
-
1428
1402
  /**
1429
1403
  * Options to pass to the rush "launch" functions.
1430
1404
  *
@@ -1720,6 +1694,12 @@ export declare interface IOperationRunnerContext {
1720
1694
  * ignore dependent projects.
1721
1695
  */
1722
1696
  readonly changedProjectsOnly: boolean;
1697
+ /**
1698
+ * Invokes the specified callback with a terminal that is associated with this operation.
1699
+ *
1700
+ * Will write to a log file corresponding to the phase and project, and clean it up upon completion.
1701
+ */
1702
+ withTerminalAsync<T>(callback: (terminal: ITerminal, terminalProvider: ITerminalProvider) => Promise<T>, createLogFile: boolean, logFileSuffix?: string): Promise<T>;
1723
1703
  }
1724
1704
 
1725
1705
  /**
@@ -1768,6 +1748,13 @@ export declare interface IOperationSettings {
1768
1748
  * calculating final hash value when reading and writing the build cache
1769
1749
  */
1770
1750
  dependsOnAdditionalFiles?: string[];
1751
+ /**
1752
+ * When running this operation in watch mode, enable IPC functionality. This allows reusing a long-lived child
1753
+ * process instead of spawning a new child process for each incremental build.
1754
+ *
1755
+ * Implicitly disables the build cache for this operation.
1756
+ */
1757
+ useIPCInWatchMode?: boolean;
1771
1758
  }
1772
1759
 
1773
1760
  /**
@@ -1959,54 +1946,12 @@ export declare interface IPrefixMatch<TItem> {
1959
1946
  }
1960
1947
 
1961
1948
  /**
1962
- * The readonly component of `LookupByPath`, to simplify unit testing.
1963
- *
1964
- * @beta
1949
+ * @internal
1965
1950
  */
1966
- export declare interface IReadonlyLookupByPath<TItem> {
1967
- /**
1968
- * Searches for the item associated with `childPath`, or the nearest ancestor of that path that
1969
- * has an associated item.
1970
- *
1971
- * @returns the found item, or `undefined` if no item was found
1972
- *
1973
- * @example
1974
- * ```ts
1975
- * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
1976
- * tree.findChildPath('foo/baz'); // returns 1
1977
- * tree.findChildPath('foo/bar/baz'); // returns 2
1978
- * ```
1979
- */
1980
- findChildPath(childPath: string): TItem | undefined;
1981
- /**
1982
- * Searches for the item for which the recorded prefix is the longest matching prefix of `query`.
1983
- * Obtains both the item and the length of the matched prefix, so that the remainder of the path can be
1984
- * extracted.
1985
- *
1986
- * @returns the found item and the length of the matched prefix, or `undefined` if no item was found
1987
- *
1988
- * @example
1989
- * ```ts
1990
- * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
1991
- * tree.findLongestPrefixMatch('foo/baz'); // returns { item: 1, index: 3 }
1992
- * tree.findLongestPrefixMatch('foo/bar/baz'); // returns { item: 2, index: 7 }
1993
- * ```
1994
- */
1995
- findLongestPrefixMatch(query: string): IPrefixMatch<TItem> | undefined;
1996
- /**
1997
- * Searches for the item associated with `childPathSegments`, or the nearest ancestor of that path that
1998
- * has an associated item.
1999
- *
2000
- * @returns the found item, or `undefined` if no item was found
2001
- *
2002
- * @example
2003
- * ```ts
2004
- * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
2005
- * tree.findChildPathFromSegments(['foo', 'baz']); // returns 1
2006
- * tree.findChildPathFromSegments(['foo','bar', 'baz']); // returns 2
2007
- * ```
2008
- */
2009
- findChildPathFromSegments(childPathSegments: Iterable<string>): TItem | undefined;
1951
+ export declare interface _IRawRepoState {
1952
+ projectState: Map<RushConfigurationProject, Map<string, string>> | undefined;
1953
+ rootDir: string;
1954
+ rawHashes: Map<string, string>;
2010
1955
  }
2011
1956
 
2012
1957
  /**
@@ -2051,11 +1996,6 @@ declare interface IRushConfigurationJson {
2051
1996
  variants?: IRushVariantOptionsJson[];
2052
1997
  }
2053
1998
 
2054
- /**
2055
- * @beta
2056
- */
2057
- export declare type IRushConfigurationProjectForSnapshot = Pick<RushConfigurationProject, 'projectFolder' | 'projectRelativeFolder'>;
2058
-
2059
1999
  /**
2060
2000
  * This represents the JSON data object for a project entry in the rush.json configuration file.
2061
2001
  */
@@ -2503,7 +2443,7 @@ export declare class LockStepVersionPolicy extends VersionPolicy {
2503
2443
  * ```
2504
2444
  * @beta
2505
2445
  */
2506
- export declare class LookupByPath<TItem> implements IReadonlyLookupByPath<TItem> {
2446
+ export declare class LookupByPath<TItem> {
2507
2447
  /**
2508
2448
  * The delimiter used to split paths
2509
2449
  */
@@ -2544,15 +2484,46 @@ export declare class LookupByPath<TItem> implements IReadonlyLookupByPath<TItem>
2544
2484
  */
2545
2485
  setItemFromSegments(pathSegments: Iterable<string>, value: TItem): this;
2546
2486
  /**
2547
- * {@inheritdoc IReadonlyLookupByPath}
2487
+ * Searches for the item associated with `childPath`, or the nearest ancestor of that path that
2488
+ * has an associated item.
2489
+ *
2490
+ * @returns the found item, or `undefined` if no item was found
2491
+ *
2492
+ * @example
2493
+ * ```ts
2494
+ * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
2495
+ * tree.findChildPath('foo/baz'); // returns 1
2496
+ * tree.findChildPath('foo/bar/baz'); // returns 2
2497
+ * ```
2548
2498
  */
2549
2499
  findChildPath(childPath: string): TItem | undefined;
2550
2500
  /**
2551
- * {@inheritdoc IReadonlyLookupByPath}
2501
+ * Searches for the item for which the recorded prefix is the longest matching prefix of `query`.
2502
+ * Obtains both the item and the length of the matched prefix, so that the remainder of the path can be
2503
+ * extracted.
2504
+ *
2505
+ * @returns the found item and the length of the matched prefix, or `undefined` if no item was found
2506
+ *
2507
+ * @example
2508
+ * ```ts
2509
+ * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
2510
+ * tree.findLongestPrefixMatch('foo/baz'); // returns { item: 1, index: 3 }
2511
+ * tree.findLongestPrefixMatch('foo/bar/baz'); // returns { item: 2, index: 7 }
2512
+ * ```
2552
2513
  */
2553
2514
  findLongestPrefixMatch(query: string): IPrefixMatch<TItem> | undefined;
2554
2515
  /**
2555
- * {@inheritdoc IReadonlyLookupByPath}
2516
+ * Searches for the item associated with `childPathSegments`, or the nearest ancestor of that path that
2517
+ * has an associated item.
2518
+ *
2519
+ * @returns the found item, or `undefined` if no item was found
2520
+ *
2521
+ * @example
2522
+ * ```ts
2523
+ * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
2524
+ * tree.findChildPathFromSegments(['foo', 'baz']); // returns 1
2525
+ * tree.findChildPathFromSegments(['foo','bar', 'baz']); // returns 2
2526
+ * ```
2556
2527
  */
2557
2528
  findChildPathFromSegments(childPathSegments: Iterable<string>): TItem | undefined;
2558
2529
  /**
@@ -3140,29 +3111,52 @@ export declare type PnpmStoreOptions = PnpmStoreLocation;
3140
3111
  * @beta
3141
3112
  */
3142
3113
  export declare class ProjectChangeAnalyzer {
3114
+ /**
3115
+ * UNINITIALIZED === we haven't looked
3116
+ * undefined === data isn't available (i.e. - git isn't present)
3117
+ */
3118
+ private _data;
3119
+ private readonly _filteredData;
3120
+ private readonly _projectStateCache;
3143
3121
  private readonly _rushConfiguration;
3144
3122
  private readonly _git;
3145
- private _snapshotPrerequisitesPromise;
3146
3123
  constructor(rushConfiguration: RushConfiguration);
3147
3124
  /**
3148
- * Gets a list of projects that have changed in the current state of the repo
3149
- * when compared to the specified branch, optionally taking the shrinkwrap and settings in
3150
- * the rush-project.json file into consideration.
3125
+ * Try to get a list of the specified project's dependencies and their hashes.
3126
+ *
3127
+ * @remarks
3128
+ * If the data can't be generated (i.e. - if Git is not present) this returns undefined.
3129
+ *
3130
+ * @internal
3151
3131
  */
3152
- getChangedProjectsAsync(options: IGetChangedProjectsOptions): Promise<Set<RushConfigurationProject>>;
3132
+ _tryGetProjectDependenciesAsync(project: RushConfigurationProject, terminal: ITerminal): Promise<Map<string, string> | undefined>;
3153
3133
  /**
3154
- * Gets a snapshot of the input state of the Rush workspace that can be queried for incremental
3155
- * build operations and use by the build cache.
3156
3134
  * @internal
3157
3135
  */
3158
- _tryGetSnapshotAsync(terminal: ITerminal): Promise<IInputSnapshot | undefined>;
3136
+ _ensureInitializedAsync(terminal: ITerminal): Promise<_IRawRepoState | undefined>;
3159
3137
  /**
3138
+ * The project state hash is calculated in the following way:
3139
+ * - Project dependencies are collected (see ProjectChangeAnalyzer.getPackageDeps)
3140
+ * - If project dependencies cannot be collected (i.e. - if Git isn't available),
3141
+ * this function returns `undefined`
3142
+ * - The (path separator normalized) repo-root-relative dependencies' file paths are sorted
3143
+ * - A SHA1 hash is created and each (sorted) file path is fed into the hash and then its
3144
+ * Git SHA is fed into the hash
3145
+ * - A hex digest of the hash is returned
3146
+ *
3160
3147
  * @internal
3161
3148
  */
3149
+ _tryGetProjectStateHashAsync(project: RushConfigurationProject, terminal: ITerminal): Promise<string | undefined>;
3162
3150
  _filterProjectDataAsync<T>(project: RushConfigurationProject, unfilteredProjectData: Map<string, T>, rootDir: string, terminal: ITerminal): Promise<Map<string, T>>;
3151
+ /**
3152
+ * Gets a list of projects that have changed in the current state of the repo
3153
+ * when compared to the specified branch, optionally taking the shrinkwrap and settings in
3154
+ * the rush-project.json file into consideration.
3155
+ */
3156
+ getChangedProjectsAsync(options: IGetChangedProjectsOptions): Promise<Set<RushConfigurationProject>>;
3157
+ private _getDataAsync;
3163
3158
  private _getIgnoreMatcherForProjectAsync;
3164
- private _computeSnapshotPrerequisites;
3165
- private _computeSnapshotPrerequisitesInner;
3159
+ private _getRepoDepsAsync;
3166
3160
  }
3167
3161
 
3168
3162
  /**
@@ -73,6 +73,13 @@ export interface IOperationSettings {
73
73
  * calculating final hash value when reading and writing the build cache
74
74
  */
75
75
  dependsOnAdditionalFiles?: string[];
76
+ /**
77
+ * When running this operation in watch mode, enable IPC functionality. This allows reusing a long-lived child
78
+ * process instead of spawning a new child process for each incremental build.
79
+ *
80
+ * Implicitly disables the build cache for this operation.
81
+ */
82
+ useIPCInWatchMode?: boolean;
76
83
  }
77
84
  /**
78
85
  * Use this class to load the "config/rush-project.json" config file.
package/lib/index.d.ts CHANGED
@@ -25,7 +25,7 @@ export { ApprovedPackagesItem, ApprovedPackagesConfiguration } from './api/Appro
25
25
  export { CommonVersionsConfiguration } from './api/CommonVersionsConfiguration';
26
26
  export { PackageJsonEditor, PackageJsonDependency, DependencyType } from './api/PackageJsonEditor';
27
27
  export { RepoStateFile } from './logic/RepoStateFile';
28
- export { LookupByPath, IPrefixMatch, IReadonlyLookupByPath } from './logic/LookupByPath';
28
+ export { LookupByPath, IPrefixMatch } from './logic/LookupByPath';
29
29
  export { EventHooks, Event } from './api/EventHooks';
30
30
  export { ChangeManager } from './api/ChangeManager';
31
31
  export { LastInstallFlag as _LastInstallFlag, ILockfileValidityCheckOptions as _ILockfileValidityCheckOptions } from './api/LastInstallFlag';
@@ -35,8 +35,7 @@ export { ILaunchOptions, Rush } from './api/Rush';
35
35
  export { RushInternals as _RushInternals } from './api/RushInternals';
36
36
  export { ExperimentsConfiguration, IExperimentsJson } from './api/ExperimentsConfiguration';
37
37
  export { CustomTipsConfiguration, CustomTipId, ICustomTipsJson, ICustomTipInfo, ICustomTipItemJson, CustomTipSeverity, CustomTipType } from './api/CustomTipsConfiguration';
38
- export { ProjectChangeAnalyzer, IGetChangedProjectsOptions } from './logic/ProjectChangeAnalyzer';
39
- export { IInputSnapshot, IRushConfigurationProjectForSnapshot } from './logic/snapshots/InputSnapshot';
38
+ export { ProjectChangeAnalyzer, IGetChangedProjectsOptions, IRawRepoState as _IRawRepoState } from './logic/ProjectChangeAnalyzer';
40
39
  export { IOperationRunner, IOperationRunnerContext } from './logic/operations/IOperationRunner';
41
40
  export { IExecutionResult, IOperationExecutionResult } from './logic/operations/IOperationExecutionResult';
42
41
  export { IOperationOptions, Operation } from './logic/operations/Operation';
@@ -7,56 +7,6 @@ export interface IPrefixMatch<TItem> {
7
7
  value: TItem;
8
8
  index: number;
9
9
  }
10
- /**
11
- * The readonly component of `LookupByPath`, to simplify unit testing.
12
- *
13
- * @beta
14
- */
15
- export interface IReadonlyLookupByPath<TItem> {
16
- /**
17
- * Searches for the item associated with `childPath`, or the nearest ancestor of that path that
18
- * has an associated item.
19
- *
20
- * @returns the found item, or `undefined` if no item was found
21
- *
22
- * @example
23
- * ```ts
24
- * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
25
- * tree.findChildPath('foo/baz'); // returns 1
26
- * tree.findChildPath('foo/bar/baz'); // returns 2
27
- * ```
28
- */
29
- findChildPath(childPath: string): TItem | undefined;
30
- /**
31
- * Searches for the item for which the recorded prefix is the longest matching prefix of `query`.
32
- * Obtains both the item and the length of the matched prefix, so that the remainder of the path can be
33
- * extracted.
34
- *
35
- * @returns the found item and the length of the matched prefix, or `undefined` if no item was found
36
- *
37
- * @example
38
- * ```ts
39
- * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
40
- * tree.findLongestPrefixMatch('foo/baz'); // returns { item: 1, index: 3 }
41
- * tree.findLongestPrefixMatch('foo/bar/baz'); // returns { item: 2, index: 7 }
42
- * ```
43
- */
44
- findLongestPrefixMatch(query: string): IPrefixMatch<TItem> | undefined;
45
- /**
46
- * Searches for the item associated with `childPathSegments`, or the nearest ancestor of that path that
47
- * has an associated item.
48
- *
49
- * @returns the found item, or `undefined` if no item was found
50
- *
51
- * @example
52
- * ```ts
53
- * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
54
- * tree.findChildPathFromSegments(['foo', 'baz']); // returns 1
55
- * tree.findChildPathFromSegments(['foo','bar', 'baz']); // returns 2
56
- * ```
57
- */
58
- findChildPathFromSegments(childPathSegments: Iterable<string>): TItem | undefined;
59
- }
60
10
  /**
61
11
  * This class is used to associate POSIX relative paths, such as those returned by `git` commands,
62
12
  * with entities that correspond with ancestor folders, such as Rush Projects.
@@ -74,7 +24,7 @@ export interface IReadonlyLookupByPath<TItem> {
74
24
  * ```
75
25
  * @beta
76
26
  */
77
- export declare class LookupByPath<TItem> implements IReadonlyLookupByPath<TItem> {
27
+ export declare class LookupByPath<TItem> {
78
28
  /**
79
29
  * The delimiter used to split paths
80
30
  */
@@ -115,15 +65,46 @@ export declare class LookupByPath<TItem> implements IReadonlyLookupByPath<TItem>
115
65
  */
116
66
  setItemFromSegments(pathSegments: Iterable<string>, value: TItem): this;
117
67
  /**
118
- * {@inheritdoc IReadonlyLookupByPath}
68
+ * Searches for the item associated with `childPath`, or the nearest ancestor of that path that
69
+ * has an associated item.
70
+ *
71
+ * @returns the found item, or `undefined` if no item was found
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
76
+ * tree.findChildPath('foo/baz'); // returns 1
77
+ * tree.findChildPath('foo/bar/baz'); // returns 2
78
+ * ```
119
79
  */
120
80
  findChildPath(childPath: string): TItem | undefined;
121
81
  /**
122
- * {@inheritdoc IReadonlyLookupByPath}
82
+ * Searches for the item for which the recorded prefix is the longest matching prefix of `query`.
83
+ * Obtains both the item and the length of the matched prefix, so that the remainder of the path can be
84
+ * extracted.
85
+ *
86
+ * @returns the found item and the length of the matched prefix, or `undefined` if no item was found
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
91
+ * tree.findLongestPrefixMatch('foo/baz'); // returns { item: 1, index: 3 }
92
+ * tree.findLongestPrefixMatch('foo/bar/baz'); // returns { item: 2, index: 7 }
93
+ * ```
123
94
  */
124
95
  findLongestPrefixMatch(query: string): IPrefixMatch<TItem> | undefined;
125
96
  /**
126
- * {@inheritdoc IReadonlyLookupByPath}
97
+ * Searches for the item associated with `childPathSegments`, or the nearest ancestor of that path that
98
+ * has an associated item.
99
+ *
100
+ * @returns the found item, or `undefined` if no item was found
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
105
+ * tree.findChildPathFromSegments(['foo', 'baz']); // returns 1
106
+ * tree.findChildPathFromSegments(['foo','bar', 'baz']); // returns 2
107
+ * ```
127
108
  */
128
109
  findChildPathFromSegments(childPathSegments: Iterable<string>): TItem | undefined;
129
110
  /**
@@ -1,7 +1,6 @@
1
1
  import { type ITerminal } from '@rushstack/node-core-library';
2
2
  import type { RushConfiguration } from '../api/RushConfiguration';
3
3
  import type { RushConfigurationProject } from '../api/RushConfigurationProject';
4
- import { type IInputSnapshot } from './snapshots/InputSnapshot';
5
4
  /**
6
5
  * @beta
7
6
  */
@@ -32,28 +31,51 @@ export interface IRawRepoState {
32
31
  * @beta
33
32
  */
34
33
  export declare class ProjectChangeAnalyzer {
34
+ /**
35
+ * UNINITIALIZED === we haven't looked
36
+ * undefined === data isn't available (i.e. - git isn't present)
37
+ */
38
+ private _data;
39
+ private readonly _filteredData;
40
+ private readonly _projectStateCache;
35
41
  private readonly _rushConfiguration;
36
42
  private readonly _git;
37
- private _snapshotPrerequisitesPromise;
38
43
  constructor(rushConfiguration: RushConfiguration);
39
44
  /**
40
- * Gets a list of projects that have changed in the current state of the repo
41
- * when compared to the specified branch, optionally taking the shrinkwrap and settings in
42
- * the rush-project.json file into consideration.
45
+ * Try to get a list of the specified project's dependencies and their hashes.
46
+ *
47
+ * @remarks
48
+ * If the data can't be generated (i.e. - if Git is not present) this returns undefined.
49
+ *
50
+ * @internal
43
51
  */
44
- getChangedProjectsAsync(options: IGetChangedProjectsOptions): Promise<Set<RushConfigurationProject>>;
52
+ _tryGetProjectDependenciesAsync(project: RushConfigurationProject, terminal: ITerminal): Promise<Map<string, string> | undefined>;
45
53
  /**
46
- * Gets a snapshot of the input state of the Rush workspace that can be queried for incremental
47
- * build operations and use by the build cache.
48
54
  * @internal
49
55
  */
50
- _tryGetSnapshotAsync(terminal: ITerminal): Promise<IInputSnapshot | undefined>;
56
+ _ensureInitializedAsync(terminal: ITerminal): Promise<IRawRepoState | undefined>;
51
57
  /**
58
+ * The project state hash is calculated in the following way:
59
+ * - Project dependencies are collected (see ProjectChangeAnalyzer.getPackageDeps)
60
+ * - If project dependencies cannot be collected (i.e. - if Git isn't available),
61
+ * this function returns `undefined`
62
+ * - The (path separator normalized) repo-root-relative dependencies' file paths are sorted
63
+ * - A SHA1 hash is created and each (sorted) file path is fed into the hash and then its
64
+ * Git SHA is fed into the hash
65
+ * - A hex digest of the hash is returned
66
+ *
52
67
  * @internal
53
68
  */
69
+ _tryGetProjectStateHashAsync(project: RushConfigurationProject, terminal: ITerminal): Promise<string | undefined>;
54
70
  _filterProjectDataAsync<T>(project: RushConfigurationProject, unfilteredProjectData: Map<string, T>, rootDir: string, terminal: ITerminal): Promise<Map<string, T>>;
71
+ /**
72
+ * Gets a list of projects that have changed in the current state of the repo
73
+ * when compared to the specified branch, optionally taking the shrinkwrap and settings in
74
+ * the rush-project.json file into consideration.
75
+ */
76
+ getChangedProjectsAsync(options: IGetChangedProjectsOptions): Promise<Set<RushConfigurationProject>>;
77
+ private _getDataAsync;
55
78
  private _getIgnoreMatcherForProjectAsync;
56
- private _computeSnapshotPrerequisites;
57
- private _computeSnapshotPrerequisitesInner;
79
+ private _getRepoDepsAsync;
58
80
  }
59
81
  //# sourceMappingURL=ProjectChangeAnalyzer.d.ts.map
@@ -1,12 +1,15 @@
1
1
  import { type ITerminal } from '@rushstack/node-core-library';
2
2
  import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
3
+ import type { ProjectChangeAnalyzer } from '../ProjectChangeAnalyzer';
3
4
  import type { BuildCacheConfiguration } from '../../api/BuildCacheConfiguration';
4
5
  export interface IProjectBuildCacheOptions {
5
6
  buildCacheConfiguration: BuildCacheConfiguration;
6
7
  project: RushConfigurationProject;
7
8
  projectOutputFolderNames: ReadonlyArray<string>;
8
9
  additionalProjectOutputFilePaths?: ReadonlyArray<string>;
9
- operationStateHash: string;
10
+ additionalContext?: Record<string, string>;
11
+ configHash: string;
12
+ projectChangeAnalyzer: ProjectChangeAnalyzer;
10
13
  terminal: ITerminal;
11
14
  phaseName: string;
12
15
  }
@@ -27,7 +30,7 @@ export declare class ProjectBuildCache {
27
30
  private constructor();
28
31
  private static _tryGetTarUtility;
29
32
  get cacheId(): string | undefined;
30
- static getProjectBuildCache(options: IProjectBuildCacheOptions): Promise<ProjectBuildCache | undefined>;
33
+ static tryGetProjectBuildCache(options: IProjectBuildCacheOptions): Promise<ProjectBuildCache | undefined>;
31
34
  tryRestoreFromCacheAsync(terminal: ITerminal, specifiedCacheId?: string): Promise<boolean>;
32
35
  trySetCacheEntryAsync(terminal: ITerminal, specifiedCacheId?: string): Promise<boolean>;
33
36
  /**
@@ -0,0 +1,3 @@
1
+ import type { IRawRepoState } from '../ProjectChangeAnalyzer';
2
+ export declare function getHashesForGlobsAsync(globPatterns: Iterable<string>, packagePath: string, repoState: IRawRepoState | undefined): Promise<Map<string, string>>;
3
+ //# sourceMappingURL=getHashesForGlobsAsync.d.ts.map
@@ -1 +1 @@
1
- module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/snapshots/InputSnapshot");
1
+ module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/buildCache/getHashesForGlobsAsync");
@@ -1,10 +1,12 @@
1
1
  import { type ITerminal } from '@rushstack/node-core-library';
2
2
  import { CobuildLock } from '../cobuild/CobuildLock';
3
3
  import { ProjectBuildCache } from '../buildCache/ProjectBuildCache';
4
+ import type { IOperationSettings } from '../../api/RushProjectConfiguration';
4
5
  import { ProjectLogWritable } from './ProjectLogWritable';
5
6
  import type { CobuildConfiguration } from '../../api/CobuildConfiguration';
6
7
  import { PeriodicCallback } from './PeriodicCallback';
7
8
  import type { IPhasedCommandPlugin, PhasedCommandHooks } from '../../pluginFramework/PhasedCommandHooks';
9
+ import type { ProjectChangeAnalyzer } from '../ProjectChangeAnalyzer';
8
10
  import type { BuildCacheConfiguration } from '../../api/BuildCacheConfiguration';
9
11
  export interface IProjectDeps {
10
12
  files: {
@@ -15,10 +17,10 @@ export interface IProjectDeps {
15
17
  export interface IOperationBuildCacheContext {
16
18
  isCacheWriteAllowed: boolean;
17
19
  isCacheReadAllowed: boolean;
18
- stateHash: string;
19
- operationBuildCache: ProjectBuildCache | undefined;
20
+ projectChangeAnalyzer: ProjectChangeAnalyzer;
21
+ projectBuildCache: ProjectBuildCache | undefined;
20
22
  cacheDisabledReason: string | undefined;
21
- outputFolderNames: ReadonlyArray<string> | undefined;
23
+ operationSettings: IOperationSettings | undefined;
22
24
  cobuildLock: CobuildLock | undefined;
23
25
  cobuildClusterId: string | undefined;
24
26
  buildCacheTerminal: ITerminal | undefined;
@@ -1,5 +1,6 @@
1
1
  import type { StdioSummarizer } from '@rushstack/terminal';
2
2
  import type { CollatedWriter } from '@rushstack/stream-collator';
3
+ import type { ITerminal, ITerminalProvider } from '@rushstack/node-core-library';
3
4
  import type { OperationStatus } from './OperationStatus';
4
5
  import type { OperationMetadataManager } from './OperationMetadataManager';
5
6
  import type { IStopwatchResult } from '../../utilities/Stopwatch';
@@ -54,6 +55,12 @@ export interface IOperationRunnerContext {
54
55
  * ignore dependent projects.
55
56
  */
56
57
  readonly changedProjectsOnly: boolean;
58
+ /**
59
+ * Invokes the specified callback with a terminal that is associated with this operation.
60
+ *
61
+ * Will write to a log file corresponding to the phase and project, and clean it up upon completion.
62
+ */
63
+ withTerminalAsync<T>(callback: (terminal: ITerminal, terminalProvider: ITerminalProvider) => Promise<T>, createLogFile: boolean, logFileSuffix?: string): Promise<T>;
57
64
  }
58
65
  /**
59
66
  * The `Operation` class is a node in the dependency graph of work that needs to be scheduled by the
@@ -1,5 +1,6 @@
1
1
  import { StdioSummarizer } from '@rushstack/terminal';
2
- import type { CollatedWriter, StreamCollator } from '@rushstack/stream-collator';
2
+ import { type ITerminal, type ITerminalProvider } from '@rushstack/node-core-library';
3
+ import { type CollatedWriter, type StreamCollator } from '@rushstack/stream-collator';
3
4
  import { OperationStatus } from './OperationStatus';
4
5
  import type { IOperationRunner, IOperationRunnerContext } from './IOperationRunner';
5
6
  import type { Operation } from './Operation';
@@ -95,6 +96,10 @@ export declare class OperationExecutionRecord implements IOperationRunnerContext
95
96
  */
96
97
  get status(): OperationStatus;
97
98
  set status(newStatus: OperationStatus);
99
+ /**
100
+ * {@inheritdoc IOperationRunnerContext.withTerminalAsync}
101
+ */
102
+ withTerminalAsync<T>(callback: (terminal: ITerminal, terminalProvider: ITerminalProvider) => Promise<T>, createLogFile: boolean, logFileSuffix?: string): Promise<T>;
98
103
  executeAsync({ onStart, onResult }: {
99
104
  onStart: (record: OperationExecutionRecord) => Promise<OperationStatus | undefined>;
100
105
  onResult: (record: OperationExecutionRecord) => Promise<void>;
@@ -2,7 +2,6 @@ import { TerminalWritable, type ITerminalChunk } from '@rushstack/terminal';
2
2
  import type { CollatedTerminal } from '@rushstack/stream-collator';
3
3
  import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
4
4
  export declare class ProjectLogWritable extends TerminalWritable {
5
- private readonly _project;
6
5
  private readonly _terminal;
7
6
  readonly logPath: string;
8
7
  readonly errorLogPath: string;
@@ -1,18 +1,14 @@
1
- import { OperationStatus } from './OperationStatus';
2
- import type { IOperationRunner, IOperationRunnerContext } from './IOperationRunner';
1
+ import type { IPhase } from '../../api/CommandLineConfiguration';
3
2
  import type { RushConfiguration } from '../../api/RushConfiguration';
4
3
  import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
5
- import type { IPhase } from '../../api/CommandLineConfiguration';
4
+ import type { IOperationRunner, IOperationRunnerContext } from './IOperationRunner';
5
+ import { OperationStatus } from './OperationStatus';
6
6
  export interface IOperationRunnerOptions {
7
7
  rushProject: RushConfigurationProject;
8
8
  rushConfiguration: RushConfiguration;
9
9
  commandToRun: string;
10
10
  displayName: string;
11
11
  phase: IPhase;
12
- /**
13
- * The set of phases being executed in the current command, for validation of rush-project.json
14
- */
15
- selectedPhases: Iterable<IPhase>;
16
12
  }
17
13
  /**
18
14
  * An `IOperationRunner` subclass that performs an operation via a shell command.
@@ -26,7 +22,6 @@ export declare class ShellOperationRunner implements IOperationRunner {
26
22
  readonly cacheable: boolean;
27
23
  readonly warningsAreAllowed: boolean;
28
24
  private readonly _commandToRun;
29
- private readonly _logFilenameIdentifier;
30
25
  private readonly _rushProject;
31
26
  private readonly _rushConfiguration;
32
27
  constructor(options: IOperationRunnerOptions);
@@ -5,13 +5,13 @@ import type { IPhase } from '../api/CommandLineConfiguration';
5
5
  import type { RushConfiguration } from '../api/RushConfiguration';
6
6
  import type { RushConfigurationProject } from '../api/RushConfigurationProject';
7
7
  import type { Operation } from '../logic/operations/Operation';
8
+ import type { ProjectChangeAnalyzer } from '../logic/ProjectChangeAnalyzer';
8
9
  import type { IExecutionResult, IOperationExecutionResult } from '../logic/operations/IOperationExecutionResult';
9
10
  import type { CobuildConfiguration } from '../api/CobuildConfiguration';
10
11
  import type { RushProjectConfiguration } from '../api/RushProjectConfiguration';
11
12
  import type { IOperationRunnerContext } from '../logic/operations/IOperationRunner';
12
13
  import type { ITelemetryData } from '../logic/Telemetry';
13
14
  import type { OperationStatus } from '../logic/operations/OperationStatus';
14
- import type { IInputSnapshot } from '../logic/snapshots/InputSnapshot';
15
15
  /**
16
16
  * A plugin that interacts with a phased commands.
17
17
  * @alpha
@@ -40,10 +40,6 @@ export interface ICreateOperationsContext {
40
40
  * Maps from the `longName` field in command-line.json to the parser configuration in ts-command-line.
41
41
  */
42
42
  readonly customParameters: ReadonlyMap<string, CommandLineParameter>;
43
- /**
44
- * The current state of the repository, if available
45
- */
46
- readonly inputSnapshot?: IInputSnapshot;
47
43
  /**
48
44
  * If true, projects may read their output from cache or be skipped if already up to date.
49
45
  * If false, neither of the above may occur, e.g. "rush rebuild"
@@ -66,6 +62,10 @@ export interface ICreateOperationsContext {
66
62
  * The set of phases selected for the current command execution.
67
63
  */
68
64
  readonly phaseSelection: ReadonlySet<IPhase>;
65
+ /**
66
+ * The current state of the repository
67
+ */
68
+ readonly projectChangeAnalyzer: ProjectChangeAnalyzer;
69
69
  /**
70
70
  * The set of Rush projects selected for the current command execution.
71
71
  */
@@ -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
  /**
@@ -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;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;AApBD,0DAoBC;AAED,SAAgB,QAAQ,CAAU,UAAkB;IAClD,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;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"]}
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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,oEAQsC;AAEtC,uCAQmB;AAEnB,MAAM,cAAc,GAAY,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,GAAG,CAAC;AACrG,MAAM,QAAQ,GAAa,IAAI,4BAAQ,CACrC,IAAI,2CAAuB,CAAC;IAC1B,cAAc;CACf,CAAC,CACH,CAAC;AAQF,IAAI,YAAY,GAAW,EAAE,CAAC;AAE9B,qGAAqG;AACrG,gGAAgG;AAChG,IAAI,oBAAU,CAAC,aAAa,KAAK,SAAS,EAAE;IAC1C,oBAAU,CAAC,aAAa;QACtB,MAAM,CAAC,uBAAuB;YAC9B,MAAM,CAAC,sCAAsC;YAC7C,MAAM,CAAC,4CAA4C,CAAC;CACvD;AAED,6FAA6F;AAC7F,+FAA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YAC/E,QAAQ,CAAC,gBAAgB,CAAC,UAAU,uBAAa,gCAAgC,CAAC,CAAC;SACpF;KACF;IAAC,OAAO,CAAC,EAAE;QACV,WAAW;QACX,YAAY,GAAI,CAAW,CAAC,OAAO,CAAC;KACrC;CACF;AAED,IAAI,oBAAU,CAAC,aAAa,KAAK,SAAS,EAAE;IAC1C,qGAAqG;IACrG,wGAAwG;IACxG,2CAA2C;IAC3C,sCAAsC;IACtC,OAAO,CAAC,KAAK,CAAC;EACd,YAAY;CACb,CAAC,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACjB;AAED,uCAAuC;AACvC,KAAK,MAAM,QAAQ,IAAI,oBAAU,CAAC,aAAa,EAAE;IAC/C,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;QAC/D,MAAM,uBAAuB,GAAsB,oBAAU,CAAC,aAAa,CAAC;QAE5E,0CAA0C;QAC1C,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE;YACvC,UAAU,EAAE,IAAI;YAChB,GAAG,EAAE;gBACH,OAAO,uBAAuB,CAAC,QAAQ,CAAC,CAAC;YAC3C,CAAC;SACF,CAAC,CAAC;KACJ;CACF;AAED;;GAEG;AACH,SAAgB,2BAA2B,CAAC,aAAqB;IAC/D,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE;QAC3B,MAAM,IAAI,KAAK,CACb,gBAAgB,OAAO,CAAC,IAAI,CAAC,OAAO,qDAAqD,CAC1F,CAAC;KACH;IACD,OAAO,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAC1D,CAAC;AAPD,kEAOC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'path';\nimport {\n JsonFile,\n type JsonObject,\n type IPackageJson,\n PackageJsonLookup,\n Executable,\n Terminal,\n ConsoleTerminalProvider\n} from '@rushstack/node-core-library';\nimport type { SpawnSyncReturns } from 'child_process';\nimport {\n RUSH_LIB_NAME,\n RUSH_LIB_PATH_ENV_VAR_NAME,\n type RushLibModuleType,\n _require,\n requireRushLibUnderFolderPath,\n tryFindRushJsonLocation,\n sdkContext\n} from './helpers';\n\nconst verboseEnabled: boolean = typeof process !== 'undefined' && process.env.RUSH_SDK_DEBUG === '1';\nconst terminal: Terminal = new Terminal(\n new ConsoleTerminalProvider({\n verboseEnabled\n })\n);\n\ndeclare const global: typeof globalThis & {\n ___rush___rushLibModule?: RushLibModuleType;\n ___rush___rushLibModuleFromEnvironment?: RushLibModuleType;\n ___rush___rushLibModuleFromInstallAndRunRush?: RushLibModuleType;\n};\n\nlet errorMessage: string = '';\n\n// SCENARIO 1: Rush's PluginManager has initialized \"rush-sdk\" with Rush's own instance of rush-lib.\n// The Rush host process will assign \"global.___rush___rushLibModule\" before loading the plugin.\nif (sdkContext.rushLibModule === undefined) {\n sdkContext.rushLibModule =\n global.___rush___rushLibModule ||\n global.___rush___rushLibModuleFromEnvironment ||\n global.___rush___rushLibModuleFromInstallAndRunRush;\n}\n\n// SCENARIO 2: The project importing \"rush-sdk\" has installed its own instance of \"rush-lib\"\n// as a package.json dependency. For example, this is used by the Jest tests for Rush plugins.\nif (sdkContext.rushLibModule === undefined) {\n const importingPath: string | null | undefined = module?.parent?.filename;\n if (importingPath) {\n const callerPackageFolder: string | undefined =\n PackageJsonLookup.instance.tryGetPackageFolderFor(importingPath);\n\n if (callerPackageFolder !== undefined) {\n const callerPackageJson: IPackageJson = _require(path.join(callerPackageFolder, 'package.json'));\n\n // Does the caller properly declare a dependency on rush-lib?\n if (\n (callerPackageJson.dependencies && callerPackageJson.dependencies[RUSH_LIB_NAME] !== undefined) ||\n (callerPackageJson.devDependencies &&\n callerPackageJson.devDependencies[RUSH_LIB_NAME] !== undefined) ||\n (callerPackageJson.peerDependencies &&\n callerPackageJson.peerDependencies[RUSH_LIB_NAME] !== undefined)\n ) {\n // Try to resolve rush-lib from the caller's folder\n terminal.writeVerboseLine(`Try to load ${RUSH_LIB_NAME} from caller package`);\n try {\n sdkContext.rushLibModule = requireRushLibUnderFolderPath(callerPackageFolder);\n } catch (error) {\n // If we fail to resolve it, ignore the error\n terminal.writeVerboseLine(`Failed to load ${RUSH_LIB_NAME} from caller package`);\n }\n\n // If two different libraries invoke `rush-sdk`, and one of them provides \"rush-lib\"\n // then the first version to be loaded wins. We do not support side-by-side instances of \"rush-lib\".\n if (sdkContext.rushLibModule !== undefined) {\n // to track which scenario is active and how it got initialized.\n global.___rush___rushLibModule = sdkContext.rushLibModule;\n terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} from caller`);\n }\n }\n }\n }\n}\n\n// SCENARIO 3: A tool or script has been invoked as a child process by an instance of \"rush-lib\" and can use the\n// version that invoked it. In this case, use process.env._RUSH_LIB_PATH to find \"rush-lib\".\nif (sdkContext.rushLibModule === undefined) {\n const rushLibPath: string | undefined = process.env[RUSH_LIB_PATH_ENV_VAR_NAME];\n if (rushLibPath) {\n terminal.writeVerboseLine(\n `Try to load ${RUSH_LIB_NAME} from process.env.${RUSH_LIB_PATH_ENV_VAR_NAME} from caller package`\n );\n try {\n sdkContext.rushLibModule = _require(rushLibPath);\n } catch (error) {\n // Log this as a warning, since it is unexpected to define an incorrect value of the variable.\n terminal.writeWarningLine(\n `Failed to load ${RUSH_LIB_NAME} via process.env.${RUSH_LIB_PATH_ENV_VAR_NAME}`\n );\n }\n\n if (sdkContext.rushLibModule !== undefined) {\n // to track which scenario is active and how it got initialized.\n global.___rush___rushLibModuleFromEnvironment = sdkContext.rushLibModule;\n terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} from process.env.${RUSH_LIB_PATH_ENV_VAR_NAME}`);\n }\n }\n}\n\n// SCENARIO 4: A standalone tool or script depends on \"rush-sdk\", and is meant to be used inside a monorepo folder.\n// In this case, we can use install-run-rush.js to obtain the appropriate rush-lib version for the monorepo.\nif (sdkContext.rushLibModule === undefined) {\n try {\n const rushJsonPath: string | undefined = tryFindRushJsonLocation(process.cwd());\n if (!rushJsonPath) {\n throw new Error(\n 'Unable to find rush.json in the current folder or its parent folders.\\n' +\n 'This tool is meant to be invoked from a working directory inside a Rush repository.'\n );\n }\n const monorepoRoot: string = path.dirname(rushJsonPath);\n\n const rushJson: JsonObject = JsonFile.load(rushJsonPath);\n const { rushVersion } = rushJson;\n\n const installRunNodeModuleFolder: string = path.join(\n monorepoRoot,\n `common/temp/install-run/@microsoft+rush@${rushVersion}`\n );\n\n try {\n // First, try to load the version of \"rush-lib\" that was installed by install-run-rush.js\n terminal.writeVerboseLine(`Trying to load ${RUSH_LIB_NAME} installed by install-run-rush`);\n sdkContext.rushLibModule = requireRushLibUnderFolderPath(installRunNodeModuleFolder);\n } catch (e1) {\n let installAndRunRushStderrContent: string = '';\n try {\n const installAndRunRushJSPath: string = path.join(monorepoRoot, 'common/scripts/install-run-rush.js');\n\n terminal.writeLine('The Rush engine has not been installed yet. Invoking install-run-rush.js...');\n\n const installAndRunRushProcess: SpawnSyncReturns<string> = Executable.spawnSync(\n 'node',\n [installAndRunRushJSPath, '--help'],\n {\n stdio: 'pipe'\n }\n );\n\n installAndRunRushStderrContent = installAndRunRushProcess.stderr;\n if (installAndRunRushProcess.status !== 0) {\n throw new Error(`The ${RUSH_LIB_NAME} package failed to install`);\n }\n\n // Retry to load \"rush-lib\" after install-run-rush run\n terminal.writeVerboseLine(\n `Trying to load ${RUSH_LIB_NAME} installed by install-run-rush a second time`\n );\n sdkContext.rushLibModule = requireRushLibUnderFolderPath(installRunNodeModuleFolder);\n } catch (e2) {\n // eslint-disable-next-line no-console\n console.error(`${installAndRunRushStderrContent}`);\n throw new Error(`The ${RUSH_LIB_NAME} package failed to load`);\n }\n }\n\n if (sdkContext.rushLibModule !== undefined) {\n // to track which scenario is active and how it got initialized.\n global.___rush___rushLibModuleFromInstallAndRunRush = sdkContext.rushLibModule;\n terminal.writeVerboseLine(`Loaded ${RUSH_LIB_NAME} installed by install-run-rush`);\n }\n } catch (e) {\n // no-catch\n errorMessage = (e as Error).message;\n }\n}\n\nif (sdkContext.rushLibModule === undefined) {\n // This error indicates that a project is trying to import \"@rushstack/rush-sdk\", but the Rush engine\n // instance cannot be found. If you are writing Jest tests for a Rush plugin, add \"@microsoft/rush-lib\"\n // to the devDependencies for your project.\n // eslint-disable-next-line no-console\n console.error(`Error: The @rushstack/rush-sdk package was not able to load the Rush engine:\n${errorMessage}\n`);\n process.exit(1);\n}\n\n// Based on TypeScript's __exportStar()\nfor (const property in sdkContext.rushLibModule) {\n if (property !== 'default' && !exports.hasOwnProperty(property)) {\n const rushLibModuleForClosure: RushLibModuleType = sdkContext.rushLibModule;\n\n // Based on TypeScript's __createBinding()\n Object.defineProperty(exports, property, {\n enumerable: true,\n get: function () {\n return rushLibModuleForClosure[property];\n }\n });\n }\n}\n\n/**\n * Used by the .js stubs for path-based imports of `@microsoft/rush-lib` internal APIs.\n */\nexport function _rushSdk_loadInternalModule(srcImportPath: string): unknown {\n if (!exports._RushInternals) {\n throw new Error(\n `Rush version ${exports.Rush.version} does not support internal API imports via rush-sdk`\n );\n }\n return exports._RushInternals.loadModule(srcImportPath);\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,oEAQsC;AAEtC,uCAQmB;AAEnB,MAAM,cAAc,GAAY,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,GAAG,CAAC;AACrG,MAAM,QAAQ,GAAa,IAAI,4BAAQ,CACrC,IAAI,2CAAuB,CAAC;IAC1B,cAAc;CACf,CAAC,CACH,CAAC;AAQF,IAAI,YAAY,GAAW,EAAE,CAAC;AAE9B,qGAAqG;AACrG,gGAAgG;AAChG,IAAI,oBAA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,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"]}
@@ -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,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;YACZ,OAAO,GAAG,EAAE,CAAC;SACd;QAED,IAAI,aAAa,CAAC,QAAQ,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,kFAAkF,CAAC,CAAC;SACrG;QAED,MAAM,aAAa,GAAuC,OAAO,CAAC,aAAa,CAAC;QAChF,IAAI,eAAe,GAAuB,SAAS,CAAC;QAEpD,MAAM,WAAW,GAA4B,OAAO,CAAC,WAAW,CAAC;QAEjE,IAAI;YACF,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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,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,gCAAgC;yBAC9D;wBACD,eAAe;qBAChB,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,aAAa,EAAE,CAAC;gBAClB,aAAa,CAAC;oBACZ,UAAU,EAAE;wBACV,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,wBAAwB,GAAG,CAAC,MAAA,CAAC,CAAC,OAAO,mCAAI,2BAA2B,CAAC;qBAC5E;oBACD,eAAe;iBAChB,CAAC,CAAC;YACL,CAAC;YACD,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;CACF;AA7LD,sCA6LC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'path';\nimport type { SpawnSyncReturns } from 'child_process';\nimport { JsonFile, type JsonObject, Executable } from '@rushstack/node-core-library';\n\nimport {\n tryFindRushJsonLocation,\n RUSH_LIB_NAME,\n type RushLibModuleType,\n requireRushLibUnderFolderPath,\n sdkContext\n} from './helpers';\n\ndeclare const global: typeof globalThis & {\n ___rush___rushLibModule?: RushLibModuleType;\n ___rush___rushLibModuleFromEnvironment?: RushLibModuleType;\n ___rush___rushLibModuleFromInstallAndRunRush?: RushLibModuleType;\n};\n\n/**\n * Type of {@link ISdkCallbackEvent.logMessage}\n * @public\n */\nexport interface IProgressBarCallbackLogMessage {\n /**\n * A status message to print in the log window, or `undefined` if there are\n * no further messages. This string may contain newlines.\n */\n text: string;\n\n /**\n * The type of message. More message types may be added in the future.\n */\n kind: 'info' | 'debug';\n}\n\n/**\n * Event options for {@link ILoadSdkAsyncOptions.onNotifyEvent}\n * @public\n */\nexport interface ISdkCallbackEvent {\n /**\n * Allows the caller to display log information about the operation.\n */\n logMessage: IProgressBarCallbackLogMessage | undefined;\n\n /**\n * Allows the caller to display a progress bar for long-running operations.\n *\n * @remarks\n * If a long-running operation is required, then `progressPercent` will\n * start at 0.0 and count upwards and finish at 100.0 if the operation completes\n * successfully. If the long-running operation has not yet started, or\n * is not required, then the value will be `undefined`.\n */\n progressPercent: number | undefined;\n}\n\n/**\n * Type of {@link ILoadSdkAsyncOptions.onNotifyEvent}\n * @public\n */\nexport type SdkNotifyEventCallback = (sdkEvent: ISdkCallbackEvent) => void;\n\n/**\n * Options for {@link RushSdkLoader.loadAsync}\n * @public\n */\nexport interface ILoadSdkAsyncOptions {\n /**\n * The folder to start from when searching for the Rush workspace configuration.\n * If this folder does not contain a `rush.json` file, then each parent folder\n * will be searched. If `rush.json` is not found, then the SDK fails to load.\n */\n rushJsonSearchFolder?: string;\n\n /**\n * A cancellation token that the caller can use to prematurely abort the operation.\n */\n abortSignal?: AbortSignal;\n\n /**\n * Allows the caller to monitor the progress of the operation.\n */\n onNotifyEvent?: SdkNotifyEventCallback;\n}\n\n/**\n * Exposes operations that control how the `@microsoft/rush-lib` engine is\n * located and loaded.\n * @public\n */\nexport class RushSdkLoader {\n /**\n * Throws an \"AbortError\" exception if abortSignal.aborted is true.\n */\n private static _checkForCancel(\n abortSignal: AbortSignal,\n onNotifyEvent: SdkNotifyEventCallback | undefined,\n progressPercent: number | undefined\n ): void {\n if (!abortSignal?.aborted) {\n return;\n }\n\n if (onNotifyEvent) {\n onNotifyEvent({\n logMessage: {\n kind: 'info',\n text: `The operation was canceled`\n },\n progressPercent\n });\n }\n\n const error: Error = new Error('The operation was canceled');\n error.name = 'AbortError';\n throw error;\n }\n\n /**\n * Returns true if the Rush engine has already been loaded.\n */\n public static get isLoaded(): boolean {\n return sdkContext.rushLibModule !== undefined;\n }\n\n /**\n * Manually load the Rush engine based on rush.json found for `rushJsonSearchFolder`.\n * Throws an exception if {@link RushSdkLoader.isLoaded} is already `true`.\n *\n * @remarks\n * This API supports an callback that can be used display a progress bar,\n * log of operations, and allow the operation to be canceled prematurely.\n */\n public static async loadAsync(options?: ILoadSdkAsyncOptions): Promise<void> {\n // SCENARIO 5: The rush-lib engine is loaded manually using rushSdkLoader.loadAsync().\n\n if (!options) {\n options = {};\n }\n\n if (RushSdkLoader.isLoaded) {\n throw new Error('RushSdkLoader.loadAsync() failed because the Rush engine has already been loaded');\n }\n\n const onNotifyEvent: SdkNotifyEventCallback | undefined = options.onNotifyEvent;\n let progressPercent: number | undefined = undefined;\n\n const abortSignal: AbortSignal | undefined = options.abortSignal;\n\n try {\n const rushJsonSearchFolder: string = options.rushJsonSearchFolder ?? process.cwd();\n\n if (onNotifyEvent) {\n onNotifyEvent({\n logMessage: {\n kind: 'debug',\n text: `Searching for rush.json starting from: ` + rushJsonSearchFolder\n },\n progressPercent\n });\n }\n\n const rushJsonPath: string | undefined = tryFindRushJsonLocation(rushJsonSearchFolder);\n if (!rushJsonPath) {\n throw new Error(\n 'Unable to find rush.json in the specified folder or its parent folders:\\n' +\n `${rushJsonSearchFolder}\\n`\n );\n }\n const monorepoRoot: string = path.dirname(rushJsonPath);\n\n const rushJson: JsonObject = await JsonFile.loadAsync(rushJsonPath);\n const { rushVersion } = rushJson;\n\n const installRunNodeModuleFolder: string = path.join(\n monorepoRoot,\n `common/temp/install-run/@microsoft+rush@${rushVersion}`\n );\n\n try {\n // First, try to load the version of \"rush-lib\" that was installed by install-run-rush.js\n if (onNotifyEvent) {\n onNotifyEvent({\n logMessage: {\n kind: 'info',\n text: `Trying to load ${RUSH_LIB_NAME} installed by install-run-rush`\n },\n progressPercent\n });\n }\n sdkContext.rushLibModule = requireRushLibUnderFolderPath(installRunNodeModuleFolder);\n } catch (e1) {\n let installAndRunRushStderrContent: string = '';\n try {\n const installAndRunRushJSPath: string = path.join(\n monorepoRoot,\n 'common/scripts/install-run-rush.js'\n );\n\n if (onNotifyEvent) {\n onNotifyEvent({\n logMessage: {\n kind: 'info',\n text: 'The Rush engine has not been installed yet. Invoking install-run-rush.js...'\n },\n progressPercent\n });\n }\n\n // Start the installation\n progressPercent = 0;\n\n const installAndRunRushProcess: SpawnSyncReturns<string> = Executable.spawnSync(\n 'node',\n [installAndRunRushJSPath, '--help'],\n {\n stdio: 'pipe'\n }\n );\n\n installAndRunRushStderrContent = installAndRunRushProcess.stderr;\n if (installAndRunRushProcess.status !== 0) {\n throw new Error(`The ${RUSH_LIB_NAME} package failed to install`);\n }\n\n if (abortSignal) {\n RushSdkLoader._checkForCancel(abortSignal, onNotifyEvent, progressPercent);\n }\n\n // TODO: Implement incremental progress updates\n progressPercent = 90;\n\n // Retry to load \"rush-lib\" after install-run-rush run\n if (onNotifyEvent) {\n onNotifyEvent({\n logMessage: {\n kind: 'debug',\n text: `Trying to load ${RUSH_LIB_NAME} installed by install-run-rush a second time`\n },\n progressPercent\n });\n }\n\n sdkContext.rushLibModule = requireRushLibUnderFolderPath(installRunNodeModuleFolder);\n\n progressPercent = 100;\n } catch (e2) {\n // eslint-disable-next-line no-console\n console.error(`${installAndRunRushStderrContent}`);\n throw new Error(`The ${RUSH_LIB_NAME} package failed to load`);\n }\n }\n\n if (sdkContext.rushLibModule !== undefined) {\n // to track which scenario is active and how it got initialized.\n global.___rush___rushLibModuleFromInstallAndRunRush = sdkContext.rushLibModule;\n if (onNotifyEvent) {\n onNotifyEvent({\n logMessage: {\n kind: 'debug',\n text: `Loaded ${RUSH_LIB_NAME} installed by install-run-rush`\n },\n progressPercent\n });\n }\n }\n } catch (e) {\n if (onNotifyEvent) {\n onNotifyEvent({\n logMessage: {\n kind: 'info',\n text: 'The operation failed: ' + (e.message ?? 'An unknown error occurred')\n },\n progressPercent\n });\n }\n throw e;\n }\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/rush-sdk",
3
- "version": "5.112.2-pr4476.0",
3
+ "version": "5.112.2-pr4485.0",
4
4
  "description": "An API for interacting with the Rush engine",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,12 +30,12 @@
30
30
  "devDependencies": {
31
31
  "@types/semver": "7.5.0",
32
32
  "@types/webpack-env": "1.18.0",
33
- "@rushstack/heft": "0.63.6",
34
- "@rushstack/terminal": "0.7.16",
35
- "@rushstack/stream-collator": "4.1.17",
33
+ "@microsoft/rush-lib": "5.112.2-pr4485.0",
34
+ "@rushstack/heft": "0.64.0",
35
+ "@rushstack/ts-command-line": "4.17.1",
36
36
  "local-node-rig": "1.0.0",
37
- "@microsoft/rush-lib": "5.112.2-pr4476.0",
38
- "@rushstack/ts-command-line": "4.17.1"
37
+ "@rushstack/stream-collator": "4.1.18",
38
+ "@rushstack/terminal": "0.7.17"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "heft build --clean",
@@ -1,130 +0,0 @@
1
- import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
2
- import type { RushProjectConfiguration } from '../../api/RushProjectConfiguration';
3
- import { type IReadonlyLookupByPath } from '../LookupByPath';
4
- /**
5
- * @beta
6
- */
7
- export type IRushConfigurationProjectForSnapshot = Pick<RushConfigurationProject, 'projectFolder' | 'projectRelativeFolder'>;
8
- /**
9
- * @internal
10
- */
11
- export interface IRushSnapshotProjectMetadata {
12
- /**
13
- * The contents of rush-project.json for the project, if available
14
- */
15
- projectConfig?: RushProjectConfiguration;
16
- /**
17
- * A map of operation name to additional files that should be included in the hash for that operation.
18
- */
19
- additionalFilesByOperationName?: ReadonlyMap<string, ReadonlySet<string>>;
20
- }
21
- export type IRushSnapshotProjectMetadataMap = ReadonlyMap<IRushConfigurationProjectForSnapshot, IRushSnapshotProjectMetadata>;
22
- /**
23
- * The parameters for constructing an {@link InputSnapshot}.
24
- * @internal
25
- */
26
- export interface IRushSnapshotParameters {
27
- /**
28
- * Hashes for files selected by `dependsOnAdditionalFiles`.
29
- * Separated out to prevent being auto-assigned to a project.
30
- */
31
- additionalHashes?: ReadonlyMap<string, string>;
32
- /**
33
- * The environment to use for `dependsOnEnvVars`. By default performs a snapshot of process.env upon construction.
34
- * @defaultValue \{ ...process.env \}
35
- */
36
- environment?: Record<string, string | undefined>;
37
- /**
38
- * File paths (keys into additionalHashes or hashes) to be included as part of every operation's dependencies.
39
- */
40
- globalAdditionalFiles?: Iterable<string>;
41
- /**
42
- * The hashes of all tracked files in the repository.
43
- */
44
- hashes: ReadonlyMap<string, string>;
45
- /**
46
- * Optimized lookup engine used to route `hashes` to individual projects.
47
- */
48
- lookupByPath: IReadonlyLookupByPath<IRushConfigurationProjectForSnapshot>;
49
- /**
50
- * Metadata for each project.
51
- */
52
- projectMap: IRushSnapshotProjectMetadataMap;
53
- /**
54
- * The directory that all relative paths are relative to.
55
- */
56
- rootDir: string;
57
- }
58
- /**
59
- * Represents a synchronously-queryable in-memory snapshot of the state of the inputs to a Rush repository.
60
- *
61
- * The methods on this interface are idempotent and will return the same result regardless of when they are executed.
62
- * @beta
63
- */
64
- export interface IInputSnapshot {
65
- /**
66
- * Gets the map of file paths to Git hashes that will be used to compute the local state hash of the operation.
67
- * Exposed separately from the final state hash to facilitate detailed change detection.
68
- *
69
- * @param project - The Rush project to get hashes for
70
- * @param operationName - The name of the operation (phase) to get hashes for. If omitted, returns a default set for the project, as used for bulk commands.
71
- * @returns A map of file name to Git hash. For local files paths will be relative. Configured additional files may be absolute paths.
72
- */
73
- getTrackedFileHashesForOperation(project: IRushConfigurationProjectForSnapshot, operationName?: string): ReadonlyMap<string, string>;
74
- /**
75
- * Gets the local state hash for the operation. This will later be combined with the hash of the command being executed and the final hashes of the operation's dependencies to compute
76
- * the final hash for the operation.
77
- * @param project - The Rush project to compute the state hash for
78
- * @param operationName - The name of the operation (phase) to get hashes for. If omitted, returns a generic hash for the whole project, as used for bulk commands.
79
- * @returns The local state hash for the project. This is a hash of the environment, the project's tracked files, and any additional files.
80
- */
81
- getLocalStateHashForOperation(project: IRushConfigurationProjectForSnapshot, operationName?: string): string;
82
- }
83
- /**
84
- * Represents a synchronously-queryable in-memory snapshot of the state of the inputs to a Rush repository.
85
- * Any asynchronous work needs to be performed by the caller and the results passed to the constructor.
86
- *
87
- * @remarks
88
- * All operations on this class will return the same result regardless of when they are executed.
89
- *
90
- * @internal
91
- */
92
- export declare class InputSnapshot implements IInputSnapshot {
93
- /**
94
- * The metadata for each project. This is a superset of the information in `projectMap` and includes caching of queries.
95
- */
96
- private readonly _projectMetadataMap;
97
- /**
98
- * Hashes of files to be included in all result sets.
99
- */
100
- private readonly _globalAdditionalHashes;
101
- /**
102
- * Hashes for files selected by `dependsOnAdditionalFiles`.
103
- */
104
- private readonly _additionalHashes;
105
- /**
106
- * The environment to use for `dependsOnEnvVars`.
107
- */
108
- private readonly _environment;
109
- /**
110
- * The hashes of all tracked files in the repository.
111
- */
112
- private readonly _hashes;
113
- /**
114
- *
115
- * @param params - The parameters for the snapshot
116
- * @internal
117
- */
118
- constructor(params: IRushSnapshotParameters);
119
- /**
120
- * {@inheritdoc}
121
- */
122
- getTrackedFileHashesForOperation(project: IRushConfigurationProjectForSnapshot, operationName?: string): ReadonlyMap<string, string>;
123
- /**
124
- * {@inheritdoc}
125
- */
126
- getLocalStateHashForOperation(project: IRushConfigurationProjectForSnapshot, operationName?: string): string;
127
- private _resolveHashes;
128
- private _getOrCreateProjectFilter;
129
- }
130
- //# sourceMappingURL=InputSnapshot.d.ts.map