@rushstack/rush-sdk 5.93.2 → 5.94.1

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.
@@ -1373,6 +1373,16 @@ declare interface IPnpmPeerDependencyRules {
1373
1373
  allowedVersions?: Record<string, string>;
1374
1374
  }
1375
1375
 
1376
+ /**
1377
+ * Object containing both the matched item and the start index of the remainder of the query.
1378
+ *
1379
+ * @beta
1380
+ */
1381
+ export declare interface IPrefixMatch<TItem> {
1382
+ value: TItem;
1383
+ index: number;
1384
+ }
1385
+
1376
1386
  /**
1377
1387
  * @internal
1378
1388
  */
@@ -1835,11 +1845,11 @@ export declare class LockStepVersionPolicy extends VersionPolicy {
1835
1845
  * @example
1836
1846
  * ```ts
1837
1847
  * const tree = new LookupByPath([['foo', 1], ['bar', 2], ['foo/bar', 3]]);
1838
- * tree.getNearestAncestor('foo'); // returns 1
1839
- * tree.getNearestAncestor('foo/baz'); // returns 1
1840
- * tree.getNearestAncestor('baz'); // returns undefined
1841
- * tree.getNearestAncestor('foo/bar/baz'); returns 3
1842
- * tree.getNearestAncestor('bar/foo/bar'); returns 2
1848
+ * tree.findChildPath('foo'); // returns 1
1849
+ * tree.findChildPath('foo/baz'); // returns 1
1850
+ * tree.findChildPath('baz'); // returns undefined
1851
+ * tree.findChildPath('foo/bar/baz'); returns 3
1852
+ * tree.findChildPath('bar/foo/bar'); returns 2
1843
1853
  * ```
1844
1854
  * @beta
1845
1855
  */
@@ -1868,6 +1878,7 @@ export declare class LookupByPath<TItem> {
1868
1878
  * `LookupByPath.iteratePathSegments('foo\\bar\\baz', '\\')` yields 'foo', 'bar', 'baz'
1869
1879
  */
1870
1880
  static iteratePathSegments(serializedPath: string, delimiter?: string): Iterable<string>;
1881
+ private static _iteratePrefixes;
1871
1882
  /**
1872
1883
  * Associates the value with the specified serialized path.
1873
1884
  * If a value is already associated, will overwrite.
@@ -1896,6 +1907,21 @@ export declare class LookupByPath<TItem> {
1896
1907
  * ```
1897
1908
  */
1898
1909
  findChildPath(childPath: string): TItem | undefined;
1910
+ /**
1911
+ * Searches for the item for which the recorded prefix is the longest matching prefix of `query`.
1912
+ * Obtains both the item and the length of the matched prefix, so that the remainder of the path can be
1913
+ * extracted.
1914
+ *
1915
+ * @returns the found item and the length of the matched prefix, or `undefined` if no item was found
1916
+ *
1917
+ * @example
1918
+ * ```ts
1919
+ * const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
1920
+ * tree.findLongestPrefixMatch('foo/baz'); // returns { item: 1, index: 3 }
1921
+ * tree.findLongestPrefixMatch('foo/bar/baz'); // returns { item: 2, index: 7 }
1922
+ * ```
1923
+ */
1924
+ findLongestPrefixMatch(query: string): IPrefixMatch<TItem> | undefined;
1899
1925
  /**
1900
1926
  * Searches for the item associated with `childPathSegments`, or the nearest ancestor of that path that
1901
1927
  * has an associated item.
@@ -1910,6 +1936,15 @@ export declare class LookupByPath<TItem> {
1910
1936
  * ```
1911
1937
  */
1912
1938
  findChildPathFromSegments(childPathSegments: Iterable<string>): TItem | undefined;
1939
+ /**
1940
+ * Iterates through progressively longer prefixes of a given string and returns as soon
1941
+ * as the number of candidate items that match the prefix are 1 or 0.
1942
+ *
1943
+ * If a match is present, returns the matched itme and the length of the matched prefix.
1944
+ *
1945
+ * @returns the found item, or `undefined` if no item was found
1946
+ */
1947
+ private _findLongestPrefixMatch;
1913
1948
  }
1914
1949
 
1915
1950
  /**
@@ -2205,6 +2240,16 @@ export declare class PhasedCommandHooks {
2205
2240
  * Use the context to distinguish between the initial run and phased runs.
2206
2241
  */
2207
2242
  readonly createOperations: AsyncSeriesWaterfallHook<[Set<Operation>, ICreateOperationsContext]>;
2243
+ /**
2244
+ * Hook invoked before operation start
2245
+ * Hook is series for stable output.
2246
+ */
2247
+ readonly beforeExecuteOperations: AsyncSeriesHook<[Map<Operation, IOperationExecutionResult>]>;
2248
+ /**
2249
+ * Hook invoked when operation status changed
2250
+ * Hook is series for stable output.
2251
+ */
2252
+ readonly onOperationStatusChanged: SyncHook<[IOperationExecutionResult]>;
2208
2253
  /**
2209
2254
  * Hook invoked after executing a set of operations.
2210
2255
  * Use the context to distinguish between the initial run and phased runs.
package/lib/index.d.ts CHANGED
@@ -22,7 +22,7 @@ export { ApprovedPackagesItem, ApprovedPackagesConfiguration } from './api/Appro
22
22
  export { CommonVersionsConfiguration } from './api/CommonVersionsConfiguration';
23
23
  export { PackageJsonEditor, PackageJsonDependency, DependencyType } from './api/PackageJsonEditor';
24
24
  export { RepoStateFile } from './logic/RepoStateFile';
25
- export { LookupByPath } from './logic/LookupByPath';
25
+ export { LookupByPath, IPrefixMatch } from './logic/LookupByPath';
26
26
  export { EventHooks, Event } from './api/EventHooks';
27
27
  export { ChangeManager } from './api/ChangeManager';
28
28
  export { LastInstallFlag as _LastInstallFlag, ILockfileValidityCheckOptions as _ILockfileValidityCheckOptions } from './api/LastInstallFlag';
@@ -1,12 +1,15 @@
1
1
  import { RushConfiguration } from '../api/RushConfiguration';
2
+ import type { RushGlobalFolder } from '../api/RushGlobalFolder';
2
3
  interface IAutoinstallerOptions {
3
4
  autoinstallerName: string;
4
5
  rushConfiguration: RushConfiguration;
6
+ rushGlobalFolder: RushGlobalFolder;
5
7
  restrictConsoleOutput?: boolean;
6
8
  }
7
9
  export declare class Autoinstaller {
8
10
  readonly name: string;
9
11
  private readonly _rushConfiguration;
12
+ private readonly _rushGlobalFolder;
10
13
  private readonly _restrictConsoleOutput;
11
14
  constructor(options: IAutoinstallerOptions);
12
15
  get folderFullPath(): string;
@@ -14,7 +17,7 @@ export declare class Autoinstaller {
14
17
  get packageJsonPath(): string;
15
18
  static validateName(autoinstallerName: string): void;
16
19
  prepareAsync(): Promise<void>;
17
- update(): void;
20
+ updateAsync(): Promise<void>;
18
21
  private _logIfConsoleOutputIsNotRestricted;
19
22
  }
20
23
  export {};
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Object containing both the matched item and the start index of the remainder of the query.
3
+ *
4
+ * @beta
5
+ */
6
+ export interface IPrefixMatch<TItem> {
7
+ value: TItem;
8
+ index: number;
9
+ }
1
10
  /**
2
11
  * This class is used to associate POSIX relative paths, such as those returned by `git` commands,
3
12
  * with entities that correspond with ancestor folders, such as Rush Projects.
@@ -7,11 +16,11 @@
7
16
  * @example
8
17
  * ```ts
9
18
  * const tree = new LookupByPath([['foo', 1], ['bar', 2], ['foo/bar', 3]]);
10
- * tree.getNearestAncestor('foo'); // returns 1
11
- * tree.getNearestAncestor('foo/baz'); // returns 1
12
- * tree.getNearestAncestor('baz'); // returns undefined
13
- * tree.getNearestAncestor('foo/bar/baz'); returns 3
14
- * tree.getNearestAncestor('bar/foo/bar'); returns 2
19
+ * tree.findChildPath('foo'); // returns 1
20
+ * tree.findChildPath('foo/baz'); // returns 1
21
+ * tree.findChildPath('baz'); // returns undefined
22
+ * tree.findChildPath('foo/bar/baz'); returns 3
23
+ * tree.findChildPath('bar/foo/bar'); returns 2
15
24
  * ```
16
25
  * @beta
17
26
  */
@@ -40,6 +49,7 @@ export declare class LookupByPath<TItem> {
40
49
  * `LookupByPath.iteratePathSegments('foo\\bar\\baz', '\\')` yields 'foo', 'bar', 'baz'
41
50
  */
42
51
  static iteratePathSegments(serializedPath: string, delimiter?: string): Iterable<string>;
52
+ private static _iteratePrefixes;
43
53
  /**
44
54
  * Associates the value with the specified serialized path.
45
55
  * If a value is already associated, will overwrite.
@@ -68,6 +78,21 @@ export declare class LookupByPath<TItem> {
68
78
  * ```
69
79
  */
70
80
  findChildPath(childPath: string): TItem | undefined;
81
+ /**
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
+ * ```
94
+ */
95
+ findLongestPrefixMatch(query: string): IPrefixMatch<TItem> | undefined;
71
96
  /**
72
97
  * Searches for the item associated with `childPathSegments`, or the nearest ancestor of that path that
73
98
  * has an associated item.
@@ -82,5 +107,14 @@ export declare class LookupByPath<TItem> {
82
107
  * ```
83
108
  */
84
109
  findChildPathFromSegments(childPathSegments: Iterable<string>): TItem | undefined;
110
+ /**
111
+ * Iterates through progressively longer prefixes of a given string and returns as soon
112
+ * as the number of candidate items that match the prefix are 1 or 0.
113
+ *
114
+ * If a match is present, returns the matched itme and the length of the matched prefix.
115
+ *
116
+ * @returns the found item, or `undefined` if no item was found
117
+ */
118
+ private _findLongestPrefixMatch;
85
119
  }
86
120
  //# sourceMappingURL=LookupByPath.d.ts.map
@@ -1,5 +1,6 @@
1
1
  import { TerminalWritable } from '@rushstack/terminal';
2
2
  import { Operation } from './Operation';
3
+ import { OperationExecutionRecord } from './OperationExecutionRecord';
3
4
  import { IExecutionResult } from './IOperationExecutionResult';
4
5
  export interface IOperationExecutionManagerOptions {
5
6
  quietMode: boolean;
@@ -7,6 +8,8 @@ export interface IOperationExecutionManagerOptions {
7
8
  parallelism: number;
8
9
  changedProjectsOnly: boolean;
9
10
  destination?: TerminalWritable;
11
+ onOperationStatusChanged?: (record: OperationExecutionRecord) => void;
12
+ beforeExecuteOperations?: (records: Map<Operation, OperationExecutionRecord>) => Promise<void>;
10
13
  }
11
14
  /**
12
15
  * A class which manages the execution of a set of tasks with interdependencies.
@@ -24,6 +27,8 @@ export declare class OperationExecutionManager {
24
27
  private readonly _colorsNewlinesTransform;
25
28
  private readonly _streamCollator;
26
29
  private readonly _terminal;
30
+ private readonly _onOperationStatusChanged?;
31
+ private readonly _beforeExecuteOperations?;
27
32
  private _hasAnyFailures;
28
33
  private _hasAnyNonAllowedWarnings;
29
34
  private _completedOperations;
@@ -7,6 +7,7 @@ import { Stopwatch } from '../../utilities/Stopwatch';
7
7
  import { OperationMetadataManager } from './OperationMetadataManager';
8
8
  export interface IOperationExecutionRecordContext {
9
9
  streamCollator: StreamCollator;
10
+ onOperationStatusChanged?: (record: OperationExecutionRecord) => void;
10
11
  debugMode: boolean;
11
12
  quietMode: boolean;
12
13
  }
@@ -6,7 +6,7 @@ import type { RushConfiguration } from '../api/RushConfiguration';
6
6
  import type { RushConfigurationProject } from '../api/RushConfigurationProject';
7
7
  import type { Operation } from '../logic/operations/Operation';
8
8
  import type { ProjectChangeAnalyzer } from '../logic/ProjectChangeAnalyzer';
9
- import { IExecutionResult } from '../logic/operations/IOperationExecutionResult';
9
+ import { IExecutionResult, IOperationExecutionResult } from '../logic/operations/IOperationExecutionResult';
10
10
  /**
11
11
  * A plugin that interacts with a phased commands.
12
12
  * @alpha
@@ -77,6 +77,16 @@ export declare class PhasedCommandHooks {
77
77
  * Use the context to distinguish between the initial run and phased runs.
78
78
  */
79
79
  readonly createOperations: AsyncSeriesWaterfallHook<[Set<Operation>, ICreateOperationsContext]>;
80
+ /**
81
+ * Hook invoked before operation start
82
+ * Hook is series for stable output.
83
+ */
84
+ readonly beforeExecuteOperations: AsyncSeriesHook<[Map<Operation, IOperationExecutionResult>]>;
85
+ /**
86
+ * Hook invoked when operation status changed
87
+ * Hook is series for stable output.
88
+ */
89
+ readonly onOperationStatusChanged: SyncHook<[IOperationExecutionResult]>;
80
90
  /**
81
91
  * Hook invoked after executing a set of operations.
82
92
  * Use the context to distinguish between the initial run and phased runs.
@@ -2,8 +2,10 @@ import { JsonObject } from '@rushstack/node-core-library';
2
2
  import { IRushPluginConfiguration } from '../../api/RushPluginsConfiguration';
3
3
  import { Autoinstaller } from '../../logic/Autoinstaller';
4
4
  import { IPluginLoaderOptions, PluginLoaderBase } from './PluginLoaderBase';
5
+ import type { RushGlobalFolder } from '../../api/RushGlobalFolder';
5
6
  interface IAutoinstallerPluginLoaderOptions extends IPluginLoaderOptions<IRushPluginConfiguration> {
6
7
  restrictConsoleOutput: boolean;
8
+ rushGlobalFolder: RushGlobalFolder;
7
9
  }
8
10
  /**
9
11
  * @beta
@@ -5,12 +5,14 @@ import { IBuiltInPluginConfiguration } from './PluginLoader/BuiltInPluginLoader'
5
5
  import { AutoinstallerPluginLoader } from './PluginLoader/AutoinstallerPluginLoader';
6
6
  import { RushSession } from './RushSession';
7
7
  import { PluginLoaderBase } from './PluginLoader/PluginLoaderBase';
8
+ import type { RushGlobalFolder } from '../api/RushGlobalFolder';
8
9
  export interface IPluginManagerOptions {
9
10
  terminal: ITerminal;
10
11
  rushConfiguration: RushConfiguration;
11
12
  rushSession: RushSession;
12
13
  builtInPluginConfigurations: IBuiltInPluginConfiguration[];
13
14
  restrictConsoleOutput: boolean;
15
+ rushGlobalFolder: RushGlobalFolder;
14
16
  }
15
17
  export interface ICustomCommandLineConfigurationInfo {
16
18
  commandLineConfiguration: CommandLineConfiguration;
@@ -25,6 +27,7 @@ export declare class PluginManager {
25
27
  private readonly _autoinstallerPluginLoaders;
26
28
  private readonly _installedAutoinstallerNames;
27
29
  private readonly _loadedPluginNames;
30
+ private readonly _rushGlobalFolder;
28
31
  private _error;
29
32
  constructor(options: IPluginManagerOptions);
30
33
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/rush-sdk",
3
- "version": "5.93.2",
3
+ "version": "5.94.1",
4
4
  "description": "An API for interacting with the Rush engine",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,13 +20,13 @@
20
20
  "@types/heft-jest": "1.0.1",
21
21
  "@types/semver": "7.3.5",
22
22
  "@types/webpack-env": "1.18.0",
23
- "@microsoft/rush-lib": "5.93.2",
23
+ "@microsoft/rush-lib": "5.94.1",
24
24
  "@rushstack/eslint-config": "3.2.0",
25
- "@rushstack/heft": "0.49.7",
26
- "@rushstack/heft-node-rig": "1.12.4",
27
- "@rushstack/stream-collator": "4.0.227",
25
+ "@rushstack/heft": "0.50.0",
26
+ "@rushstack/heft-node-rig": "1.12.5",
27
+ "@rushstack/stream-collator": "4.0.228",
28
28
  "@rushstack/ts-command-line": "4.13.2",
29
- "@rushstack/terminal": "0.5.2"
29
+ "@rushstack/terminal": "0.5.3"
30
30
  },
31
31
  "scripts": {
32
32
  "build": "heft build --clean",