Skip to content

Conversation

guybedford
Copy link
Contributor

@guybedford guybedford commented Jul 2, 2025

This reincludes the unrevert of the original PR from #4271 and all of its features, along with the unrevert of the compatibility flag introduced in #4350.

Then to ensure compatibility, instead of exporting undefined named exports for process features when not using the enable_nodejs_process_v2 compatibility flag, two entirely separate process implementations are provided as internal modules - node-internal:public_process for the new implementation and node-internal:legacy_process for the former implementation. Implementation internals are then shared as suitable through the internal process module as well.

Then in the resolver, we detect node:process and process imports and direct those to either node-internal:public_process or node-internal:legacy_process depending on the compat flag. process.getBuiltinModule also has a similar switch logic along with the global getter function for globalThis.process.

Tests are added for the legacy process module to ensure it does not contain unexpected properties. In this way, full compatibility is maintained for all users not using the new process implementation.

New process features remain identical to the original summary in #4271.

Stdio and FS integrations remain pending for removing experimental.

While working on this I noticed the Node.js LTS version already bumped a minor - Claude was able to cook up a script to bump this automatically for us which is also added here as just update-reported-node-version for convenience.

@guybedford guybedford requested review from a team as code owners July 2, 2025 16:49
Copy link

github-actions bot commented Jul 2, 2025

The generated output of @cloudflare/workers-types matches the snapshot in types/generated-snapshot 🎉

@guybedford guybedford force-pushed the gbedford/process-compat-flag-v2 branch from a077341 to 7b8a70b Compare July 2, 2025 17:34
@guybedford guybedford force-pushed the gbedford/process-compat-flag-v2 branch from efe209d to 306b228 Compare July 2, 2025 19:54
@guybedford guybedford changed the title Process Compatibility via Separate Implementation NodeJS Compat: Process Compat via Separate Implementation Jul 2, 2025
@guybedford guybedford requested a review from jasnell July 2, 2025 20:14
@guybedford guybedford force-pushed the gbedford/process-compat-flag-v2 branch 2 times, most recently from 87ea720 to 79a3227 Compare July 2, 2025 23:49
Copy link

codspeed-hq bot commented Jul 3, 2025

CodSpeed Performance Report

Merging #4446 will not alter performance

Comparing gbedford/process-compat-flag-v2 (566b232) with main (0bf8308)

Summary

✅ 10 untouched benchmarks

@guybedford guybedford enabled auto-merge (rebase) July 3, 2025 18:38
@guybedford guybedford disabled auto-merge July 3, 2025 18:38
@guybedford guybedford force-pushed the gbedford/process-compat-flag-v2 branch from 79a3227 to 566b232 Compare July 3, 2025 18:53
@guybedford guybedford enabled auto-merge (squash) July 3, 2025 18:54
@guybedford guybedford merged commit 20e584e into main Jul 3, 2025
21 of 22 checks passed
@guybedford guybedford deleted the gbedford/process-compat-flag-v2 branch July 3, 2025 20:10
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.

3 participants