@rushstack/rush-sdk 5.59.0-rc.0 → 5.59.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.
package/README.md CHANGED
@@ -1,26 +1,26 @@
1
- ## @rushstack/rush-sdk
2
-
3
- This is a companion package for the Rush tool. See the [@microsoft/rush](https://www.npmjs.com/package/@microsoft/rush) package for details.
4
-
5
- ⚠ ***THIS PACKAGE IS EXPERIMENTAL*** ⚠
6
-
7
- The **@rushstack/rush-sdk** package acts as a lightweight proxy for accessing the APIs of the **@microsoft/rush-lib** engine. It is intended to support three different use cases:
8
-
9
- 1. Rush plugins should import from **@rushstack/rush-sdk** instead of **@microsoft/rush-lib**. This gives plugins full access to Rush APIs while avoiding a redundant installation of those packages. At runtime, the APIs will be bound to the correct `rushVersion` from **rush.json**, and guaranteed to be the same **@microsoft/rush-lib** module instance as the plugin host.
10
-
11
- 2. When authoring unit tests for a Rush plugin, developers should add **@microsoft/rush-lib** to their **package.json** `devDependencies`. In this context, **@rushstack/rush-sdk** will resolve to that instance for testing purposes.
12
-
13
- 3. **(Not implemented yet)** For scripts and tools that are designed to be used in a Rush monorepo, in the future **@rushstack/rush-sdk** will automatically invoke **install-run-rush.js** and load the local installation. This ensures that tools load a compatible version of the Rush engine for the given branch. Once this is implemented, **@rushstack/rush-sdk** can replace **@microsoft/rush-lib** entirely as the official API interface, with the latter serving as the underlying implementation.
14
-
15
-
16
- The **@rushstack/rush-sdk** API declarations are identical to the corresponding version of **@microsoft/rush-lib**.
17
-
18
-
19
- ## Links
20
-
21
- - [CHANGELOG.md](
22
- https://github.com/microsoft/rushstack/blob/master/apps/rush/CHANGELOG.md) - Find
23
- out what's new in the latest version
24
- - [API Reference](https://rushstack.io/pages/api/rush-lib/)
25
-
26
- Rush is part of the [Rush Stack](https://rushstack.io/) family of projects.
1
+ ## @rushstack/rush-sdk
2
+
3
+ This is a companion package for the Rush tool. See the [@microsoft/rush](https://www.npmjs.com/package/@microsoft/rush) package for details.
4
+
5
+ ⚠ ***THIS PACKAGE IS EXPERIMENTAL*** ⚠
6
+
7
+ The **@rushstack/rush-sdk** package acts as a lightweight proxy for accessing the APIs of the **@microsoft/rush-lib** engine. It is intended to support three different use cases:
8
+
9
+ 1. Rush plugins should import from **@rushstack/rush-sdk** instead of **@microsoft/rush-lib**. This gives plugins full access to Rush APIs while avoiding a redundant installation of those packages. At runtime, the APIs will be bound to the correct `rushVersion` from **rush.json**, and guaranteed to be the same **@microsoft/rush-lib** module instance as the plugin host.
10
+
11
+ 2. When authoring unit tests for a Rush plugin, developers should add **@microsoft/rush-lib** to their **package.json** `devDependencies`. In this context, **@rushstack/rush-sdk** will resolve to that instance for testing purposes.
12
+
13
+ 3. **(Not implemented yet)** For scripts and tools that are designed to be used in a Rush monorepo, in the future **@rushstack/rush-sdk** will automatically invoke **install-run-rush.js** and load the local installation. This ensures that tools load a compatible version of the Rush engine for the given branch. Once this is implemented, **@rushstack/rush-sdk** can replace **@microsoft/rush-lib** entirely as the official API interface, with the latter serving as the underlying implementation.
14
+
15
+
16
+ The **@rushstack/rush-sdk** API declarations are identical to the corresponding version of **@microsoft/rush-lib**.
17
+
18
+
19
+ ## Links
20
+
21
+ - [CHANGELOG.md](
22
+ https://github.com/microsoft/rushstack/blob/master/apps/rush/CHANGELOG.md) - Find
23
+ out what's new in the latest version
24
+ - [API Reference](https://rushstack.io/pages/api/rush-lib/)
25
+
26
+ Rush is part of the [Rush Stack](https://rushstack.io/) family of projects.
@@ -603,6 +603,13 @@ declare interface IBaseBuildCacheJson {
603
603
  */
604
604
  declare type IBuildCacheJson = ICloudBuildCacheJson | ILocalBuildCacheJson;
605
605
 
606
+ /**
607
+ * @internal
608
+ */
609
+ export declare interface _IBuiltInPluginConfiguration extends _IRushPluginConfigurationBase {
610
+ pluginPackageFolder: string;
611
+ }
612
+
606
613
  /**
607
614
  * @beta
608
615
  */
@@ -767,6 +774,12 @@ export declare interface ILaunchOptions {
767
774
  * with this version of Rush, so we shouldn't print a similar error.
768
775
  */
769
776
  alreadyReportedNodeTooNewError?: boolean;
777
+ /**
778
+ * Used to specify Rush plugins that are dependencies of the "\@microsoft/rush" package.
779
+ *
780
+ * @internal
781
+ */
782
+ builtInPluginConfigurations?: _IBuiltInPluginConfiguration[];
770
783
  }
771
784
 
772
785
  /**
@@ -943,11 +956,14 @@ export declare interface IRushPlugin {
943
956
  apply(rushSession: RushSession, rushConfiguration: RushConfiguration): void;
944
957
  }
945
958
 
946
- declare interface IRushPluginConfiguration extends IRushPluginConfigurationBase {
959
+ declare interface IRushPluginConfiguration extends _IRushPluginConfigurationBase {
947
960
  autoinstallerName: string;
948
961
  }
949
962
 
950
- declare interface IRushPluginConfigurationBase {
963
+ /**
964
+ * @internal
965
+ */
966
+ export declare interface _IRushPluginConfigurationBase {
951
967
  packageName: string;
952
968
  pluginName: string;
953
969
  }
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,oEAAuF;AAEvF,MAAM,aAAa,GAAW,qBAAqB,CAAC;AAQpD,qGAAqG;AACrG,gGAAgG;AAChG,IAAI,aAAa,GAAkC,MAAM,CAAC,uBAAuB,CAAC;AAElF,6FAA6F;AAC7F,+FAA+F;AAC/F,IAAI,aAAa,KAAK,SAAS,EAAE;IAC/B,MAAM,aAAa,GAAuB,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,0CAAE,QAAQ,CAAC;IACnE,IAAI,aAAa,KAAK,SAAS,EAAE;QAC/B,MAAM,mBAAmB,GACvB,qCAAiB,CAAC,QAAQ,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC;QAEnE,IAAI,mBAAmB,KAAK,SAAS,EAAE;YACrC,MAAM,iBAAiB,GAAiB,OAAO,CAAC,IAAI,CAAC,IAA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,EAAE,QAAQ,EAAE;YACvC,UAAU,EAAE,IAAI;YAChB,GAAG,EAAE;gBACH,OAAO,uBAAuB,CAAC,QAAQ,CAAC,CAAC;YAC3C,CAAC;SACF,CAAC,CAAC;KACJ;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport * as path from 'path';\r\nimport { Import, IPackageJson, PackageJsonLookup } from '@rushstack/node-core-library';\r\n\r\nconst RUSH_LIB_NAME: string = '@microsoft/rush-lib';\r\n\r\ntype RushLibModuleType = Record<string, unknown>;\r\ndeclare const global: NodeJS.Global &\r\n typeof globalThis & {\r\n ___rush___rushLibModule?: RushLibModuleType;\r\n };\r\n\r\n// SCENARIO 1: Rush's PluginManager has initialized \"rush-sdk\" with Rush's own instance of rush-lib.\r\n// The Rush host process will assign \"global.___rush___rushLibModule\" before loading the plugin.\r\nlet rushLibModule: RushLibModuleType | undefined = global.___rush___rushLibModule;\r\n\r\n// SCENARIO 2: The project importing \"rush-sdk\" has installed its own instance of \"rush-lib\"\r\n// as a package.json dependency. For example, this is used by the Jest tests for Rush plugins.\r\nif (rushLibModule === undefined) {\r\n const importingPath: string | undefined = module?.parent?.filename;\r\n if (importingPath !== undefined) {\r\n const callerPackageFolder: string | undefined =\r\n PackageJsonLookup.instance.tryGetPackageFolderFor(importingPath);\r\n\r\n if (callerPackageFolder !== undefined) {\r\n const callerPackageJson: IPackageJson = require(path.join(callerPackageFolder, 'package.json'));\r\n\r\n // Does the caller properly declare a dependency on rush-lib?\r\n if (\r\n (callerPackageJson.dependencies && callerPackageJson.dependencies[RUSH_LIB_NAME] !== undefined) ||\r\n (callerPackageJson.devDependencies &&\r\n callerPackageJson.devDependencies[RUSH_LIB_NAME] !== undefined) ||\r\n (callerPackageJson.peerDependencies &&\r\n callerPackageJson.peerDependencies[RUSH_LIB_NAME] !== undefined)\r\n ) {\r\n // Try to resolve rush-lib from the caller's folder\r\n try {\r\n const rushLibModulePath: string = Import.resolveModule({\r\n modulePath: RUSH_LIB_NAME,\r\n baseFolderPath: callerPackageFolder\r\n });\r\n\r\n rushLibModule = require(rushLibModulePath);\r\n } catch (error) {\r\n // If we fail to resolve it, ignore the error\r\n }\r\n\r\n // If two different libraries invoke `rush-sdk`, and one of them provides \"rush-lib\"\r\n // then the first version to be loaded wins. We do not support side-by-side instances of \"rush-lib\".\r\n if (rushLibModule !== undefined) {\r\n // TODO: When we implement Scenario 3, we should also add some diagnostic state\r\n // to track which scenario is active and how it got initialized.\r\n global.___rush___rushLibModule = rushLibModule;\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n// SCENARIO 3: A tool or script depends on \"rush-sdk\", and is meant to be used inside a monorepo folder.\r\n// In this case, we can use install-run-rush.js to obtain the appropriate rush-lib version for the monorepo.\r\n//\r\n// NOT IMPLEMENTED YET\r\nif (rushLibModule === undefined) {\r\n // This error indicates that a project is trying to import \"@rushstack/rush-sdk\", but the Rush engine\r\n // instance cannot be found. If you are writing Jest tests for a Rush plugin, add \"@microsoft/rush-lib\"\r\n // to the devDependencies for your project.\r\n throw new Error('The \"@rushstack/rush-sdk\" package context has not been initialized.');\r\n}\r\n\r\n// Based on TypeScript's __exportStar()\r\nfor (const property in rushLibModule) {\r\n if (property !== 'default' && !exports.hasOwnProperty(property)) {\r\n const rushLibModuleForClosure: RushLibModuleType = rushLibModule;\r\n\r\n // Based on TypeScript's __createBinding()\r\n Object.defineProperty(exports, property, {\r\n enumerable: true,\r\n get: function () {\r\n return rushLibModuleForClosure[property];\r\n }\r\n });\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,oEAAuF;AAEvF,MAAM,aAAa,GAAW,qBAAqB,CAAC;AAQpD,qGAAqG;AACrG,gGAAgG;AAChG,IAAI,aAAa,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;AACzG,4GAA4G;AAC5G,EAAE;AACF,sBAAsB;AACtB,IAAI,aAAa,KAAK,SAAS,EAAE;IAC/B,qGAAqG;IACrG,wGAAwG;IACxG,2CAA2C;IAC3C,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;CACxF;AAED,uCAAuC;AACvC,KAAK,MAAM,QAAQ,IAAI,aAAa,EAAE;IACpC,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;QAC/D,MAAM,uBAAuB,GAAsB,aAAa,CAAC;QAEjE,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","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, IPackageJson, PackageJsonLookup } from '@rushstack/node-core-library';\n\nconst RUSH_LIB_NAME: string = '@microsoft/rush-lib';\n\ntype RushLibModuleType = Record<string, unknown>;\ndeclare const global: NodeJS.Global &\n typeof globalThis & {\n ___rush___rushLibModule?: RushLibModuleType;\n };\n\n// SCENARIO 1: Rush's PluginManager has initialized \"rush-sdk\" with Rush's own instance of rush-lib.\n// The Rush host process will assign \"global.___rush___rushLibModule\" before loading the plugin.\nlet rushLibModule: RushLibModuleType | undefined = global.___rush___rushLibModule;\n\n// SCENARIO 2: The project importing \"rush-sdk\" has installed its own instance of \"rush-lib\"\n// as a package.json dependency. For example, this is used by the Jest tests for Rush plugins.\nif (rushLibModule === undefined) {\n const importingPath: string | undefined = module?.parent?.filename;\n if (importingPath !== undefined) {\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 try {\n const rushLibModulePath: string = Import.resolveModule({\n modulePath: RUSH_LIB_NAME,\n baseFolderPath: callerPackageFolder\n });\n\n rushLibModule = require(rushLibModulePath);\n } catch (error) {\n // If we fail to resolve it, ignore the error\n }\n\n // If two different libraries invoke `rush-sdk`, and one of them provides \"rush-lib\"\n // then the first version to be loaded wins. We do not support side-by-side instances of \"rush-lib\".\n if (rushLibModule !== undefined) {\n // TODO: When we implement Scenario 3, we should also add some diagnostic state\n // to track which scenario is active and how it got initialized.\n global.___rush___rushLibModule = rushLibModule;\n }\n }\n }\n }\n}\n\n// SCENARIO 3: A 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.\n//\n// NOT IMPLEMENTED YET\nif (rushLibModule === undefined) {\n // This error indicates that a project is trying to import \"@rushstack/rush-sdk\", but the Rush engine\n // instance cannot be found. If you are writing Jest tests for a Rush plugin, add \"@microsoft/rush-lib\"\n // to the devDependencies for your project.\n throw new Error('The \"@rushstack/rush-sdk\" package context has not been initialized.');\n}\n\n// Based on TypeScript's __exportStar()\nfor (const property in rushLibModule) {\n if (property !== 'default' && !exports.hasOwnProperty(property)) {\n const rushLibModuleForClosure: RushLibModuleType = rushLibModule;\n\n // Based on TypeScript's __createBinding()\n Object.defineProperty(exports, property, {\n enumerable: true,\n get: function () {\n return rushLibModuleForClosure[property];\n }\n });\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/rush-sdk",
3
- "version": "5.59.0-rc.0",
3
+ "version": "5.59.1",
4
4
  "description": "An API for interacting with the Rush engine",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,15 +12,15 @@
12
12
  "typings": "dist/rush-lib.d.ts",
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
- "@rushstack/node-core-library": "3.44.3",
15
+ "@rushstack/node-core-library": "3.45.0",
16
16
  "@types/node-fetch": "1.6.9",
17
17
  "tapable": "2.2.1"
18
18
  },
19
19
  "devDependencies": {
20
- "@microsoft/rush-lib": "5.59.0-rc.0",
20
+ "@microsoft/rush-lib": "5.59.1",
21
21
  "@rushstack/eslint-config": "2.5.1",
22
- "@rushstack/heft": "0.44.1",
23
- "@rushstack/heft-node-rig": "1.5.1",
22
+ "@rushstack/heft": "0.44.2",
23
+ "@rushstack/heft-node-rig": "1.5.2",
24
24
  "@types/heft-jest": "1.0.1",
25
25
  "@types/node": "12.20.24",
26
26
  "@types/semver": "7.3.5"