Skip to content

Commit

Permalink
perf: optimize the package graph algorithm (#412)
Browse files Browse the repository at this point in the history
  • Loading branch information
easy1090 authored Jul 4, 2024
1 parent 6392b86 commit ebd276f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/graph/src/graph/package-graph/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,15 @@ export class Package implements SDK.PackageInstance {
}

contain(file: string) {
const subPath = relative(this.root, file);
const ifCotain = file.includes(this.root);

// Non-identical directories.
if (subPath.startsWith('..')) {
if (!ifCotain) {
return false;
}

const subPath = relative(this.root, file);

// Some modules will be in the node_modules of the current module, and another judgment needs to be made here.
return !isPackagePath(subPath);
}
Expand Down

0 comments on commit ebd276f

Please sign in to comment.