@nx/devkit 19.2.0-beta.2 → 19.2.0-beta.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/devkit",
3
- "version": "19.2.0-beta.2",
3
+ "version": "19.2.0-beta.4",
4
4
  "private": false,
5
5
  "description": "The Nx Devkit is used to customize Nx for different technologies and use cases. It contains many utility functions for reading and writing files, updating configuration, working with Abstract Syntax Trees(ASTs), and more. Learn more about [extending Nx by leveraging the Nx Devkit](https://nx.dev/extending-nx/intro/getting-started) on our docs.",
6
6
  "repository": {
@@ -36,7 +36,7 @@
36
36
  "semver": "^7.5.3",
37
37
  "yargs-parser": "21.1.1",
38
38
  "minimatch": "9.0.3",
39
- "@nrwl/devkit": "19.2.0-beta.2"
39
+ "@nrwl/devkit": "19.2.0-beta.4"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "nx": ">= 17 <= 20"
@@ -1,7 +1,13 @@
1
- import { CreateNodes, ProjectGraph, Tree } from 'nx/src/devkit-exports';
1
+ import { CreateNodes, CreateNodesV2, ProjectGraph, Tree } from 'nx/src/devkit-exports';
2
2
  /**
3
3
  * Iterates through various forms of plugin options to find the one which does not conflict with the current graph
4
4
 
5
5
  */
6
- export declare function addPlugin<PluginOptions>(tree: Tree, graph: ProjectGraph, pluginName: string, createNodesTuple: CreateNodes<PluginOptions>, options: Partial<Record<keyof PluginOptions, PluginOptions[keyof PluginOptions][]>>, shouldUpdatePackageJsonScripts: boolean): Promise<void>;
6
+ export declare function addPlugin<PluginOptions>(tree: Tree, graph: ProjectGraph, pluginName: string, createNodesTuple: CreateNodesV2<PluginOptions>, options: Partial<Record<keyof PluginOptions, PluginOptions[keyof PluginOptions][]>>, shouldUpdatePackageJsonScripts: boolean): Promise<void>;
7
+ /**
8
+ * @deprecated Use `addPlugin` instead
9
+ * Iterates through various forms of plugin options to find the one which does not conflict with the current graph
10
+
11
+ */
12
+ export declare function addPluginV1<PluginOptions>(tree: Tree, graph: ProjectGraph, pluginName: string, createNodesTuple: CreateNodes<PluginOptions>, options: Partial<Record<keyof PluginOptions, PluginOptions[keyof PluginOptions][]>>, shouldUpdatePackageJsonScripts: boolean): Promise<void>;
7
13
  export declare function generateCombinations<T>(input: Record<string, T[]>): Record<string, T>[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateCombinations = exports.addPlugin = void 0;
3
+ exports.generateCombinations = exports.addPluginV1 = exports.addPlugin = void 0;
4
4
  const yargs = require("yargs-parser");
5
5
  const devkit_exports_1 = require("nx/src/devkit-exports");
6
6
  const devkit_internals_1 = require("nx/src/devkit-internals");
@@ -9,6 +9,31 @@ const devkit_internals_1 = require("nx/src/devkit-internals");
9
9
 
10
10
  */
11
11
  async function addPlugin(tree, graph, pluginName, createNodesTuple, options, shouldUpdatePackageJsonScripts) {
12
+ return _addPluginInternal(tree, graph, pluginName, (pluginOptions) => new devkit_internals_1.LoadedNxPlugin({
13
+ name: pluginName,
14
+ createNodesV2: createNodesTuple,
15
+ }, {
16
+ plugin: pluginName,
17
+ options: pluginOptions,
18
+ }), options, shouldUpdatePackageJsonScripts);
19
+ }
20
+ exports.addPlugin = addPlugin;
21
+ /**
22
+ * @deprecated Use `addPlugin` instead
23
+ * Iterates through various forms of plugin options to find the one which does not conflict with the current graph
24
+
25
+ */
26
+ async function addPluginV1(tree, graph, pluginName, createNodesTuple, options, shouldUpdatePackageJsonScripts) {
27
+ return _addPluginInternal(tree, graph, pluginName, (pluginOptions) => new devkit_internals_1.LoadedNxPlugin({
28
+ name: pluginName,
29
+ createNodes: createNodesTuple,
30
+ }, {
31
+ plugin: pluginName,
32
+ options: pluginOptions,
33
+ }), options, shouldUpdatePackageJsonScripts);
34
+ }
35
+ exports.addPluginV1 = addPluginV1;
36
+ async function _addPluginInternal(tree, graph, pluginName, pluginFactory, options, shouldUpdatePackageJsonScripts) {
12
37
  const graphNodes = Object.values(graph.nodes);
13
38
  const nxJson = (0, devkit_exports_1.readNxJson)(tree);
14
39
  let pluginOptions;
@@ -25,15 +50,7 @@ async function addPlugin(tree, graph, pluginName, createNodesTuple, options, sho
25
50
  }
26
51
  global.NX_GRAPH_CREATION = true;
27
52
  try {
28
- projConfigs = await (0, devkit_internals_1.retrieveProjectConfigurations)([
29
- new devkit_internals_1.LoadedNxPlugin({
30
- name: pluginName,
31
- createNodes: createNodesTuple,
32
- }, {
33
- plugin: pluginName,
34
- options: pluginOptions,
35
- }),
36
- ], tree.root, nxJson);
53
+ projConfigs = await (0, devkit_internals_1.retrieveProjectConfigurations)([pluginFactory(pluginOptions)], tree.root, nxJson);
37
54
  }
38
55
  catch (e) {
39
56
  // Errors are okay for this because we're only running 1 plugin
@@ -72,7 +89,6 @@ async function addPlugin(tree, graph, pluginName, createNodesTuple, options, sho
72
89
  updatePackageScripts(tree, projConfigs);
73
90
  }
74
91
  }
75
- exports.addPlugin = addPlugin;
76
92
  function updatePackageScripts(tree, projectConfigurations) {
77
93
  for (const projectConfig of Object.values(projectConfigurations.projects)) {
78
94
  const projectRoot = projectConfig.root;