Skip to content

Commit

Permalink
fix(core): cleanup task hasher
Browse files Browse the repository at this point in the history
  • Loading branch information
meeroslav authored and vsavkin committed May 25, 2023
1 parent 42ffa7c commit a9f1d3a
Showing 1 changed file with 16 additions and 23 deletions.
39 changes: 16 additions & 23 deletions packages/nx/src/hasher/task-hasher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { DaemonClient } from '../daemon/client/client';
import { FileHasher } from './impl/file-hasher-base';
import { hashArray } from './impl';
import { createProjectRootMappings } from '../project-graph/utils/find-project-for-path';
import { registerPluginTSTranspiler } from '../utils/nx-plugin';

type ExpandedSelfInput =
| { fileset: string }
Expand Down Expand Up @@ -180,15 +181,6 @@ class TaskHasherImpl {
async hashTask(task: Task, visited: string[]): Promise<PartialHash> {
return Promise.resolve().then(async () => {
const projectNode = this.projectGraph.nodes[task.target.project];
if (!projectNode) {
const hash = this.hashExternalDependency(task.target.project);
return {
value: hash,
details: {
[task.target.project]: hash,
},
};
}
const namedInputs = getNamedInputs(this.nxJson, projectNode);
const targetData = projectNode.data.targets[task.target.target];
const targetDefaults = (this.nxJson.targetDefaults || {})[
Expand Down Expand Up @@ -231,15 +223,6 @@ class TaskHasherImpl {
visited: string[]
): Promise<PartialHash> {
const projectNode = this.projectGraph.nodes[projectName];
if (!projectNode) {
const hash = this.hashExternalDependency(projectName);
return {
value: hash,
details: {
[projectName]: hash,
},
};
}
const namedInputs = {
default: [{ fileset: '{projectRoot}/**/*' }],
...this.nxJson.namedInputs,
Expand Down Expand Up @@ -310,11 +293,21 @@ class TaskHasherImpl {
return null;
} else {
visited.push(d.target);
return await this.hashNamedInputForDependencies(
d.target,
input.input || 'default',
visited
);
if (this.projectGraph.nodes[d.target]) {
return await this.hashNamedInputForDependencies(
d.target,
input.input || 'default',
visited
);
} else {
const hash = this.hashExternalDependency(d.target);
return {
value: hash,
details: {
[d.target]: hash,
},
};
}
}
})
);
Expand Down

1 comment on commit a9f1d3a

@vercel
Copy link

@vercel vercel bot commented on a9f1d3a May 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-dev-nrwl.vercel.app
nx-five.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx.dev

Please sign in to comment.