@nx/devkit 19.8.0-canary.20240914-dc821ab → 19.8.0-canary.20240918-eb61254

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.8.0-canary.20240914-dc821ab",
3
+ "version": "19.8.0-canary.20240918-eb61254",
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.8.0-canary.20240914-dc821ab"
39
+ "@nrwl/devkit": "19.8.0-canary.20240918-eb61254"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "nx": ">= 17 <= 20"
@@ -38,16 +38,51 @@ async function _addPluginInternal(tree, graph, pluginName, pluginFactory, option
38
38
  const nxJson = (0, devkit_exports_1.readNxJson)(tree);
39
39
  let pluginOptions;
40
40
  let projConfigs;
41
- const combinations = generateCombinations(options);
42
- optionsLoop: for (const _pluginOptions of combinations) {
43
- pluginOptions = _pluginOptions;
44
- nxJson.plugins ??= [];
45
- if (nxJson.plugins.some((p) => typeof p === 'string'
46
- ? p === pluginName
47
- : p.plugin === pluginName && !p.include)) {
48
- // Plugin has already been added
49
- return;
41
+ if (Object.keys(options).length > 0) {
42
+ const combinations = generateCombinations(options);
43
+ optionsLoop: for (const _pluginOptions of combinations) {
44
+ pluginOptions = _pluginOptions;
45
+ nxJson.plugins ??= [];
46
+ if (nxJson.plugins.some((p) => typeof p === 'string'
47
+ ? p === pluginName
48
+ : p.plugin === pluginName && !p.include)) {
49
+ // Plugin has already been added
50
+ return;
51
+ }
52
+ global.NX_GRAPH_CREATION = true;
53
+ try {
54
+ projConfigs = await (0, devkit_internals_1.retrieveProjectConfigurations)([pluginFactory(pluginOptions)], tree.root, nxJson);
55
+ }
56
+ catch (e) {
57
+ // Errors are okay for this because we're only running 1 plugin
58
+ if (e instanceof devkit_internals_1.ProjectConfigurationsError) {
59
+ projConfigs = e.partialProjectConfigurationsResult;
60
+ }
61
+ else {
62
+ throw e;
63
+ }
64
+ }
65
+ global.NX_GRAPH_CREATION = false;
66
+ for (const projConfig of Object.values(projConfigs.projects)) {
67
+ const node = graphNodes.find((node) => node.data.root === projConfig.root);
68
+ if (!node) {
69
+ continue;
70
+ }
71
+ for (const targetName in projConfig.targets) {
72
+ if (node.data.targets[targetName]) {
73
+ // Conflicting Target Name, check the next one
74
+ pluginOptions = null;
75
+ continue optionsLoop;
76
+ }
77
+ }
78
+ }
79
+ break;
50
80
  }
81
+ }
82
+ else {
83
+ // If the plugin does not take in options, we add the plugin with empty options.
84
+ nxJson.plugins ??= [];
85
+ pluginOptions = {};
51
86
  global.NX_GRAPH_CREATION = true;
52
87
  try {
53
88
  projConfigs = await (0, devkit_internals_1.retrieveProjectConfigurations)([pluginFactory(pluginOptions)], tree.root, nxJson);
@@ -62,20 +97,6 @@ async function _addPluginInternal(tree, graph, pluginName, pluginFactory, option
62
97
  }
63
98
  }
64
99
  global.NX_GRAPH_CREATION = false;
65
- for (const projConfig of Object.values(projConfigs.projects)) {
66
- const node = graphNodes.find((node) => node.data.root === projConfig.root);
67
- if (!node) {
68
- continue;
69
- }
70
- for (const targetName in projConfig.targets) {
71
- if (node.data.targets[targetName]) {
72
- // Conflicting Target Name, check the next one
73
- pluginOptions = null;
74
- continue optionsLoop;
75
- }
76
- }
77
- }
78
- break;
79
100
  }
80
101
  if (!pluginOptions) {
81
102
  throw new Error('Could not add the plugin in a way which does not conflict with existing targets. Please report this error at: https://github.com/nrwl/nx/issues/new/choose');
@@ -1,2 +1,2 @@
1
- import { CreateNodesContext } from 'nx/src/devkit-exports';
2
- export declare function calculateHashForCreateNodes(projectRoot: string, options: object, context: CreateNodesContext, additionalGlobs?: string[]): Promise<string>;
1
+ import { CreateNodesContext, CreateNodesContextV2 } from 'nx/src/devkit-exports';
2
+ export declare function calculateHashForCreateNodes(projectRoot: string, options: object, context: CreateNodesContext | CreateNodesContextV2, additionalGlobs?: string[]): Promise<string>;
@@ -1,8 +1,8 @@
1
1
  import type { InputDefinition } from 'nx/src/config/workspace-json-project-json';
2
- import { CreateNodesContext } from 'nx/src/devkit-exports';
2
+ import { CreateNodesContext, CreateNodesContextV2 } from 'nx/src/devkit-exports';
3
3
  /**
4
4
  * Get the named inputs available for a directory
5
5
  */
6
- export declare function getNamedInputs(directory: string, context: CreateNodesContext): {
6
+ export declare function getNamedInputs(directory: string, context: CreateNodesContext | CreateNodesContextV2): {
7
7
  [inputName: string]: (string | InputDefinition)[];
8
8
  };