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

Try to move readPackage to worker thread #4695

Closed

Conversation

william2958
Copy link
Contributor

Summary

Details

How it was tested

Impacted documentation

@@ -26,6 +27,33 @@ let semver: typeof TSemver | undefined;
// once so they aren't repeatedly required in the hook functions.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function init(context: IPnpmfileContext | any): IPnpmfileContext {

if (isMainThread) {
const worker = new Worker(__filename);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Such a worker would go in a separate library whose job is to load and invoke .pnpmfile.cjs files for the purpose of transforming package.json files. The benefit of the worker is to provide an isolated execution environment (for running scripts authored by other parties) that can be cleaned up after the operation completes.

It shouldn't go in PnpmfileShim.ts because that file is (also) loaded by the generated .pnpmfile.cjs, which is a single-threaded and lightweight hook for PNPM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

None yet

2 participants