@nx/devkit 19.0.0-canary.20240430-458f2cc → 19.0.0-canary.20240502-5ded713

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 (53) hide show
  1. package/package.json +3 -3
  2. package/src/executors/parse-target-string.d.ts +1 -3
  3. package/src/executors/parse-target-string.js +5 -9
  4. package/src/executors/read-target-options.d.ts +1 -2
  5. package/src/executors/read-target-options.js +4 -17
  6. package/src/generators/add-build-target-defaults.d.ts +1 -1
  7. package/src/generators/add-build-target-defaults.js +3 -4
  8. package/src/generators/artifact-name-and-directory-utils.d.ts +1 -1
  9. package/src/generators/artifact-name-and-directory-utils.js +24 -24
  10. package/src/generators/executor-options-utils.d.ts +1 -2
  11. package/src/generators/executor-options-utils.js +2 -3
  12. package/src/generators/format-files.d.ts +1 -1
  13. package/src/generators/format-files.js +5 -8
  14. package/src/generators/generate-files.d.ts +1 -1
  15. package/src/generators/generate-files.js +2 -3
  16. package/src/generators/plugin-migrations/executor-to-plugin-migrator.d.ts +2 -5
  17. package/src/generators/plugin-migrations/executor-to-plugin-migrator.js +11 -11
  18. package/src/generators/project-name-and-root-utils.d.ts +1 -2
  19. package/src/generators/project-name-and-root-utils.js +16 -17
  20. package/src/generators/run-tasks-in-serial.d.ts +1 -1
  21. package/src/generators/to-js.d.ts +1 -1
  22. package/src/generators/update-ts-configs-to-js.d.ts +1 -1
  23. package/src/generators/update-ts-configs-to-js.js +3 -4
  24. package/src/generators/visit-not-ignored-files.d.ts +1 -1
  25. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +1 -1
  26. package/src/migrations/update-16-9-0/migrate-mf-util-usage.d.ts +1 -2
  27. package/src/migrations/update-16-9-0/migrate-mf-util-usage.js +2 -3
  28. package/src/tasks/install-packages-task.d.ts +1 -2
  29. package/src/tasks/install-packages-task.js +5 -6
  30. package/src/utils/add-plugin.d.ts +1 -1
  31. package/src/utils/add-plugin.js +9 -9
  32. package/src/utils/calculate-hash-for-create-nodes.d.ts +1 -1
  33. package/src/utils/calculate-hash-for-create-nodes.js +5 -5
  34. package/src/utils/config-utils.js +5 -5
  35. package/src/utils/convert-nx-executor.d.ts +1 -1
  36. package/src/utils/convert-nx-executor.js +19 -29
  37. package/src/utils/get-named-inputs.d.ts +1 -1
  38. package/src/utils/get-named-inputs.js +3 -4
  39. package/src/utils/get-workspace-layout.d.ts +1 -1
  40. package/src/utils/get-workspace-layout.js +2 -3
  41. package/src/utils/invoke-nx-generator.d.ts +1 -1
  42. package/src/utils/invoke-nx-generator.js +3 -5
  43. package/src/utils/log-show-project-command.js +2 -3
  44. package/src/utils/move-dir.d.ts +1 -1
  45. package/src/utils/move-dir.js +3 -4
  46. package/src/utils/package-json.d.ts +1 -2
  47. package/src/utils/package-json.js +13 -13
  48. package/src/utils/replace-package.d.ts +1 -1
  49. package/src/utils/replace-package.js +7 -9
  50. package/src/utils/replace-project-configuration-with-plugin.d.ts +1 -1
  51. package/src/utils/replace-project-configuration-with-plugin.js +11 -11
  52. package/nx.d.ts +0 -1
  53. package/nx.js +0 -19
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.replaceNrwlPackageWithNxPackage = void 0;
4
- const nx_1 = require("../../nx");
4
+ const devkit_exports_1 = require("nx/src/devkit-exports");
5
5
  const visit_not_ignored_files_1 = require("../generators/visit-not-ignored-files");
6
6
  const path_1 = require("path");
7
7
  const binary_extensions_1 = require("./binary-extensions");
8
- const { logger } = (0, nx_1.requireNx)();
9
- const { getProjects, updateProjectConfiguration, readNxJson, updateNxJson, updateJson, } = (0, nx_1.requireNx)();
10
8
  function replaceNrwlPackageWithNxPackage(tree, oldPackageName, newPackageName) {
11
9
  replacePackageInDependencies(tree, oldPackageName, newPackageName);
12
10
  replacePackageInProjectConfigurations(tree, oldPackageName, newPackageName);
@@ -20,7 +18,7 @@ function replacePackageInDependencies(tree, oldPackageName, newPackageName) {
20
18
  return;
21
19
  }
22
20
  try {
23
- updateJson(tree, path, (packageJson) => {
21
+ (0, devkit_exports_1.updateJson)(tree, path, (packageJson) => {
24
22
  for (const deps of [
25
23
  packageJson.dependencies ?? {},
26
24
  packageJson.devDependencies ?? {},
@@ -41,7 +39,7 @@ function replacePackageInDependencies(tree, oldPackageName, newPackageName) {
41
39
  });
42
40
  }
43
41
  function replacePackageInProjectConfigurations(tree, oldPackageName, newPackageName) {
44
- const projects = getProjects(tree);
42
+ const projects = (0, devkit_exports_1.getProjects)(tree);
45
43
  for (const [projectName, projectConfiguration] of projects) {
46
44
  let needsUpdate = false;
47
45
  for (const [targetName, targetConfig] of Object.entries(projectConfiguration.targets ?? {})) {
@@ -63,7 +61,7 @@ function replacePackageInProjectConfigurations(tree, oldPackageName, newPackageN
63
61
  }
64
62
  }
65
63
  if (needsUpdate) {
66
- updateProjectConfiguration(tree, projectName, projectConfiguration);
64
+ (0, devkit_exports_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
67
65
  }
68
66
  }
69
67
  }
@@ -71,7 +69,7 @@ function replacePackageInNxJson(tree, oldPackageName, newPackageName) {
71
69
  if (!tree.exists('nx.json')) {
72
70
  return;
73
71
  }
74
- const nxJson = readNxJson(tree);
72
+ const nxJson = (0, devkit_exports_1.readNxJson)(tree);
75
73
  let needsUpdate = false;
76
74
  for (const [targetName, targetConfig] of Object.entries(nxJson.targetDefaults ?? {})) {
77
75
  if (!targetConfig.executor) {
@@ -92,7 +90,7 @@ function replacePackageInNxJson(tree, oldPackageName, newPackageName) {
92
90
  }
93
91
  }
94
92
  if (needsUpdate) {
95
- updateNxJson(tree, nxJson);
93
+ (0, devkit_exports_1.updateNxJson)(tree, nxJson);
96
94
  }
97
95
  }
98
96
  function replaceMentions(tree, oldPackageName, newPackageName) {
@@ -119,7 +117,7 @@ function replaceMentions(tree, oldPackageName, newPackageName) {
119
117
  catch {
120
118
  // Its **probably** ok, contents can be null if the file is too large or
121
119
  // there was an access exception.
122
- logger.warn(`An error was thrown when trying to update ${path}. If you believe the migration should have updated it, be sure to review the file and open an issue.`);
120
+ devkit_exports_1.logger.warn(`An error was thrown when trying to update ${path}. If you believe the migration should have updated it, be sure to review the file and open an issue.`);
123
121
  }
124
122
  });
125
123
  }
@@ -1,2 +1,2 @@
1
- import type { Tree, CreateNodes } from 'nx/src/devkit-exports';
1
+ import { CreateNodes, Tree } from 'nx/src/devkit-exports';
2
2
  export declare function replaceProjectConfigurationsWithPlugin<T = unknown>(tree: Tree, rootMappings: Map<string, string>, pluginPath: string, createNodes: CreateNodes<T>, pluginOptions: T): Promise<void>;
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.replaceProjectConfigurationsWithPlugin = void 0;
4
- const nx_1 = require("../../nx");
5
- const { readNxJson, updateNxJson, glob, hashObject, findProjectForPath, readProjectConfiguration, updateProjectConfiguration, } = (0, nx_1.requireNx)();
4
+ const devkit_exports_1 = require("nx/src/devkit-exports");
5
+ const devkit_internals_1 = require("nx/src/devkit-internals");
6
6
  async function replaceProjectConfigurationsWithPlugin(tree, rootMappings, pluginPath, createNodes, pluginOptions) {
7
- const nxJson = readNxJson(tree);
7
+ const nxJson = (0, devkit_exports_1.readNxJson)(tree);
8
8
  const hasPlugin = nxJson.plugins?.some((p) => typeof p === 'string' ? p === pluginPath : p.plugin === pluginPath);
9
9
  if (hasPlugin) {
10
10
  return;
@@ -14,16 +14,16 @@ async function replaceProjectConfigurationsWithPlugin(tree, rootMappings, plugin
14
14
  plugin: pluginPath,
15
15
  options: pluginOptions,
16
16
  });
17
- updateNxJson(tree, nxJson);
17
+ (0, devkit_exports_1.updateNxJson)(tree, nxJson);
18
18
  const [pluginGlob, createNodesFunction] = createNodes;
19
- const configFiles = glob(tree, [pluginGlob]);
19
+ const configFiles = (0, devkit_exports_1.glob)(tree, [pluginGlob]);
20
20
  for (const configFile of configFiles) {
21
21
  try {
22
- const projectName = findProjectForPath(configFile, rootMappings);
23
- const projectConfig = readProjectConfiguration(tree, projectName);
22
+ const projectName = (0, devkit_internals_1.findProjectForPath)(configFile, rootMappings);
23
+ const projectConfig = (0, devkit_exports_1.readProjectConfiguration)(tree, projectName);
24
24
  const nodes = await createNodesFunction(configFile, pluginOptions, {
25
25
  workspaceRoot: tree.root,
26
- nxJsonConfiguration: readNxJson(tree),
26
+ nxJsonConfiguration: (0, devkit_exports_1.readNxJson)(tree),
27
27
  configFiles,
28
28
  });
29
29
  const node = nodes.projects[Object.keys(nodes.projects)[0]];
@@ -35,7 +35,7 @@ async function replaceProjectConfigurationsWithPlugin(tree, rootMappings, plugin
35
35
  const targetFromCreateNodes = node.targets[targetName];
36
36
  removeConfigurationDefinedByPlugin(targetName, targetFromProjectConfig, targetFromCreateNodes, projectConfig);
37
37
  }
38
- updateProjectConfiguration(tree, projectName, projectConfig);
38
+ (0, devkit_exports_1.updateProjectConfiguration)(tree, projectName, projectConfig);
39
39
  }
40
40
  catch (e) {
41
41
  console.error(e);
@@ -103,7 +103,7 @@ function equals(a, b) {
103
103
  return a.length === b.length && a.every((v, i) => v === b[i]);
104
104
  }
105
105
  if (typeof a === 'object' && typeof b === 'object') {
106
- return hashObject(a) === hashObject(b);
106
+ return (0, devkit_internals_1.hashObject)(a) === (0, devkit_internals_1.hashObject)(b);
107
107
  }
108
108
  return a === b;
109
109
  }
@@ -122,7 +122,7 @@ function shouldRemoveArrayProperty(arrayValuesFromProjectConfiguration, arrayVal
122
122
  else {
123
123
  for (const arrayValue of setOfArrayValuesFromProjectConfiguration.values()) {
124
124
  if (typeof arrayValue !== 'string' &&
125
- hashObject(arrayValue) === hashObject(arrayValueFromCreateNodes)) {
125
+ (0, devkit_internals_1.hashObject)(arrayValue) === (0, devkit_internals_1.hashObject)(arrayValueFromCreateNodes)) {
126
126
  setOfArrayValuesFromProjectConfiguration.delete(arrayValue);
127
127
  // Continue the outer loop, breaking out of this loop
128
128
  continue loopThroughArrayValuesFromCreateNodes;
package/nx.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare function requireNx(): typeof import('nx/src/devkit-exports') & Partial<typeof import('nx/src/devkit-internals')>;
package/nx.js DELETED
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.requireNx = void 0;
4
- // After Nx v19, this can be removed and replaced with either:
5
- // - import {} from 'nx/src/devkit-exports'
6
- // - import {} from 'nx/src/devkit-internals'
7
- function requireNx() {
8
- let result = { ...require('nx/src/devkit-exports') };
9
- try {
10
- result = {
11
- ...result,
12
- // Remove in Nx v19, devkit should not support Nx v16.0.2 at that point.
13
- ...require('nx/src/devkit-internals'),
14
- };
15
- }
16
- catch { }
17
- return result;
18
- }
19
- exports.requireNx = requireNx;