@nx/devkit 19.4.0-canary.20240615-f431d0a → 19.4.0-canary.20240619-5646b38

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.4.0-canary.20240615-f431d0a",
3
+ "version": "19.4.0-canary.20240619-5646b38",
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.4.0-canary.20240615-f431d0a"
39
+ "@nrwl/devkit": "19.4.0-canary.20240619-5646b38"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "nx": ">= 17 <= 20"
@@ -3,7 +3,7 @@ type PluginOptionsBuilder<T> = (targetName: string) => T;
3
3
  type PostTargetTransformer = (targetConfiguration: TargetConfiguration, tree: Tree, projectDetails: {
4
4
  projectName: string;
5
5
  root: string;
6
- }, inferredTargetConfiguration: TargetConfiguration) => TargetConfiguration;
6
+ }, inferredTargetConfiguration: TargetConfiguration) => TargetConfiguration | Promise<TargetConfiguration>;
7
7
  type SkipTargetFilter = (targetConfiguration: TargetConfiguration) => [boolean, string];
8
8
  export declare function migrateExecutorToPlugin<T>(tree: Tree, projectGraph: ProjectGraph, executor: string, pluginPath: string, pluginOptionsBuilder: PluginOptionsBuilder<T>, postTargetTransformer: PostTargetTransformer, createNodes: CreateNodesV2<T>, specificProjectToMigrate?: string, skipTargetFilter?: SkipTargetFilter): Promise<Map<string, Set<string>>>;
9
9
  export declare function migrateExecutorToPluginV1<T>(tree: Tree, projectGraph: ProjectGraph, executor: string, pluginPath: string, pluginOptionsBuilder: PluginOptionsBuilder<T>, postTargetTransformer: PostTargetTransformer, createNodes: CreateNodes<T>, specificProjectToMigrate?: string, skipTargetFilter?: SkipTargetFilter): Promise<Map<string, Set<string>>>;
@@ -41,7 +41,7 @@ class ExecutorToPluginMigrator {
41
41
  await tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_instances, "m", _ExecutorToPluginMigrator_init).call(this);
42
42
  if (tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_targetAndProjectsToMigrate, "f").size > 0) {
43
43
  for (const targetName of tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_targetAndProjectsToMigrate, "f").keys()) {
44
- tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_instances, "m", _ExecutorToPluginMigrator_migrateTarget).call(this, targetName);
44
+ await tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_instances, "m", _ExecutorToPluginMigrator_migrateTarget).call(this, targetName);
45
45
  }
46
46
  await tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_instances, "m", _ExecutorToPluginMigrator_addPlugins).call(this);
47
47
  }
@@ -58,17 +58,17 @@ _ExecutorToPluginMigrator_projectGraph = new WeakMap(), _ExecutorToPluginMigrato
58
58
  tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_instances, "m", _ExecutorToPluginMigrator_getTargetDefaultsForExecutor).call(this);
59
59
  tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_instances, "m", _ExecutorToPluginMigrator_getTargetAndProjectsToMigrate).call(this);
60
60
  await tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_instances, "m", _ExecutorToPluginMigrator_getCreateNodesResults).call(this);
61
- }, _ExecutorToPluginMigrator_migrateTarget = function _ExecutorToPluginMigrator_migrateTarget(targetName) {
61
+ }, _ExecutorToPluginMigrator_migrateTarget = async function _ExecutorToPluginMigrator_migrateTarget(targetName) {
62
62
  const include = [];
63
63
  for (const projectName of tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_targetAndProjectsToMigrate, "f").get(targetName)) {
64
- include.push(tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_instances, "m", _ExecutorToPluginMigrator_migrateProject).call(this, projectName, targetName));
64
+ include.push(await tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_instances, "m", _ExecutorToPluginMigrator_migrateProject).call(this, projectName, targetName));
65
65
  }
66
66
  tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_pluginToAddForTarget, "f").set(targetName, {
67
67
  plugin: tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_pluginPath, "f"),
68
68
  options: tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_pluginOptionsBuilder, "f").call(this, targetName),
69
69
  include,
70
70
  });
71
- }, _ExecutorToPluginMigrator_migrateProject = function _ExecutorToPluginMigrator_migrateProject(projectName, targetName) {
71
+ }, _ExecutorToPluginMigrator_migrateProject = async function _ExecutorToPluginMigrator_migrateProject(projectName, targetName) {
72
72
  const projectFromGraph = tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_projectGraph, "f").nodes[projectName];
73
73
  const projectConfig = (0, devkit_exports_1.readProjectConfiguration)(this.tree, projectName);
74
74
  const createdTarget = tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_instances, "m", _ExecutorToPluginMigrator_getCreatedTargetForProjectRoot).call(this, targetName, projectFromGraph.data.root);
@@ -79,7 +79,7 @@ _ExecutorToPluginMigrator_projectGraph = new WeakMap(), _ExecutorToPluginMigrato
79
79
  if (projectTarget.inputs && createdTarget.inputs) {
80
80
  tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_instances, "m", _ExecutorToPluginMigrator_mergeInputs).call(this, projectTarget, createdTarget);
81
81
  }
82
- projectTarget = tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_postTargetTransformer, "f").call(this, projectTarget, this.tree, { projectName, root: projectFromGraph.data.root }, createdTarget);
82
+ projectTarget = await tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_postTargetTransformer, "f").call(this, projectTarget, this.tree, { projectName, root: projectFromGraph.data.root }, createdTarget);
83
83
  if (projectTarget.options &&
84
84
  Object.keys(projectTarget.options).length === 0) {
85
85
  delete projectTarget.options;
@@ -1,4 +1,4 @@
1
- import type { TargetConfiguration } from 'nx/src/devkit-exports';
1
+ import { type TargetConfiguration } from 'nx/src/devkit-exports';
2
2
  /**
3
3
  * Iterate through the current target in the project.json and its options comparing it to the target created by the Plugin itself
4
4
  * Delete matching properties from current target.
@@ -60,3 +60,4 @@ export declare function processTargetOutputs(target: TargetConfiguration, rename
60
60
  projectName: string;
61
61
  projectRoot: string;
62
62
  }): void;
63
+ export declare function toProjectRelativePath(path: string, projectRoot: string): string;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processTargetOutputs = exports.deleteMatchingProperties = void 0;
3
+ exports.toProjectRelativePath = exports.processTargetOutputs = exports.deleteMatchingProperties = void 0;
4
+ const posix_1 = require("node:path/posix");
5
+ const devkit_exports_1 = require("nx/src/devkit-exports");
4
6
  const devkit_internals_1 = require("nx/src/devkit-internals");
5
7
  /**
6
8
  * Iterate through the current target in the project.json and its options comparing it to the target created by the Plugin itself
@@ -105,6 +107,16 @@ function processTargetOutputs(target, renamedOutputOptions, inferredTarget, proj
105
107
  target.outputs = targetOutputs;
106
108
  }
107
109
  exports.processTargetOutputs = processTargetOutputs;
110
+ function toProjectRelativePath(path, projectRoot) {
111
+ if (projectRoot === '.') {
112
+ // workspace and project root are the same, we add a leading './' which is
113
+ // required by some tools (e.g. Jest)
114
+ return path.startsWith('.') ? path : `./${path}`;
115
+ }
116
+ const relativePath = (0, posix_1.relative)((0, posix_1.resolve)(devkit_exports_1.workspaceRoot, projectRoot), (0, posix_1.resolve)(devkit_exports_1.workspaceRoot, path));
117
+ return relativePath.startsWith('.') ? relativePath : `./${relativePath}`;
118
+ }
119
+ exports.toProjectRelativePath = toProjectRelativePath;
108
120
  function updateOutputRenamingOption(output, option, previousName) {
109
121
  const newOptionToken = `{options.${option}}`;
110
122
  const oldOptionToken = `{options.${previousName}}`;