Align Flow lib defs for Node.js util with v24#55016
Closed
robhogan wants to merge 1 commit into
Closed
Conversation
Summary: This is an AI-assisted change to align the Flow definitions for the `util` module with the Node.js docs as at v24. **New v20-v24 APIs:** 1. **`parseEnv(content)`** - Environment file (.env) parser (added in v20.12.0) - Parses `.env` file content into key-value object - Last value wins for duplicate keys - https://nodejs.org/api/util.html#utilparseenvcontent 2. **`diff(actual, expected)`** - String/array comparison (added in v22.15.0) 🧪 - Uses Myers diff algorithm for comparison - Returns array of tuples: `[operation: -1 | 0 | 1, value: string]` - `-1` = expected only (deletion) - `0` = both (unchanged) - `1` = actual only (insertion) - Experimental API - https://nodejs.org/api/util.html#utildiffactual-expected 3. **`getSystemErrorMessage(err)`** - Error code to message (added in v22.12.0) - Returns the error message string for a numeric error code - https://nodejs.org/api/util.html#utilgetsystemerrormessageerr 4. **`getCallSites([frameCount | options])`** - Call stack capture (added in v22.9.0) - Captures call stack as `CallSiteObject` instances with: - `functionName`, `scriptName`, `scriptId`, `lineNumber`, `columnNumber` - `scriptId` property added in v22.14.0 - https://nodejs.org/api/util.html#utilgetcallsitesframecount 5. **`types.isFloat16Array()`** - Type check for Float16Array (added in v24.0.0) - Checks if value is a Float16Array instance - https://nodejs.org/api/util.html#utiltypesisfloat16arrayvalue **New Classes (v19):** 6. **`MIMEType` class** - MIME type parsing and manipulation (added in v19.1.0, v18.13.0) - Properties: `type`, `subtype`, `essence`, `params` - Methods: `toString()` - Implements MIMEType proposal spec - https://nodejs.org/api/util.html#class-utilmimetype 7. **`MIMEParams` class** - MIME parameters handler (added in v19.1.0, v18.13.0) - Methods: `delete()`, `get()`, `has()`, `set()`, `entries()`, `keys()`, `values()` - https://nodejs.org/api/util.html#class-utilmimeparams **Updated APIs:** 8. **`parseArgs()` - Added `allowNegative` option** (added in v22.4.0) - Allows explicitly setting boolean options to false with `--no-` prefix - Example: `--no-verbose` sets `verbose: false` - https://nodejs.org/api/util.html#utilparseargsconfig **Type Safety Improvements:** 9. **Exact-by-default syntax** - Simplified object types - Changed `{|...|}` `{}` in parseArgs types (Flow configured with exact-by-default) - Changed default generic types from `{||}` → `{}` 10. **styleText()** already present with full type definitions - 18 foreground colors, 18 background colors, 12 modifiers - https://nodejs.org/api/util.html#utilstyletextformat-text **References:** - Node.js util module docs: https://nodejs.org/api/util.html - MIMEType proposal: https://bmeck.github.io/node-proposal-mime-api/ Changelog: [Internal] --- > Generated by [Confucius Code Assist (CCA)](https://www.internalfb.com/wiki/Confucius/Analect/Shared_Analects/Confucius_Code_Assist_(CCA)/) [Confucius Session](https://www.internalfb.com/confucius?host=devvm45708.cln0.facebook.com&port=8086&tab=Chat&session_id=1a3aa26e-e5a9-11f0-8d47-71a4a90f0494&entry_name=Code+Assist), [Trace](https://www.internalfb.com/confucius?session_id=1a3aa26e-e5a9-11f0-8d47-71a4a90f0494&tab=Trace) Reviewed By: vzaidman Differential Revision: D89942136
meta-codesync Bot
pushed a commit
to react/metro
that referenced
this pull request
Jan 2, 2026
Summary: X-link: react/react-native#55016 This is an AI-assisted change to align the Flow definitions for the `util` module with the Node.js docs as at v24. **New v20-v24 APIs:** 1. **`parseEnv(content)`** - Environment file (.env) parser (added in v20.12.0) - Parses `.env` file content into key-value object - Last value wins for duplicate keys - https://nodejs.org/api/util.html#utilparseenvcontent 2. **`diff(actual, expected)`** - String/array comparison (added in v22.15.0) 🧪 - Uses Myers diff algorithm for comparison - Returns array of tuples: `[operation: -1 | 0 | 1, value: string]` - `-1` = expected only (deletion) - `0` = both (unchanged) - `1` = actual only (insertion) - Experimental API - https://nodejs.org/api/util.html#utildiffactual-expected 3. **`getSystemErrorMessage(err)`** - Error code to message (added in v22.12.0) - Returns the error message string for a numeric error code - https://nodejs.org/api/util.html#utilgetsystemerrormessageerr 4. **`getCallSites([frameCount | options])`** - Call stack capture (added in v22.9.0) - Captures call stack as `CallSiteObject` instances with: - `functionName`, `scriptName`, `scriptId`, `lineNumber`, `columnNumber` - `scriptId` property added in v22.14.0 - https://nodejs.org/api/util.html#utilgetcallsitesframecount 5. **`types.isFloat16Array()`** - Type check for Float16Array (added in v24.0.0) - Checks if value is a Float16Array instance - https://nodejs.org/api/util.html#utiltypesisfloat16arrayvalue **New Classes (v19):** 6. **`MIMEType` class** - MIME type parsing and manipulation (added in v19.1.0, v18.13.0) - Properties: `type`, `subtype`, `essence`, `params` - Methods: `toString()` - Implements MIMEType proposal spec - https://nodejs.org/api/util.html#class-utilmimetype 7. **`MIMEParams` class** - MIME parameters handler (added in v19.1.0, v18.13.0) - Methods: `delete()`, `get()`, `has()`, `set()`, `entries()`, `keys()`, `values()` - https://nodejs.org/api/util.html#class-utilmimeparams **Updated APIs:** 8. **`parseArgs()` - Added `allowNegative` option** (added in v22.4.0) - Allows explicitly setting boolean options to false with `--no-` prefix - Example: `--no-verbose` sets `verbose: false` - https://nodejs.org/api/util.html#utilparseargsconfig **Type Safety Improvements:** 9. **Exact-by-default syntax** - Simplified object types - Changed `{|...|}` `{}` in parseArgs types (Flow configured with exact-by-default) - Changed default generic types from `{||}` → `{}` 10. **styleText()** already present with full type definitions - 18 foreground colors, 18 background colors, 12 modifiers - https://nodejs.org/api/util.html#utilstyletextformat-text **References:** - Node.js util module docs: https://nodejs.org/api/util.html - MIMEType proposal: https://bmeck.github.io/node-proposal-mime-api/ Changelog: [Internal] --- > Generated by [Confucius Code Assist (CCA)](https://www.internalfb.com/wiki/Confucius/Analect/Shared_Analects/Confucius_Code_Assist_(CCA)/) [Confucius Session](https://www.internalfb.com/confucius?host=devvm45708.cln0.facebook.com&port=8086&tab=Chat&session_id=1a3aa26e-e5a9-11f0-8d47-71a4a90f0494&entry_name=Code+Assist), [Trace](https://www.internalfb.com/confucius?session_id=1a3aa26e-e5a9-11f0-8d47-71a4a90f0494&tab=Trace) Reviewed By: vzaidman Differential Revision: D89942136 fbshipit-source-id: c26d6c6a8003a30b50443020b06228ce2a012838
|
This pull request has been merged in f5c1126. |
Collaborator
|
This pull request was successfully merged by @robhogan in f5c1126 When will my fix make it into a release? | How to file a pick request? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
This is an AI-assisted change to align the Flow definitions for the
utilmodule with the Node.js docs as at v24.New v20-v24 APIs:
parseEnv(content)- Environment file (.env) parser (added in v20.12.0).envfile content into key-value objectdiff(actual, expected)- String/array comparison (added in v22.15.0) 🧪[operation: -1 | 0 | 1, value: string]-1= expected only (deletion)0= both (unchanged)1= actual only (insertion)getSystemErrorMessage(err)- Error code to message (added in v22.12.0)getCallSites([frameCount | options])- Call stack capture (added in v22.9.0)CallSiteObjectinstances with:functionName,scriptName,scriptId,lineNumber,columnNumberscriptIdproperty added in v22.14.0types.isFloat16Array()- Type check for Float16Array (added in v24.0.0)New Classes (v19):
MIMETypeclass - MIME type parsing and manipulation (added in v19.1.0, v18.13.0)type,subtype,essence,paramstoString()MIMEParamsclass - MIME parameters handler (added in v19.1.0, v18.13.0)delete(),get(),has(),set(),entries(),keys(),values()Updated APIs:
parseArgs()- AddedallowNegativeoption (added in v22.4.0)--no-prefix--no-verbosesetsverbose: falseType Safety Improvements:
Exact-by-default syntax - Simplified object types
{|...|}{}in parseArgs types (Flow configured with exact-by-default){||}→{}styleText() already present with full type definitions
References:
Changelog: [Internal]
Reviewed By: vzaidman
Differential Revision: D89942136