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

caching NodeModule.path and NodeModule.maxVersionInSameMajor getters #126

Merged
merged 1 commit into from
Aug 14, 2023

Conversation

SukkaW
Copy link
Contributor

@SukkaW SukkaW commented Aug 12, 2023

The path getter has 8 references, and the maxVersionInSameMajor getter has 3 references:

image image

The PR prevents path.join and semverMaxSatisfying from being called multiple times by caching the return value.

@@ -152,7 +152,7 @@ export default class Workspace {
}
}

return this._isPnpm!;
return this._isPnpm;
Copy link
Contributor Author

@SukkaW SukkaW Aug 12, 2023

Choose a reason for hiding this comment

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

The non-null assertion here is no longer needed. The typescript can identify that the this._isPnpm here can not be null.

Copy link
Owner

@ranyitz ranyitz left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

@ranyitz ranyitz merged commit 7e45df7 into ranyitz:master Aug 14, 2023
10 checks passed
@ranyitz
Copy link
Owner

ranyitz commented Aug 14, 2023

Available from [email protected]

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.

2 participants