Skip to content

Declare process.resourceUsage in the Node Flow environment (#2264) - #2264

Merged
meta-codesync[bot] merged 1 commit into
mainfrom
export-D133521486
Nov 22, 2026
Merged

meta-codesync[bot] merged 1 commit into
mainfrom
export-D133521486

Conversation

@christophpurrer

@christophpurrer christophpurrer commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary:
X-link: react/react-native#60202

Node's process.resourceUsage() (stable since Node 12.6) is missing from the Process declaration, so Flow reports prop-missing for any caller. Declare it with its ResourceUsage record, matching upstream flow-typed.

Changelog: [Internal]

Differential Revision: D133521486

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 21, 2026
@meta-codesync

meta-codesync Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

@christophpurrer has exported this pull request. If you are a Meta employee, you can view the originating Diff in D133521486.

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Metro review: Looks good

Risk: low · Commit: 6646621 · 3 commands run

This PR adds process.resourceUsage() and an inexact process$ResourceUsage record to Metro's Flow Node environment, so callers no longer hit prop-missing. The 16 declared fields are exactly the keys Node returns. A probe file that calls the method fails Flow on the base and passes on the head. It changes types only, with no runtime effect.

No findings.

Verified
  • ✅ yarn flow check (head, with a probe file at packages/metro/src/__review__/ru.js calling process.resourceUsage() and reading maxRSS, userCPUTime and voluntaryContextSwitches as numbers) — No errors!
  • ✅ yarn flow check (base, with the same probe file) (failed as expected) — Cannot call process.resourceUsage because property resourceUsage is missing in Process [prop-missing]
  • ✅ node -e 'console.log(Object.keys(process.resourceUsage()).sort().join(","))' — Prints the same 16 keys the PR declares, no more and no fewer.

Not run: No tests, lint or benchmarks were run. The change is a Flow library definition only, so it has no runtime or performance effect. Windows doesn't matter here.

Automated review by Claude. Advisory only: it never approves or blocks, and a maintainer makes the call.

@yazmoli1990-art yazmoli1990-art left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🥳

@yazmoli1990-art

Copy link
Copy Markdown

🥳

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Nov 21, 2026
Summary:

X-link: react/metro#2264

Node's `process.resourceUsage()` (stable since Node 12.6) is missing from the `Process` declaration, so Flow reports `prop-missing` for any caller. Declare it with its `ResourceUsage` record, matching upstream flow-typed.

Changelog: [Internal]

Differential Revision: D133521486
@meta-codesync meta-codesync Bot changed the title Declare process.resourceUsage in the Node Flow environment Declare process.resourceUsage in the Node Flow environment (#2264) Nov 21, 2026
meta-codesync Bot pushed a commit that referenced this pull request Nov 21, 2026
Summary:
X-link: react/react-native#60202


Node's `process.resourceUsage()` (stable since Node 12.6) is missing from the `Process` declaration, so Flow reports `prop-missing` for any caller. Declare it with its `ResourceUsage` record, matching upstream flow-typed.

Changelog: [Internal]

Differential Revision: D133521486
Summary:
X-link: react/react-native#60202


Node's `process.resourceUsage()` (stable since Node 12.6) is missing from the `Process` declaration, so Flow reports `prop-missing` for any caller. Declare it with its `ResourceUsage` record, matching upstream flow-typed.

Changelog: [Internal]

Differential Revision: D133521486
christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request Nov 21, 2026
Summary:

X-link: react/metro#2264

Node's `process.resourceUsage()` (stable since Node 12.6) is missing from the `Process` declaration, so Flow reports `prop-missing` for any caller. Declare it with its `ResourceUsage` record, matching upstream flow-typed.

Changelog: [Internal]

Differential Revision: D133521486
@meta-codesync
meta-codesync Bot merged commit 136bb79 into main Nov 22, 2026
17 of 18 checks passed
meta-codesync Bot pushed a commit to react/react-native that referenced this pull request Nov 22, 2026
Summary:

X-link: react/metro#2264

Node's `process.resourceUsage()` (stable since Node 12.6) is missing from the `Process` declaration, so Flow reports `prop-missing` for any caller. Declare it with its `ResourceUsage` record, matching upstream flow-typed.

Changelog: [Internal]

Differential Revision: D133521486

Pull Request resolved: #60202
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported needs-meta-import

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants