Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(resolve-dependencies): optimize splitNodeId, fix invalid nodeId #6755

Merged
merged 1 commit into from
Jul 3, 2023

Conversation

zxbodya
Copy link
Contributor

@zxbodya zxbodya commented Jul 3, 2023

Fix to avoid creating invalid nodeId, small optimization

@zxbodya zxbodya requested a review from zkochan as a code owner July 3, 2023 11:42
? pkgResponse.body.id
? `>${depPath}>`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was resulting in having splitNodeId called with nodeId not having > around it, which became noticeable with the change above

@@ -18,5 +18,5 @@ export function createNodeId (parentNodeId: string, pkgId: string) {
}

export function splitNodeId (nodeId: string) {
return nodeId.slice(1, -1).split('>')
return nodeId.split('>').slice(1, -1)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

having a slice after splitting the string, allows copying less data, making the dependency resolution a few seconds faster on a large monorepo

@zkochan zkochan merged commit abdb77f into pnpm:main Jul 3, 2023
7 of 8 checks passed
@zxbodya zxbodya deleted the fix-splitNodeId branch July 3, 2023 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants