@rushstack/rush-sdk 5.100.2 → 5.101.0-pr3949.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +97 -5
  2. package/dist/loader.d.ts +92 -0
  3. package/dist/rush-lib.d.ts +292 -10
  4. package/dist/rush-sdk.d.ts +92 -0
  5. package/dist/tsdoc-metadata.json +11 -0
  6. package/lib/api/CobuildConfiguration.d.ts +71 -0
  7. package/lib/api/CobuildConfiguration.js +1 -0
  8. package/lib/api/EnvironmentConfiguration.d.ts +61 -0
  9. package/lib/index.d.ts +3 -1
  10. package/lib/logic/RushConstants.d.ts +4 -0
  11. package/lib/logic/buildCache/ProjectBuildCache.d.ts +5 -4
  12. package/lib/logic/cobuild/CobuildLock.d.ts +43 -0
  13. package/lib/logic/cobuild/CobuildLock.js +1 -0
  14. package/lib/logic/cobuild/DisjointSet.d.ts +28 -0
  15. package/lib/logic/cobuild/DisjointSet.js +1 -0
  16. package/lib/logic/cobuild/ICobuildLockProvider.d.ts +99 -0
  17. package/lib/logic/cobuild/ICobuildLockProvider.js +1 -0
  18. package/lib/logic/deploy/DeployScenarioConfiguration.d.ts +2 -0
  19. package/lib/logic/operations/AsyncOperationQueue.d.ts +23 -4
  20. package/lib/logic/operations/CacheableOperationPlugin.d.ts +30 -0
  21. package/lib/logic/operations/CacheableOperationPlugin.js +1 -0
  22. package/lib/logic/operations/IOperationExecutionResult.d.ts +4 -0
  23. package/lib/logic/operations/IOperationRunner.d.ts +27 -8
  24. package/lib/logic/operations/OperationExecutionManager.d.ts +5 -0
  25. package/lib/logic/operations/OperationExecutionRecord.d.ts +8 -1
  26. package/lib/logic/operations/OperationMetadataManager.d.ts +3 -1
  27. package/lib/logic/operations/OperationRunnerHooks.d.ts +52 -0
  28. package/lib/logic/operations/OperationRunnerHooks.js +1 -0
  29. package/lib/logic/operations/OperationStateFile.d.ts +2 -0
  30. package/lib/logic/operations/OperationStatus.d.ts +8 -0
  31. package/lib/logic/operations/PeriodicCallback.d.ts +20 -0
  32. package/lib/logic/operations/PeriodicCallback.js +1 -0
  33. package/lib/logic/operations/ShellOperationRunner.d.ts +6 -14
  34. package/lib/logic/pnpm/PnpmShrinkwrapFile.d.ts +5 -0
  35. package/lib/pluginFramework/PhasedCommandHooks.d.ts +20 -3
  36. package/lib/pluginFramework/RushSession.d.ts +11 -2
  37. package/lib-shim/helpers.d.ts +21 -0
  38. package/lib-shim/helpers.d.ts.map +1 -0
  39. package/lib-shim/helpers.js +83 -0
  40. package/lib-shim/helpers.js.map +1 -0
  41. package/lib-shim/index.d.ts.map +1 -1
  42. package/lib-shim/index.js +44 -86
  43. package/lib-shim/index.js.map +1 -1
  44. package/lib-shim/loader.d.ts +86 -0
  45. package/lib-shim/loader.d.ts.map +1 -0
  46. package/lib-shim/loader.js +189 -0
  47. package/lib-shim/loader.js.map +1 -0
  48. package/package.json +21 -9
@@ -35,6 +35,33 @@ export interface IOperationRunnerContext {
35
35
  * Object used to track elapsed time.
36
36
  */
37
37
  stopwatch: IStopwatchResult;
38
+ /**
39
+ * The current execution status of an operation. Operations start in the 'ready' state,
40
+ * but can be 'blocked' if an upstream operation failed. It is 'executing' when
41
+ * the operation is executing. Once execution is complete, it is either 'success' or
42
+ * 'failure'.
43
+ */
44
+ status: OperationStatus;
45
+ /**
46
+ * Error which occurred while executing this operation, this is stored in case we need
47
+ * it later (for example to re-print errors at end of execution).
48
+ */
49
+ error?: Error;
50
+ /**
51
+ * The set of operations that depend on this operation.
52
+ */
53
+ readonly consumers: Set<IOperationRunnerContext>;
54
+ /**
55
+ * The operation runner that is executing this operation.
56
+ */
57
+ readonly runner: IOperationRunner;
58
+ /**
59
+ * Normally the incremental build logic will rebuild changed projects as well as
60
+ * any projects that directly or indirectly depend on a changed project.
61
+ * If true, then the incremental build logic will only rebuild changed projects and
62
+ * ignore dependent projects.
63
+ */
64
+ readonly changedProjectsOnly: boolean;
38
65
  }
39
66
  /**
40
67
  * The `Operation` class is a node in the dependency graph of work that needs to be scheduled by the
@@ -48,10 +75,6 @@ export interface IOperationRunner {
48
75
  * Name of the operation, for logging.
49
76
  */
50
77
  readonly name: string;
51
- /**
52
- * This flag determines if the operation is allowed to be skipped if up to date.
53
- */
54
- isSkipAllowed: boolean;
55
78
  /**
56
79
  * Indicates that this runner's duration has meaning.
57
80
  */
@@ -65,10 +88,6 @@ export interface IOperationRunner {
65
88
  * exit code
66
89
  */
67
90
  warningsAreAllowed: boolean;
68
- /**
69
- * Indicates if the output of this operation may be written to the cache
70
- */
71
- isCacheWriteAllowed: boolean;
72
91
  /**
73
92
  * Method to be executed for the operation.
74
93
  */
@@ -8,6 +8,8 @@ export interface IOperationExecutionManagerOptions {
8
8
  parallelism: number;
9
9
  changedProjectsOnly: boolean;
10
10
  destination?: TerminalWritable;
11
+ beforeExecuteOperation?: (operation: OperationExecutionRecord) => Promise<void>;
12
+ afterExecuteOperation?: (operation: OperationExecutionRecord) => Promise<void>;
11
13
  onOperationStatusChanged?: (record: OperationExecutionRecord) => void;
12
14
  beforeExecuteOperations?: (records: Map<Operation, OperationExecutionRecord>) => Promise<void>;
13
15
  }
@@ -27,11 +29,14 @@ export declare class OperationExecutionManager {
27
29
  private readonly _colorsNewlinesTransform;
28
30
  private readonly _streamCollator;
29
31
  private readonly _terminal;
32
+ private readonly _beforeExecuteOperation?;
33
+ private readonly _afterExecuteOperation?;
30
34
  private readonly _onOperationStatusChanged?;
31
35
  private readonly _beforeExecuteOperations?;
32
36
  private _hasAnyFailures;
33
37
  private _hasAnyNonAllowedWarnings;
34
38
  private _completedOperations;
39
+ private _executionQueue;
35
40
  constructor(operations: Set<Operation>, options: IOperationExecutionManagerOptions);
36
41
  private _streamCollator_onWriterActive;
37
42
  /**
@@ -10,9 +10,12 @@ export interface IOperationExecutionRecordContext {
10
10
  onOperationStatusChanged?: (record: OperationExecutionRecord) => void;
11
11
  debugMode: boolean;
12
12
  quietMode: boolean;
13
+ changedProjectsOnly: boolean;
13
14
  }
14
15
  /**
15
16
  * Internal class representing everything about executing an operation
17
+ *
18
+ * @internal
16
19
  */
17
20
  export declare class OperationExecutionRecord implements IOperationRunnerContext {
18
21
  /**
@@ -37,6 +40,7 @@ export declare class OperationExecutionRecord implements IOperationRunnerContext
37
40
  * operation to execute, the operation with the highest criticalPathLength is chosen.
38
41
  *
39
42
  * Example:
43
+ * ```
40
44
  * (0) A
41
45
  * \
42
46
  * (1) B C (0) (applications)
@@ -53,6 +57,7 @@ export declare class OperationExecutionRecord implements IOperationRunnerContext
53
57
  * X has a score of 1, since the only package which depends on it is A
54
58
  * Z has a score of 2, since only X depends on it, and X has a score of 1
55
59
  * Y has a score of 2, since the chain Y->X->C is longer than Y->C
60
+ * ```
56
61
  *
57
62
  * The algorithm is implemented in AsyncOperationQueue.ts as calculateCriticalPathLength()
58
63
  */
@@ -76,8 +81,10 @@ export declare class OperationExecutionRecord implements IOperationRunnerContext
76
81
  get name(): string;
77
82
  get debugMode(): boolean;
78
83
  get quietMode(): boolean;
84
+ get changedProjectsOnly(): boolean;
79
85
  get collatedWriter(): CollatedWriter;
80
86
  get nonCachedDurationMs(): number | undefined;
81
- executeAsync(onResult: (record: OperationExecutionRecord) => void): Promise<void>;
87
+ get cobuildRunnerId(): string | undefined;
88
+ executeAsync(onResult: (record: OperationExecutionRecord) => Promise<void>): Promise<void>;
82
89
  }
83
90
  //# sourceMappingURL=OperationExecutionRecord.d.ts.map
@@ -16,6 +16,8 @@ export interface IOperationMetaData {
16
16
  durationInSeconds: number;
17
17
  logPath: string;
18
18
  errorLogPath: string;
19
+ cobuildContextId: string | undefined;
20
+ cobuildRunnerId: string | undefined;
19
21
  }
20
22
  /**
21
23
  * A helper class for managing the meta files of a operation.
@@ -38,7 +40,7 @@ export declare class OperationMetadataManager {
38
40
  * Example: `.rush/temp/operation/_phase_build/error.log`
39
41
  */
40
42
  get relativeFilepaths(): string[];
41
- saveAsync({ durationInSeconds, logPath, errorLogPath }: IOperationMetaData): Promise<void>;
43
+ saveAsync({ durationInSeconds, cobuildContextId, cobuildRunnerId, logPath, errorLogPath }: IOperationMetaData): Promise<void>;
42
44
  tryRestoreAsync({ terminal, logPath, errorLogPath }: {
43
45
  terminal: ITerminal;
44
46
  logPath: string;
@@ -0,0 +1,52 @@
1
+ import { AsyncSeriesBailHook, AsyncSeriesWaterfallHook } from 'tapable';
2
+ import type { ITerminal } from '@rushstack/node-core-library';
3
+ import type { IOperationRunnerContext } from './IOperationRunner';
4
+ import type { OperationStatus } from './OperationStatus';
5
+ import type { IProjectDeps, ShellOperationRunner } from './ShellOperationRunner';
6
+ import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
7
+ import type { IPhase } from '../../api/CommandLineConfiguration';
8
+ /**
9
+ * A plugin tht interacts with a operation runner
10
+ */
11
+ export interface IOperationRunnerPlugin {
12
+ /**
13
+ * Applies this plugin.
14
+ */
15
+ apply(hooks: OperationRunnerHooks): void;
16
+ }
17
+ export interface IOperationRunnerBeforeExecuteContext {
18
+ context: IOperationRunnerContext;
19
+ runner: ShellOperationRunner;
20
+ terminal: ITerminal;
21
+ projectDeps: IProjectDeps | undefined;
22
+ lastProjectDeps: IProjectDeps | undefined;
23
+ trackedProjectFiles: string[] | undefined;
24
+ logPath: string;
25
+ errorLogPath: string;
26
+ rushProject: RushConfigurationProject;
27
+ phase: IPhase;
28
+ commandName: string;
29
+ commandToRun: string;
30
+ finallyCallbacks: (() => void)[];
31
+ }
32
+ export interface IOperationRunnerAfterExecuteContext {
33
+ context: IOperationRunnerContext;
34
+ terminal: ITerminal;
35
+ /**
36
+ * Exit code of the operation command
37
+ */
38
+ exitCode: number;
39
+ status: OperationStatus;
40
+ taskIsSuccessful: boolean;
41
+ logPath: string;
42
+ errorLogPath: string;
43
+ }
44
+ /**
45
+ * Hooks into the lifecycle of the operation runner
46
+ *
47
+ */
48
+ export declare class OperationRunnerHooks {
49
+ beforeExecute: AsyncSeriesBailHook<IOperationRunnerBeforeExecuteContext, OperationStatus | undefined>;
50
+ afterExecute: AsyncSeriesWaterfallHook<IOperationRunnerAfterExecuteContext>;
51
+ }
52
+ //# sourceMappingURL=OperationRunnerHooks.d.ts.map
@@ -0,0 +1 @@
1
+ module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/operations/OperationRunnerHooks");
@@ -10,6 +10,8 @@ export interface IOperationStateFileOptions {
10
10
  */
11
11
  export interface IOperationStateJson {
12
12
  nonCachedDurationMs: number;
13
+ cobuildContextId: string | undefined;
14
+ cobuildRunnerId: string | undefined;
13
15
  }
14
16
  /**
15
17
  * A helper class for managing the state file of a operation.
@@ -7,10 +7,18 @@ export declare enum OperationStatus {
7
7
  * The Operation is on the queue, ready to execute (but may be waiting for dependencies)
8
8
  */
9
9
  Ready = "READY",
10
+ /**
11
+ * The Operation is Queued
12
+ */
13
+ Queued = "QUEUED",
10
14
  /**
11
15
  * The Operation is currently executing
12
16
  */
13
17
  Executing = "EXECUTING",
18
+ /**
19
+ * The Operation is currently executing by a remote process
20
+ */
21
+ RemoteExecuting = "REMOTE EXECUTING",
14
22
  /**
15
23
  * The Operation completed successfully and did not write to standard output
16
24
  */
@@ -0,0 +1,20 @@
1
+ export type ICallbackFn = () => Promise<void> | void;
2
+ export interface IPeriodicCallbackOptions {
3
+ interval: number;
4
+ }
5
+ /**
6
+ * A help class to run callbacks in a loop with a specified interval.
7
+ *
8
+ * @beta
9
+ */
10
+ export declare class PeriodicCallback {
11
+ private _callbacks;
12
+ private _interval;
13
+ private _intervalId;
14
+ private _isRunning;
15
+ constructor(options: IPeriodicCallbackOptions);
16
+ addCallback(callback: ICallbackFn): void;
17
+ start(): void;
18
+ stop(): void;
19
+ }
20
+ //# sourceMappingURL=PeriodicCallback.d.ts.map
@@ -0,0 +1 @@
1
+ module.exports = require("../../../lib-shim/index")._rushSdk_loadInternalModule("logic/operations/PeriodicCallback");
@@ -1,9 +1,10 @@
1
1
  import { OperationStatus } from './OperationStatus';
2
2
  import { IOperationRunner, IOperationRunnerContext } from './IOperationRunner';
3
+ import { PeriodicCallback } from './PeriodicCallback';
4
+ import { OperationRunnerHooks } from './OperationRunnerHooks';
3
5
  import type { RushConfiguration } from '../../api/RushConfiguration';
4
6
  import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
5
7
  import type { ProjectChangeAnalyzer } from '../ProjectChangeAnalyzer';
6
- import type { BuildCacheConfiguration } from '../../api/BuildCacheConfiguration';
7
8
  import type { IPhase } from '../../api/CommandLineConfiguration';
8
9
  export interface IProjectDeps {
9
10
  files: {
@@ -14,9 +15,7 @@ export interface IProjectDeps {
14
15
  export interface IOperationRunnerOptions {
15
16
  rushProject: RushConfigurationProject;
16
17
  rushConfiguration: RushConfiguration;
17
- buildCacheConfiguration: BuildCacheConfiguration | undefined;
18
18
  commandToRun: string;
19
- isIncrementalBuildAllowed: boolean;
20
19
  projectChangeAnalyzer: ProjectChangeAnalyzer;
21
20
  displayName: string;
22
21
  phase: IPhase;
@@ -32,31 +31,24 @@ export interface IOperationRunnerOptions {
32
31
  */
33
32
  export declare class ShellOperationRunner implements IOperationRunner {
34
33
  readonly name: string;
35
- isCacheWriteAllowed: boolean;
36
- isSkipAllowed: boolean;
37
34
  readonly reportTiming: boolean;
38
35
  readonly silent: boolean;
39
36
  readonly warningsAreAllowed: boolean;
37
+ readonly hooks: OperationRunnerHooks;
38
+ readonly periodicCallback: PeriodicCallback;
39
+ readonly logFilenameIdentifier: string;
40
+ static readonly periodicCallbackIntervalInSeconds: number;
40
41
  private readonly _rushProject;
41
42
  private readonly _phase;
42
43
  private readonly _rushConfiguration;
43
- private readonly _buildCacheConfiguration;
44
44
  private readonly _commandName;
45
45
  private readonly _commandToRun;
46
- private readonly _isCacheReadAllowed;
47
46
  private readonly _projectChangeAnalyzer;
48
47
  private readonly _packageDepsFilename;
49
- private readonly _logFilenameIdentifier;
50
48
  private readonly _selectedPhases;
51
- /**
52
- * UNINITIALIZED === we haven't tried to initialize yet
53
- * undefined === we didn't create one because the feature is not enabled
54
- */
55
- private _projectBuildCache;
56
49
  constructor(options: IOperationRunnerOptions);
57
50
  executeAsync(context: IOperationRunnerContext): Promise<OperationStatus>;
58
51
  private _executeAsync;
59
- private _tryGetProjectBuildCacheAsync;
60
52
  }
61
53
  /**
62
54
  * When running a command from the "scripts" block in package.json, if the command
@@ -94,6 +94,10 @@ export interface IPnpmShrinkwrapYaml {
94
94
  registry: string;
95
95
  /** The list of specifiers used to resolve direct dependency versions */
96
96
  specifiers: Record<string, string>;
97
+ /** The list of override version number for dependencies */
98
+ overrides?: {
99
+ [dependency: string]: string;
100
+ };
97
101
  }
98
102
  /**
99
103
  * Given an encoded "dependency key" from the PNPM shrinkwrap file, this parses it into an equivalent
@@ -111,6 +115,7 @@ export declare class PnpmShrinkwrapFile extends BaseShrinkwrapFile {
111
115
  readonly importers: ReadonlyMap<string, IPnpmShrinkwrapImporterYaml>;
112
116
  readonly specifiers: ReadonlyMap<string, string>;
113
117
  readonly packages: ReadonlyMap<string, IPnpmShrinkwrapDependencyYaml>;
118
+ readonly overrides: ReadonlyMap<string, string>;
114
119
  private readonly _shrinkwrapJson;
115
120
  private readonly _integrities;
116
121
  private _pnpmfileConfiguration;
@@ -6,8 +6,10 @@ 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 { ITelemetryData } from '../logic/Telemetry';
10
- import { IExecutionResult, IOperationExecutionResult } from '../logic/operations/IOperationExecutionResult';
9
+ import type { IExecutionResult, IOperationExecutionResult } from '../logic/operations/IOperationExecutionResult';
10
+ import type { CobuildConfiguration } from '../api/CobuildConfiguration';
11
+ import type { IOperationRunnerContext } from '../logic/operations/IOperationRunner';
12
+ import type { ITelemetryData } from '../logic/Telemetry';
11
13
  /**
12
14
  * A plugin that interacts with a phased commands.
13
15
  * @alpha
@@ -27,6 +29,10 @@ export interface ICreateOperationsContext {
27
29
  * The configuration for the build cache, if the feature is enabled.
28
30
  */
29
31
  readonly buildCacheConfiguration: BuildCacheConfiguration | undefined;
32
+ /**
33
+ * The configuration for the cobuild, if cobuild feature and build cache feature are both enabled.
34
+ */
35
+ readonly cobuildConfiguration: CobuildConfiguration | undefined;
30
36
  /**
31
37
  * The set of custom parameters for the executing command.
32
38
  * Maps from the `longName` field in command-line.json to the parser configuration in ts-command-line.
@@ -86,7 +92,10 @@ export declare class PhasedCommandHooks {
86
92
  * Hook invoked before operation start
87
93
  * Hook is series for stable output.
88
94
  */
89
- readonly beforeExecuteOperations: AsyncSeriesHook<[Map<Operation, IOperationExecutionResult>]>;
95
+ readonly beforeExecuteOperations: AsyncSeriesHook<[
96
+ Map<Operation, IOperationExecutionResult>,
97
+ ICreateOperationsContext
98
+ ]>;
90
99
  /**
91
100
  * Hook invoked when operation status changed
92
101
  * Hook is series for stable output.
@@ -98,6 +107,14 @@ export declare class PhasedCommandHooks {
98
107
  * Hook is series for stable output.
99
108
  */
100
109
  readonly afterExecuteOperations: AsyncSeriesHook<[IExecutionResult, ICreateOperationsContext]>;
110
+ /**
111
+ * Hook invoked before executing a operation.
112
+ */
113
+ readonly beforeExecuteOperation: AsyncSeriesHook<[IOperationRunnerContext]>;
114
+ /**
115
+ * Hook invoked after executing a operation.
116
+ */
117
+ readonly afterExecuteOperation: AsyncSeriesHook<[IOperationRunnerContext]>;
101
118
  /**
102
119
  * Hook invoked after a run has finished and the command is watching for changes.
103
120
  * May be used to display additional relevant data to the user.
@@ -1,8 +1,10 @@
1
1
  import { ITerminalProvider } from '@rushstack/node-core-library';
2
- import { IBuildCacheJson } from '../api/BuildCacheConfiguration';
3
- import { ICloudBuildCacheProvider } from '../logic/buildCache/ICloudBuildCacheProvider';
4
2
  import { ILogger } from './logging/Logger';
5
3
  import { RushLifecycleHooks } from './RushLifeCycle';
4
+ import type { IBuildCacheJson } from '../api/BuildCacheConfiguration';
5
+ import type { ICloudBuildCacheProvider } from '../logic/buildCache/ICloudBuildCacheProvider';
6
+ import type { ICobuildJson } from '../api/CobuildConfiguration';
7
+ import type { ICobuildLockProvider } from '../logic/cobuild/ICobuildLockProvider';
6
8
  /**
7
9
  * @beta
8
10
  */
@@ -14,17 +16,24 @@ export interface IRushSessionOptions {
14
16
  * @beta
15
17
  */
16
18
  export type CloudBuildCacheProviderFactory = (buildCacheJson: IBuildCacheJson) => ICloudBuildCacheProvider | Promise<ICloudBuildCacheProvider>;
19
+ /**
20
+ * @beta
21
+ */
22
+ export type CobuildLockProviderFactory = (cobuildJson: ICobuildJson) => ICobuildLockProvider | Promise<ICobuildLockProvider>;
17
23
  /**
18
24
  * @beta
19
25
  */
20
26
  export declare class RushSession {
21
27
  private readonly _options;
22
28
  private readonly _cloudBuildCacheProviderFactories;
29
+ private readonly _cobuildLockProviderFactories;
23
30
  readonly hooks: RushLifecycleHooks;
24
31
  constructor(options: IRushSessionOptions);
25
32
  getLogger(name: string): ILogger;
26
33
  get terminalProvider(): ITerminalProvider;
27
34
  registerCloudBuildCacheProviderFactory(cacheProviderName: string, factory: CloudBuildCacheProviderFactory): void;
28
35
  getCloudBuildCacheProviderFactory(cacheProviderName: string): CloudBuildCacheProviderFactory | undefined;
36
+ registerCobuildLockProviderFactory(cobuildLockProviderName: string, factory: CobuildLockProviderFactory): void;
37
+ getCobuildLockProviderFactory(cobuildLockProviderName: string): CobuildLockProviderFactory | undefined;
29
38
  }
30
39
  //# sourceMappingURL=RushSession.d.ts.map
@@ -0,0 +1,21 @@
1
+ import type { EnvironmentVariableNames } from '@microsoft/rush-lib';
2
+ export declare const RUSH_LIB_NAME: '@microsoft/rush-lib';
3
+ export declare const RUSH_LIB_PATH_ENV_VAR_NAME: typeof EnvironmentVariableNames.RUSH_LIB_PATH;
4
+ export type RushLibModuleType = Record<string, unknown>;
5
+ export interface ISdkContext {
6
+ rushLibModule: RushLibModuleType | undefined;
7
+ }
8
+ export declare const sdkContext: ISdkContext;
9
+ /**
10
+ * Find the rush.json location and return the path, or undefined if a rush.json can't be found.
11
+ *
12
+ * @privateRemarks
13
+ * Keep this in sync with `RushConfiguration.tryFindRushJsonLocation`.
14
+ */
15
+ export declare function tryFindRushJsonLocation(startingFolder: string): string | undefined;
16
+ export declare function _require<TResult>(moduleName: string): TResult;
17
+ /**
18
+ * Require `@microsoft/rush-lib` under the specified folder path.
19
+ */
20
+ export declare function requireRushLibUnderFolderPath(folderPath: string): RushLibModuleType;
21
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAEpE,eAAO,MAAM,aAAa,EAAE,qBAA6C,CAAC;AAC1E,eAAO,MAAM,0BAA0B,EAAE,OAAO,wBAAwB,CAAC,aAAgC,CAAC;AAE1G,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAExD,MAAM,WAAW,WAAW;IAC1B,aAAa,EAAE,iBAAiB,GAAG,SAAS,CAAC;CAC9C;AAED,eAAO,MAAM,UAAU,EAAE,WAExB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAoBlF;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAU7D;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,UAAU,EAAE,MAAM,GAAG,iBAAiB,CAOnF"}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
17
+ }) : function(o, v) {
18
+ o["default"] = v;
19
+ });
20
+ var __importStar = (this && this.__importStar) || function (mod) {
21
+ if (mod && mod.__esModule) return mod;
22
+ var result = {};
23
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
24
+ __setModuleDefault(result, mod);
25
+ return result;
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.requireRushLibUnderFolderPath = exports._require = exports.tryFindRushJsonLocation = exports.sdkContext = exports.RUSH_LIB_PATH_ENV_VAR_NAME = exports.RUSH_LIB_NAME = void 0;
29
+ const path = __importStar(require("path"));
30
+ const node_core_library_1 = require("@rushstack/node-core-library");
31
+ exports.RUSH_LIB_NAME = '@microsoft/rush-lib';
32
+ exports.RUSH_LIB_PATH_ENV_VAR_NAME = '_RUSH_LIB_PATH';
33
+ exports.sdkContext = {
34
+ rushLibModule: undefined
35
+ };
36
+ /**
37
+ * Find the rush.json location and return the path, or undefined if a rush.json can't be found.
38
+ *
39
+ * @privateRemarks
40
+ * Keep this in sync with `RushConfiguration.tryFindRushJsonLocation`.
41
+ */
42
+ function tryFindRushJsonLocation(startingFolder) {
43
+ let currentFolder = startingFolder;
44
+ // Look upwards at parent folders until we find a folder containing rush.json
45
+ for (let i = 0; i < 10; ++i) {
46
+ const rushJsonFilename = path.join(currentFolder, 'rush.json');
47
+ if (node_core_library_1.FileSystem.exists(rushJsonFilename)) {
48
+ return rushJsonFilename;
49
+ }
50
+ const parentFolder = path.dirname(currentFolder);
51
+ if (parentFolder === currentFolder) {
52
+ break;
53
+ }
54
+ currentFolder = parentFolder;
55
+ }
56
+ return undefined;
57
+ }
58
+ exports.tryFindRushJsonLocation = tryFindRushJsonLocation;
59
+ function _require(moduleName) {
60
+ if (typeof __non_webpack_require__ === 'function') {
61
+ // If this library has been bundled with Webpack, we need to call the real `require` function
62
+ // that doesn't get turned into a `__webpack_require__` statement.
63
+ // `__non_webpack_require__` is a Webpack macro that gets turned into a `require` statement
64
+ // during bundling.
65
+ return __non_webpack_require__(moduleName);
66
+ }
67
+ else {
68
+ return require(moduleName);
69
+ }
70
+ }
71
+ exports._require = _require;
72
+ /**
73
+ * Require `@microsoft/rush-lib` under the specified folder path.
74
+ */
75
+ function requireRushLibUnderFolderPath(folderPath) {
76
+ const rushLibModulePath = node_core_library_1.Import.resolveModule({
77
+ modulePath: exports.RUSH_LIB_NAME,
78
+ baseFolderPath: folderPath
79
+ });
80
+ return _require(rushLibModulePath);
81
+ }
82
+ exports.requireRushLibUnderFolderPath = requireRushLibUnderFolderPath;
83
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +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,GAAkD,gBAAgB,CAAC;AAQ7F,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 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAqNA;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAO1E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA8MA;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAO1E"}