mirror of
https://github.com/react/react-native.git
synced 2026-09-28 05:13:06 +08:00
main
37
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5880e42ce8 |
Deploy 0.333.0 to xplat
Summary: [changelog](https://github.com/facebook/flow/blob/main/Changelog.md) Changelog: [Internal] Reviewed By: gkz Differential Revision: D121669551 fbshipit-source-id: cb1baae809941e0c970bfe80209db284623fade0 |
||
|
|
e47416c73c |
Deploy 0.329.0 to xplat (#58082)
Summary: Pull Request resolved: https://github.com/react/react-native/pull/58082 [changelog](https://github.com/facebook/flow/blob/main/Changelog.md) Changelog: [Internal] Reviewed By: SamChou19815 Differential Revision: D117138586 fbshipit-source-id: 8b0ca9349cf2ec9e7f94f447e8d9774416886adf |
||
|
|
e64027865e |
Flow: Add node: aliases to Node.js libdefs (#57600)
Summary: Pull Request resolved: https://github.com/react/react-native/pull/57600 X-link: https://github.com/react/metro/pull/1783 Add `node:` aliases for every bare Node.js builtin declared by RN/Metro’s Flow libdefs. The aliases re-export the existing module types, so prefixed and unprefixed imports have the same definitions. Changelog: [Internal] Reviewed By: huntie Differential Revision: D112732329 fbshipit-source-id: f38a6db58b6b3fbcbe566627ff368a2f329c9651 |
||
|
|
a016e94b59 |
Redo D111190630: Stop using prettier-plugin-hermes-parser for formatting (#57537)
Summary: Pull Request resolved: https://github.com/react/react-native/pull/57537 Changelog: [Internal] Reviewed By: gkz Differential Revision: D111829105 fbshipit-source-id: 3309a22e737f68aca2d8d19f49e56bad955e5377 |
||
|
|
65af886291 |
Revert D111190630: Stop using prettier-plugin-hermes-parser for formatting
Differential Revision: D111190630 Original commit changeset: e7ed7ee6f057 Original Phabricator Diff: D111190630 fbshipit-source-id: 49e33587fa084c181d64d35ac6bcf6ab73edfa5f |
||
|
|
2235b8ec3f |
Stop using prettier-plugin-hermes-parser for formatting (#57505)
Summary: Pull Request resolved: https://github.com/react/react-native/pull/57505 Changelog: [Internal] Reviewed By: gkz Differential Revision: D111190630 fbshipit-source-id: e7ed7ee6f05701fbdaad1c8fad58c47f48344487 |
||
|
|
402001fa50 |
Add missing stream state properties to Flow defs (#56224)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/56224 Add standard Node.js stream properties to the Flow type definitions for `stream$Readable` and `stream$Writable` that were previously missing: - `stream$Readable`: - [`closed: boolean`](https://nodejs.org/api/stream.html#readableclosed) - [`destroyed: boolean`](https://nodejs.org/api/stream.html#readabledestroyed) - [`errored: ?Error`](https://nodejs.org/api/stream.html#readableerrored) - [`readableEnded: boolean`](https://nodejs.org/api/stream.html#readablereadableended) - [`readableAborted: boolean`](https://nodejs.org/api/stream.html#readablereadableaborted) - [`readableDidRead: boolean`](https://nodejs.org/api/stream.html#readablereadabledidread) - [`readableFlowing: ?boolean`](https://nodejs.org/api/stream.html#readablereadableflowing) - [`readableObjectMode: boolean`](https://nodejs.org/api/stream.html#readablereadableobjectmode) - `stream$Writable`: - [`closed: boolean`](https://nodejs.org/api/stream.html#writableclosed) - [`destroyed: boolean`](https://nodejs.org/api/stream.html#writabledestroyed) - [`errored: ?Error`](https://nodejs.org/api/stream.html#writableerrored) - [`writableEnded: boolean`](https://nodejs.org/api/stream.html#writablewritableended) - [`writableAborted: boolean`](https://nodejs.org/api/stream.html#writablewritableaborted) - [`writableFinished: boolean`](https://nodejs.org/api/stream.html#writablewritablefinished) - [`writableNeedDrain: boolean`](https://nodejs.org/api/stream.html#writablewritableneeddrain) - [`writableObjectMode: boolean`](https://nodejs.org/api/stream.html#writablewritableobjectmode) Docs: https://nodejs.org/api/stream.html These properties exist on all Node.js streams and are needed by Metro to detect when HTTP response streams have been closed by a client disconnect. Changelog: [Internal] Reviewed By: christophpurrer Differential Revision: D98176491 fbshipit-source-id: 2407367c52e5ece9099289ffd18642bdc4a7047d |
||
|
|
53cd9cec15 |
transformTypeParamBound codemod 9/9 (#55948)
Summary: X-link: https://github.com/facebook/metro/pull/1665 Pull Request resolved: https://github.com/facebook/react-native/pull/55948 js1 flow-runner codemod flow/transformTypeParamBound --format-files=false xplat/js Changelog: [Internal] Reviewed By: SamChou19815 Differential Revision: D95429551 fbshipit-source-id: 6f5694fed74364c6f1c58e28376c86eae6201366 |
||
|
|
67ba6a2087 |
Flow types for Node createServer APIs (#55462)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55462 Node.js `createServer` options for the `net`, `tls`, `http` and `https` modules are currently unclearly typed as just `Object`. This adds full typing for all options as of Node.js 24. Changelog: [Internal] Reviewed By: vzaidman Differential Revision: D92393810 fbshipit-source-id: e02aee5d86ee0b1b27320b5055ebc782507e70e1 |
||
|
|
3d0aa9fa8d |
Add Flow lib defs for node:sqlite (#55284)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55284 This diff adds Flow type definitions for the `node:sqlite` module, Node.js's built-in SQLite database interface added experimentally in v22.5.0. **Module Overview:** The `node:sqlite` module provides synchronous SQLite database operations, enabling embedded database functionality without external dependencies. **Core Classes:** 1. **DatabaseSync** - Main database interface - `constructor(location: string, options?: DatabaseSyncOptions)` - `exec(sql: string)` - Execute SQL without returning results - `prepare(sql: string)` - Create prepared statement - `close()` / `open()` - Manage connection lifecycle - `function()` - Register custom SQL functions - `createSession()` / `applyChangeset()` - Session/changeset support - https://nodejs.org/api/sqlite.html#class-databasesync 2. **StatementSync** - Prepared statement interface - `all(...params)` - Return all rows as array - `get(...params)` - Return first row - `run(...params)` - Execute and return changes/lastInsertRowid - `iterate(...params)` - Return iterator over rows - `expandedSQL` / `sourceSQL` - SQL inspection - https://nodejs.org/api/sqlite.html#class-statementsync 3. **Session** - Change tracking interface - `changeset()` - Get changes as Uint8Array - `patchset()` - Get minimal changes - `close()` - End session **References:** - Node.js sqlite module documentation: https://nodejs.org/api/sqlite.html **Stability:** Experimental (added in v22.5.0) Changelog: [Internal] Reviewed By: GijsWeterings Differential Revision: D90764441 fbshipit-source-id: 9bce1e13bf8d550211c62d7d5cde255854379363 |
||
|
|
09adea9dcd |
Align Flow lib defs for Node.js v8 module with v24 (#55225)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55225 This is an AI-assisted change to align the Flow definitions for the `v8` module with the Node.js docs as at v24. **New v18+ Features:** 1. **Heap Snapshot Near Limit** (v18.10.0) - Automatic snapshot generation - Added `setHeapSnapshotNearHeapLimit(limit: number): void` function - Generates heap snapshots automatically when heap usage reaches specified limit - Useful for debugging memory issues and OOM scenarios - https://nodejs.org/api/v8.html#v8setheapsnapshotnearhea plimit 2. **GCProfiler Class** (v19.6.0, v18.15.0) - Garbage collection profiling - Added `GCProfiler` class for detailed GC statistics collection - `start()` method begins profiling session - `stop()` method returns `GCProfilerResult` with detailed statistics - Includes before/after heap statistics for each GC event - https://nodejs.org/api/v8.html#class-v8gcprofiler **New v20+ Features:** 3. **Query Objects** (v20.13.0) - Object instance tracking - Added `queryObjects(ctor, options?)` function with two overloads - Similar to Chrome DevTools console API - Searches for objects matching a constructor on prototype chain - Two formats: `'count'` (returns number) or `'summary'` (returns string array) - Useful for memory leak regression tests - https://nodejs.org/api/v8.html#v8queryobjectsctor-options **New v22+ Features:** 4. **C++ Heap Statistics** (v22.15.0) - cppgc heap monitoring - Added `getCppHeapStatistics(detailLevel?)` function - Returns C++ heap statistics from cppgc - Two detail levels: `'brief'` (top-level stats) or `'detailed'` (includes space/page breakdown) - https://nodejs.org/api/v8.html#v8getcppheapstatisticsdetaillevel 5. **String Representation Check** (v23.10.0, backported to v22.15.0) - Added `isStringOneByteRepresentation(content: string): boolean` function - Checks if string uses Latin-1/ISO-8859-1 encoding (single byte per character) - Useful for optimizing string serialization - https://nodejs.org/api/v8.html#v8isstringonebyterepresentationvalue **Type System Improvements:** 6. **Complete Type Definitions** - Added missing fields and proper types: - `DoesZapCodeSpaceFlag` type alias (0 | 1) for `does_zap_garbage` - `HeapCodeStatistics` - Added `cpu_profiler_metadata_size` field - `HeapInfo` (renamed from `HeapStatistics`) - Added 3 missing fields: - `total_global_handles_size` (v13.3.0) - `used_global_handles_size` (v13.3.0) - `external_memory` (v13.3.0) - `HeapSpaceInfo` (renamed from `HeapSpaceStatistics`) - Removed spread operator - `HeapSnapshotOptions` (new) - Options for heap snapshot generation: - `exposeInternals?: boolean` - Expose internals in snapshot - `exposeNumericValues?: boolean` - Expose numeric values - `HeapStatistics` (camelCase) - For GCProfiler, complete with all 11 fields - `HeapSpaceStatistics` (camelCase) - For GCProfiler, complete with all 5 fields - `GCProfilerResult` - Complete result type with version, timing, and statistics array - https://nodejs.org/api/v8.html#v8getheapstatistics 7. **Enhanced Function Signatures**: - `getHeapSnapshot(options?)` - Added optional `HeapSnapshotOptions` parameter - `writeHeapSnapshot(fileName?, options?)` - Added optional `HeapSnapshotOptions` parameter - `getHeapStatistics()` - Changed return type from `HeapStatistics` to `HeapInfo` - `getHeapSpaceStatistics()` - Changed return type to `Array<HeapSpaceInfo>` - https://nodejs.org/api/v8.html#v8getheapsnapshotoptions 8. **Coverage Functions** - For type profile analysis: - `takeCoverage(): void` (v15.1.0) - Starts capturing V8 type profile - `stopCoverage(): void` (v15.1.0) - Stops capturing V8 type profile - https://nodejs.org/api/v8.html#v8takecoverage 9. **Serialization Documentation**: - Added `since v8.0.0` tags to all serialization classes and functions - Improved class documentation for `Serializer`, `Deserializer`, `DefaultSerializer`, `DefaultDeserializer` - https://nodejs.org/api/v8.html#serialization-api **References:** - Node.js v8 module docs: https://nodejs.org/api/v8.html - Heap statistics: https://nodejs.org/api/v8.html#v8getheapstatistics - GC profiling: https://nodejs.org/api/v8.html#class-v8gcprofiler - Query objects: https://nodejs.org/api/v8.html#v8queryobjectsctor-options Changelog: [Internal] Reviewed By: vzaidman Differential Revision: D90762740 fbshipit-source-id: 41581da6af6e62198c94e336740241b7983d4486 |
||
|
|
2e9b7fb2ad |
Align Flow lib defs for Node.js child_process with v24 (#55186)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55186 This is an AI-assisted change to align the Flow definitions for the `child_process` module with the Node.js docs as at v24. **New v18+ Features:** 1. **AbortSignal Support** (v18.0.0) - Process cancellation - Added `signal?: AbortSignal` option to all async functions (exec, execFile, fork, spawn) - Enables cancellation of child processes using `AbortController` - Example: `const controller = new AbortController(); spawn('cmd', [], {signal: controller.signal}); controller.abort();` - https://nodejs.org/api/child_process.html#child_processexeccommand-options-callback 2. **Enhanced Process Properties** (v20.x) - `spawnargs: Array<string>` - Full command-line arguments used to launch the process - `spawnfile: string` - Executable file name of the child process - `signalCode: string | null` - Signal that terminated the child process - https://nodejs.org/api/child_process.html#subprocessspawnargs **ChildProcess Class Updates:** 3. **Improved Property Types** - `stdio` is now a properly typed tuple array with readonly modifier - `channel` changed from `Object` to `mixed` for better type safety 4. **Enhanced Method Signatures** - `kill(signal?: string | number): boolean` - Now returns boolean and accepts numeric signals - `send()` overloads properly typed with `child_process$Serializable` messages - `send()` accepts `keepOpen` option: `Readonly<{keepOpen?: boolean}>` - https://nodejs.org/api/child_process.html#subprocesskillsignal **Option Type Improvements:** 6. **Modern Readonly Syntax** - All input options use `Readonly<{...}>` - `execOpts`, `execFileOpts`, `forkOpts`, `spawnOpts`, `spawnSyncOpts`, etc. - Allows passing readonly types safely 7. **Enhanced Environment Variables** - Changed `env?: Object` to `env?: {[key: string]: string | void}` - More precise typing for environment variable dictionaries 8. **New Fork Options** (IPC enhancements) - `serialization?: 'json' | 'advanced'` - IPC serialization format - `killSignal` and `timeout` options added to fork - https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options 9. **Enhanced Spawn Options** - Added `killSignal`, `timeout`, `serialization` to `spawnOpts` - Better consistency across all spawn functions **Return Type Fixes:** 10. **spawnRet/spawnSyncRet** - Made fields properly nullable: - `status: number | null` - null if process never exited - `signal: string | null` - null if not terminated by signal - `error: Error | void` - void if no error occurred - Removed spread operator for exact types **Helper Types:** 11. **`child_process$Serializable`** - Union type for IPC messages: - `string | number | boolean | bigint | {...} | Array<mixed>` - Used in send() method signatures 12. **`child_process$SendHandle`** - Type for handle passing: - `net$Server | net$Socket` - Used for passing server/socket handles to child processes **References:** - Node.js child_process module docs: https://nodejs.org/api/child_process.html - AbortSignal integration: https://nodejs.org/api/child_process.html#child_processexeccommand-options-callback 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: D89944331 fbshipit-source-id: 744ae04051c2214d97269c48c115060f5f30fb1f |
||
|
|
60f9bfd546 |
Transform mixed to unknown (#55176)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55176 We are transforming the following utility types to be more consistent with typescript and better AI integration: * `$NonMaybeType` -> `NonNullable` * `$ReadOnly` -> `Readonly` * `$ReadOnlyArray` -> `ReadonlyArray` * `$ReadOnlyMap` -> `ReadonlyMap` * `$ReadOnlySet` -> `ReadonlySet` * `$Keys` -> `keyof` * `$Values` -> `Values` * `mixed` -> `unknown` See details in https://fb.workplace.com/groups/flowlang/permalink/1837907750148213/. drop-conflicts Command: `js1 flow-runner codemod flow/transformUtilityType --format-files=false --legacy-type='$ReadOnlyArray'` Reviewed By: SamChou19815 Differential Revision: D90728808 fbshipit-source-id: 2b2fb7f24140e25638af4c73648b81021cc85339 |
||
|
|
7051a07c63 |
Transform $ReadOnlyArray to ReadonlyArray 17/n (#55109)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55109 We are transforming the following utility types to be more consistent with typescript and better AI integration: * `$NonMaybeType` -> `NonNullable` * `$ReadOnly` -> `Readonly` * `$ReadOnlyArray` -> `ReadonlyArray` * `$ReadOnlyMap` -> `ReadonlyMap` * `$ReadOnlySet` -> `ReadonlySet` * `$Keys` -> `keyof` * `$Values` -> `Values` * `mixed` -> `unknown` See details in https://fb.workplace.com/groups/flowlang/permalink/1837907750148213/. drop-conflicts Command: `js1 flow-runner codemod flow/transformUtilityType --legacy-type='$ReadOnlyArray'` Reviewed By: SamChou19815 Differential Revision: D90402950 fbshipit-source-id: d338ad7997728d40457b1199c3bd5dcd245a39c3 |
||
|
|
a5fc307eb4 |
Incorporate timers into main Node.js lib defs and align with v24 (#55079)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55079 This is an AI-assisted change to consolidate Metro's separate `node.js` file into the main Node.js library definitions and align with Node.js v24 (effectively v22) standards. **Consolidation Changes:** 1. **Incorporated Separate File** - Removed duplication - Moved definitions from `xplat/js/tools/metro/flow-typed/node.js` into main `node.js` files - Deleted the separate node.js file (no longer needed) - Both Metro and React Native now use unified definitions - Positioned alphabetically between 'tls' and 'url' modules **Timeout Class Enhancements:** 2. **Complete Timeout Class** - All timer management methods - `close()` - Cancels the timeout (added in v0.9.1) - `hasRef()` - Returns true if timer will keep Node.js running (added in v11.0.0) - `ref()` - Request timer keep Node.js running (added in v0.9.1) - `refresh()` - Refresh timer's start time (added in v10.2.0) - `unref()` - Allow Node.js to exit if timer is only active thing (added in v0.9.1) - `[Symbol.toPrimitive]` - Get numeric timer ID (added in v14.9.0) - Uses `[key: $SymbolToPrimitive]` syntax - https://nodejs.org/api/timers.html#class-timeout **Immediate Class Enhancements:** 3. **Complete Immediate Class** - Immediate timer management - `hasRef()` - Returns true if immediate will keep Node.js running (added in v11.0.0) - `ref()` - Request immediate keep Node.js running (added in v9.7.0, v8.12.0) - `unref()` - Allow Node.js to exit if immediate is only active thing (added in v9.7.0, v8.12.0) - https://nodejs.org/api/timers.html#class-immediate **Core Timer Functions:** 4. **setTimeout/setInterval/setImmediate** - Complete signatures - Generic `<TArgs: Iterable<mixed>>` for type-safe callback arguments - `setTimeout(callback, delay?, ...args)` - Returns `Timeout` - `setInterval(callback, delay?, ...args)` - Returns `Timeout` - `setImmediate(callback, ...args)` - Returns `Immediate` - All support passing additional arguments to callback - https://nodejs.org/api/timers.html#settimeoutcallback-delay-args 5. **Clear Functions** - Flexible cancellation - `clearTimeout(timeout?)` - Accepts `Timeout` or numeric ID - `clearInterval(timeout?)` - Accepts `Timeout` or numeric ID - `clearImmediate(immediate?)` - Accepts `Immediate` or numeric ID - All parameters optional (no-op if not provided) - https://nodejs.org/api/timers.html#cleartimeouttimeout **Promises API (timers/promises):** 6. **Promise-based Timers** - Async/await compatible - `setTimeout<T>(delay?, value?, options?)` - Returns `Promise<T>` (added in v15.0.0) - `setImmediate<T>(value?, options?)` - Returns `Promise<T>` (added in v15.0.0) - `setInterval<T>(delay?, value?, options?)` - Returns `AsyncIterator<T>` (added in v15.9.0) - All support AbortSignal for cancellation - https://nodejs.org/api/timers.html#timers-promises-api 7. **TimerOptions Type** - Modern options object - `ref?: boolean` - Control if timer keeps Node.js running - `signal?: AbortSignal` - Abort controller for cancellation - Type uses `Readonly<{...}>` for input immutability - https://nodejs.org/api/timers.html#timerspromisessettimeoutdelay-value-options 8. **setInterval as AsyncIterator** - Async iteration support (added in v15.9.0) - Returns `AsyncIterator<T>` instead of `Promise<T>` - Enables `for await (const value of setInterval(100, data))` patterns - Useful for periodic async operations - https://nodejs.org/api/timers.html#timerspromisessetintervaldelay-value-options **Scheduler API:** 9. **scheduler object** - Task scheduling utilities (added in v16.0.0) - `scheduler.wait(delay, options?)` - Promise-based delay (alternative to setTimeout) - `scheduler.yield()` - Yield to event loop (microtask yield) - Object marked as `Readonly<{...}>` for immutability - https://nodejs.org/api/timers.html#timerspromisesschedulerwaitdelay-options **Type Safety Improvements:** 10. **Readonly Input Types** - Applied consistently - `TimerOptions`: `Readonly<{ref?, signal?}>` - `scheduler` object: `Readonly<{wait, yield}>` - Allows passing readonly types safely (inputs should be readonly) 11. **Generic Type Parameters** - Type-safe callbacks - Timer functions: `<TArgs: Iterable<mixed>>` for variadic args - Promises API: `<T>` for resolved value types - Default generic: `<T = void>` for setInterval iterator 12. **Export Type Aliases** - Better developer experience - `Timeout` and `Immediate` exported as types from module - Consistent `timers$` prefix for internal types - Clean module exports without duplication **Symbol Support:** 13. **Symbol.toPrimitive** - Convert Timeout to number (added in v14.9.0) - Allows implicit conversion: `Number(timeout)` or `+timeout` - Returns the numeric timer ID - Flow syntax: `[key: $SymbolToPrimitive]: () => number` - https://nodejs.org/api/timers.html#timeoutsymboltoprimitive **Flow Limitations:** 14. **Symbol.dispose not included** - Explicit resource management - `[key: $SymbolDispose]: () => void` is commented out - Node.js added Symbol.dispose in v18.18.0, v20.4.0 - Flow doesn't fully support this symbol yet or has issues with multiple symbol-keyed properties - Will be enabled when Flow support improves - https://nodejs.org/api/timers.html#timeoutsymboldispose **References:** - Node.js timers module docs: https://nodejs.org/api/timers.html - TC39 Explicit Resource Management: https://github.com/tc39/proposal-explicit-resource-management 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: D89944814 fbshipit-source-id: 38c1773d1a3591ef9f123681655720d17e7e53bb |
||
|
|
1cc30dc1ad |
Transform $ReadOnly to Readonly 37/n (#55066)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55066 We are transforming the following utility types to be more consistent with typescript and better AI integration: * `$NonMaybeType` -> `NonNullable` * `$ReadOnly` -> `Readonly` * `$ReadOnlyArray` -> `ReadonlyArray` * `$ReadOnlyMap` -> `ReadonlyMap` * `$ReadOnlySet` -> `ReadonlySet` * `$Keys` -> `keyof` * `$Values` -> `Values` * `mixed` -> `unknown` See details in https://fb.workplace.com/groups/flowlang/permalink/1837907750148213/. drop-conflicts Command: `js1 flow-runner codemod flow/transformUtilityType --legacy-type='$ReadOnly'` Changelog:[internal] Differential Revision: D90146145 fbshipit-source-id: 4b71784a36f8286f3be620969ea408cf8a0aac80 |
||
|
|
d19efcfae2 |
Incorporate perf_hooks into main Node.js lib defs and align with v24 (#55058)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55058 This is an AI-assisted change to consolidate Metro's separate `perf_hooks.js` file into the main Node.js library definitions and align with Node.js v24 (effectively v22) standards. **Consolidation Changes:** 1. **Incorporated Separate File** - Removed duplication - Moved definitions from `metro/flow-typed/perf_hooks.js` into main `node.js` files - Deleted the separate perf_hooks.js file (no longer needed) - Both Metro and React Native now use unified definitions - Positioned alphabetically between 'path' and 'punycode' modules **Enhanced Histogram Types:** 2. **Complete Histogram Interface** - Added missing bigint support (v17.4.0) - `count` and `countBigInt` - Total sample count - `exceeds` and `exceedsBigInt` - Samples exceeding 1-hour threshold - `max` and `maxBigInt` - Maximum recorded value - `min` and `minBigInt` - Minimum recorded value - `percentile()` and `percentileBigInt()` - Get value at percentile - `percentiles` and `percentilesBigInt` - Map of percentile distributions - https://nodejs.org/api/perf_hooks.html#class-histogram 3. **RecordableHistogram Interface** - Custom histogram creation (v15.9.0, v14.18.0) - `record(val)` - Record a value in the histogram - `recordDelta()` - Record time delta since last call - Used with `createHistogram()` for custom performance tracking - https://nodejs.org/api/perf_hooks.html#class-recordablehistogram **Enhanced Performance Entry Classes:** 4. **PerformanceNodeTiming Class** - Complete Node.js lifecycle timing - Renamed from PerformanceNodeEntry for accuracy - `bootstrapComplete` - Bootstrap completion timestamp - `environment` - Environment initialization timestamp - `idleTime` - Event loop idle time (v14.10.0) - `loopStart`, `loopExit` - Event loop lifecycle timestamps - `nodeStart` - Process initialization timestamp - `v8Start` - V8 platform initialization timestamp - https://nodejs.org/api/perf_hooks.html#class-performancenodetiming 5. **PerformanceResourceTiming Class** - Network timing details (v18.2.0, v16.17.0) - Complete Web Performance API compatibility - Timing properties: `workerStart`, `redirectStart/End`, `fetchStart`, `domainLookupStart/End`, `connectStart/End`, `secureConnectionStart`, `requestStart`, `responseEnd` - Size properties: `transferSize`, `encodedBodySize`, `decodedBodySize` - Used for detailed network request profiling - https://nodejs.org/api/perf_hooks.html#class-performanceresourcetiming 6. **PerformanceMark and PerformanceMeasure** - Enhanced type safety - Generic type parameter `<T>` for custom detail objects - `PerformanceMark<T>` has `duration: 0` (point in time) - `PerformanceMeasure<T>` has variable duration (time span) - Both support custom `detail` property for user data **New Functions:** 7. **createHistogram()** - Custom histogram creation (v15.9.0, v14.18.0) - Options: `lowest`, `highest` (number | bigint), `figures` (precision) - Returns `RecordableHistogram` for custom performance metrics - Enables fine-grained performance measurement - https://nodejs.org/api/perf_hooks.html#perf_hookscreatehistogramoptions **Performance Object Enhancements:** 8. **Enhanced Performance Class** - `clearResourceTimings(name?)` - Clear specific resource timings - `timerify()` enhanced with histogram option: `Readonly<{histogram?: RecordableHistogram}>` - All timing methods return proper typed instances 9. **GC Constants Export** - Garbage collection monitoring - `constants.NODE_PERFORMANCE_GC_MAJOR` - Major GC - `constants.NODE_PERFORMANCE_GC_MINOR` - Minor/scavenge GC - `constants.NODE_PERFORMANCE_GC_INCREMENTAL` - Incremental marking GC - `constants.NODE_PERFORMANCE_GC_WEAKCB` - Weak callback processing - GC flags: `FLAGS_NO`, `FLAGS_CONSTRUCT_RETAINED`, `FLAGS_FORCED`, `FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING`, `FLAGS_ALL_AVAILABLE_GARBAGE`, `FLAGS_ALL_EXTERNAL_MEMORY`, `FLAGS_SCHEDULE_IDLE` - https://nodejs.org/api/perf_hooks.html#perf_hooksconstants **Modern Flow Type Improvements:** 10. **Readonly Input Types** - Applied consistently - `PerformanceMarkOptions<T>`: `Readonly<{detail?, startTime?}>` - `PerformanceMeasureOptions<T>`: `Readonly<{detail?, duration?, end?, start?}>` - `PerformanceObserver.observe()`: `Readonly<{entryTypes?, type?, buffered?}>` - `monitorEventLoopDelay()`: `Readonly<{resolution?}>` - `createHistogram()`: `Readonly<{lowest?, highest?, figures?}>` - `timerify()` histogram option: `Readonly<{histogram?}>` 11. **Entry Type Safety** - Proper union type - `perf_hooks$EntryType`: `'function' | 'gc' | 'http' | 'http2' | 'mark' | 'measure' | 'navigation' | 'node' | 'resource'` - Used throughout for type-safe entry type filtering 12. **Export Type Aliases** - Better developer experience - All classes and interfaces exported as both types and values - Consistent `perf_hooks$` prefix for internal types - Clean module exports without duplication **Observer Enhancements:** 13. **PerformanceObserver.observe()** - Flexible options (v16.0.0) - Support both `type` (single) and `entryTypes` (multiple) options - `buffered` option to include past entries - `takeRecords()` method for manual retrieval **References:** - Node.js perf_hooks module docs: https://nodejs.org/api/perf_hooks.html - Web Performance API spec: https://w3c.github.io/performance-timeline/ - User Timing spec: https://w3c.github.io/user-timing/ - Resource Timing spec: https://w3c.github.io/resource-timing/ 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: D89944490 fbshipit-source-id: 28e89ee27ce0150db063d6c3757defc3bba512c0 |
||
|
|
cead39c6d9 |
Align Flow lib defs for Node.js url with v24 (#55021)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55021 This is an AI-assisted change to align the Flow definitions for the `url` module with the Node.js docs as at v24. **New Safe Parsing:** 1. **`URL.parse(input, base?)`** - Safe static parsing (added in v22.1.0) - Parses URL without throwing exceptions - Returns `URL` object on success, `null` on failure - Alternative to `new URL()` that doesn't require try-catch - Example: `const url = URL.parse(userInput); if (url) { ... }` - https://nodejs.org/api/url.html#urlparseinput-base **New Pattern Matching (Experimental):** 2. **`URLPattern` class** - Web API-compatible URL pattern matching (added in v23.8.0) 🧪 - Constructor: `new URLPattern(input?, options?)` or `new URLPattern(input, baseURL, options?)` - Properties: `protocol`, `username`, `password`, `hostname`, `port`, `pathname`, `search`, `hash`, `hasRegExpGroups` (all readonly) - Methods: - `test(input?, baseURL?)` - Returns boolean if URL matches pattern - `exec(input?, baseURL?)` - Returns match result with captured groups or null - Supports wildcard patterns (`*`), named groups (`:param`), and case-insensitive matching - Use cases: routing, URL filtering, path matching - https://nodejs.org/api/url.html#class-urlpattern **Enhanced Path Conversion:** 3. **`pathToFileURL(path, options?)`** - Enhanced with options (v20.0.0) - New optional `options` parameter: `{windows?: boolean}` - Enables cross-platform path conversion testing - https://nodejs.org/api/url.html#urlpathtofileurlpath-options 4. **`fileURLToPath(url, options?)`** - Enhanced with options (v20.0.0) - New optional `options` parameter: `{windows?: boolean}` - Enables cross-platform URL to path conversion testing - https://nodejs.org/api/url.html#urlfileurltopathurl-options **Type Definitions Added:** 5. **`url$URLPatternInit`** - Pattern initialization object - Optional properties for each URL component - Used in URLPattern constructor and exec/test methods 6. **`url$URLPatternComponentResult`** - Pattern match result for URL component - Contains `input` string and captured `groups` object 7. **`url$URLPatternResult`** - Complete pattern match result - Contains match results for all URL components - Includes original inputs array **References:** - Node.js url module docs: https://nodejs.org/api/url.html - URLPattern Web API spec: https://urlpattern.spec.whatwg.org/ 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: D89943253 fbshipit-source-id: aac1f999fa12a161eb8c24229c046d70072adf8a |
||
|
|
4862cc78f8 |
Align Flow lib defs for Node.js buffer with v24 (#55017)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55017 This is an AI-assisted change to align the Flow definitions for the `buffer` module with the Node.js docs as at v24. **New Validation Functions:** 1. **`isUtf8(input)`** - UTF-8 validation (added in v19.4.0, v18.14.0) - Validates if Buffer/ArrayBuffer/TypedArray contains only valid UTF-8 data - Returns `true` for valid UTF-8 (including empty buffers) - Throws error if input is a detached array buffer - https://nodejs.org/api/buffer.html#bufferisutf8input 2. **`isAscii(input)`** - ASCII validation (added in v19.6.0, v18.15.0) - Validates if Buffer/ArrayBuffer/TypedArray contains only ASCII (0x00-0x7F) - Returns `true` for valid ASCII (including empty buffers) - Throws error if input is a detached array buffer - https://nodejs.org/api/buffer.html#bufferisasciiinput **Blob URL Resolution:** 3. **`resolveObjectURL(id)`** - Resolve Blob from URL (added in v16.7.0) - Resolves `'blob:nodedata:...'` URL to its associated Blob object - Returns Blob or `undefined` if URL not found - Works with URLs created via `URL.createObjectURL(blob)` - https://nodejs.org/api/buffer.html#bufferresolveobjecturlid **New Constants:** 4. **`constants` object** - Buffer size limits - `constants.MAX_LENGTH` - Maximum size of a single Buffer instance - `constants.MAX_STRING_LENGTH` - Maximum length for string operations - https://nodejs.org/api/buffer.html#bufferconstantsmax_length **Web API Classes (re-exported):** 5. **`Blob` class** - Exported from buffer module (global in v18.0.0) - Web API-compatible Blob for immutable binary data - Also available as global (no import needed in v18+) - https://nodejs.org/api/buffer.html#class-blob 6. **`File` class** - Exported from buffer module (global in v20.0.0) - Web API-compatible File extending Blob - Also available as global (no import needed in v20+) - https://nodejs.org/api/buffer.html#class-file **References:** - Node.js buffer module docs: https://nodejs.org/api/buffer.html 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: D89942832 fbshipit-source-id: 2b86a3084649674f43b6e0a08f9bbf0affd680f9 |
||
|
|
f5c1126074 |
Align Flow lib defs for Node.js util with v24 (#55016)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/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 |
||
|
|
8084fe62ed |
Align Flow lib defs for Node.js os with v24 (#55014)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55014 This is an AI-assisted change to align the Flow definitions for the `os` module with the Node.js docs as at v24. **New APIs:** 1. **`machine()`** - Returns machine type (added in v18.9.0, v16.18.0) - Returns hardware name: `'x86_64'`, `'arm64'`, `'aarch64'`, etc. - Different from `arch()` which returns the architecture Node.js was compiled for - https://nodejs.org/api/os.html#osmachine 2. **`version()`** - Returns kernel version string (added in v13.11.0, v12.17.0) - Example: `'Linux 5.15.0-1234-generic'`, `'Darwin Kernel Version 21.6.0'` - https://nodejs.org/api/os.html#osversion 3. **`setPriority([pid,] priority)`** / **`getPriority([pid])`** - Process priority management - Set/get scheduling priority for processes - Priority constants available in `os.constants.priority` - https://nodejs.org/api/os.html#ossetprioritypid-priority - https://nodejs.org/api/os.html#osgetprioritypid 4. **`devNull` constant** - Path to null device (`'/dev/null'` on POSIX, `'\\\\.\\nul'` on Windows) - https://nodejs.org/api/os.html#osdevnull 5. **`constants` object** - OS constants (signals, errno, priority, dlopen) - `constants.signals` - Process signal constants - `constants.errno` - Error number constants - `constants.priority` - Process priority constants (PRIORITY_LOW, PRIORITY_HIGH, etc.) - Readonly - `constants.dlopen` - Dynamic library loading constants - https://nodejs.org/api/os.html#os-constants **Type Safety Improvements:** 6. **`arch()` return type** - Now includes all 10 supported architectures: - Added: `'loong64'` (LoongArch - newer Chinese CPU architecture) - Complete list: `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`, `'mips'`, `'mipsel'`, `'ppc64'`, `'riscv64'`, `'s390x'`, `'x64'` - https://nodejs.org/api/os.html#osarch 7. **`platform()` return type** - Now union of 10 specific platforms instead of generic `string`: - `'aix'`, `'android'`, `'darwin'`, `'freebsd'`, `'haiku'`, `'linux'`, `'openbsd'`, `'sunos'`, `'win32'`, `'cygwin'` - https://nodejs.org/api/os.html#osplatform 8. **Output type definitions made exact** - Removed spread operators (outputs are mutable) - `os$CPU` - Removed spread operators from main type and nested `times` object - `os$NetIFAddr` - Added missing `scopeid?` and `cidr` properties, removed spread operator - `os$UserInfo$*` - Types are mutable (not readonly) so consumers can modify returned values - `networkInterfaces()` return type - Removed spread operator for exact type 9. **Input types use Readonly** - Following readonly rules - `userInfo()` options: Changed to `Readonly<{encoding: 'buffer' | 'utf8'}>` - Allows passing readonly types safely **References:** - Node.js os module docs: https://nodejs.org/api/os.html 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: D89940756 fbshipit-source-id: 29a91c49716bc08eb2c94892e3648db9e40b06d4 |
||
|
|
83b21bbf26 |
Align Flow lib defs for Node.js crypto with v24 (#55009)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55009 This is an AI-assisted change to align the Flow definitions for the `crypto` module with the Node.js docs as at v24. **New v24 APIs:** 1. **`hash(algorithm, data, [outputEncoding])`** - One-shot hashing convenience function - Added in Node.js v21.7.0, v20.12.0 - https://nodejs.org/api/crypto.html#cryptohashalgorithm-data-outputencoding 2. **X509Certificate new properties** (added in v22.10.0): - `validFromDate` - Certificate valid-from as Date object - `validToDate` - Certificate valid-to as Date object - https://nodejs.org/api/crypto.html#x509certificatevalidfromdate - https://nodejs.org/api/crypto.html#x509certificatevalidtodate **New Classes:** 3. **KeyObject** - Represents cryptographic keys (symmetric/asymmetric) - Properties: `type`, `asymmetricKeyType`, `asymmetricKeySize`, `symmetricKeySize` - Methods: `export()`, `equals()` - https://nodejs.org/api/crypto.html#class-keyobject 4. **X509Certificate** - X.509 certificate handling - Properties: `ca`, `fingerprint*`, `issuer`, `subject`, `publicKey`, `raw`, etc. - Methods: `checkEmail()`, `checkHost()`, `checkIP()`, `verify()`, etc. - https://nodejs.org/api/crypto.html#class-x509certificate 5. **Certificate** - Legacy SPKAC (Signed Public Key and Challenge) support - Static methods: `exportChallenge()`, `exportPublicKey()`, `verifySpkac()` - https://nodejs.org/api/crypto.html#class-certificate **Key Management Functions:** 6. **Key Creation:** - `createSecretKey(key, [encoding])` - Create symmetric KeyObject - `createPublicKey(key)` - Create public KeyObject - `createPrivateKey(key)` - Create private KeyObject - https://nodejs.org/api/crypto.html#cryptocreatesecretkeykey-encoding - https://nodejs.org/api/crypto.html#cryptocreatepublickeykey - https://nodejs.org/api/crypto.html#cryptocreateprivatekeykey 7. **Key Generation:** - `generateKeyPair()` / `generateKeyPairSync()` - Generate asymmetric key pairs - `generateKey()` / `generateKeySync()` - Generate symmetric keys - Supports: RSA, RSA-PSS, DSA, EC, Ed25519, Ed448, X25519, X448 - https://nodejs.org/api/crypto.html#cryptogeneratekeypairtype-options-callback - https://nodejs.org/api/crypto.html#cryptogeneratekeytype-options-callback 8. **Primality Testing:** - `checkPrime()` / `checkPrimeSync()` - Test if candidate is prime - https://nodejs.org/api/crypto.html#cryptocheckprimecandidate-options-callback **Other Improvements:** 9. **Hash.copy()** - Create deep copy of Hash object - https://nodejs.org/api/crypto.html#hashcopyoptions 10. **webcrypto property** - References web Crypto type - Web Crypto API types are NOT redefined (use existing definitions where available) - https://nodejs.org/api/webcrypto.html **Type Safety:** - All options objects use modern `Readonly<{...}>` syntax for inputs - Exact-by-default types throughout - Proper overloading for functions with optional parameters **References:** - Node.js crypto module docs: https://nodejs.org/api/crypto.html - Node.js Web Crypto API: https://nodejs.org/api/webcrypto.html 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: D89934145 fbshipit-source-id: 021fed306823469bad5be9e7bbab73da2477c42f |
||
|
|
07d225557a |
Align Flow lib defs for Node.js path with v24 (#55006)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55006 This is an AI-assisted change to align the Flow definitions for the `path` module with the Node.js docs as at v24. **New APIs:** 1. **`matchesGlob(path, pattern)`** - Glob pattern matching (added in Node.js v22.5.0) - Returns `boolean` indicating if path matches the glob pattern - Supports standard glob syntax: `*`, `?`, `[...]`, `**`, etc. - Example: `path.matchesGlob('/foo/bar', '/foo/*')` returns `true` - https://nodejs.org/api/path.html#pathmatchesglobpath-pattern 2. **`toNamespacedPath(path)`** - Windows namespace-prefixed path conversion - On Windows: converts path to namespace-prefixed path (e.g., `\\?\C:\path`) - On POSIX: returns path unchanged - Enables access to paths longer than 260 characters on Windows - https://nodejs.org/api/path.html#pathtonamespacedpathpath **Type Safety Improvements:** 3. **Replaced `any` types** - Proper typed interfaces - Changed `posix: any` → `posix: path$PlatformPath` - Changed `win32: any` → `win32: path$PlatformPath` - Added `path$PlatformPath` type definition with all methods and properties 4. **Modern Readonly syntax for inputs** - Following readonly rules - `format()` input: Changed to `Readonly<{root?, dir?, base?, ext?, name?}>` - Allows passing readonly types safely (inputs should be readonly) 5. **Made `parse()` return type exact** - Removed spread operator - Return type is now exact: `{root: string, dir: string, base: string, ext: string, name: string}` - Previously had `...` spread operator allowing extra properties - Note: Return type is NOT readonly (outputs are mutable so consumers can modify) 6. **PlatformPath includes parse return as readonly** - Consistency - Within `path$PlatformPath` type, the parse method returns `Readonly<{...}>` - This is for the type definition itself, not the actual module export **References:** - Node.js path module docs: https://nodejs.org/api/path.html - Modern Flow syntax: exact-by-default, `Readonly<T>` for input parameters 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: D89932753 fbshipit-source-id: 9ae777b0be2fdfee8ef4a71e9d1f9fd1cd395215 |
||
|
|
c98494bda0 |
Add Flow lib defs for newer Node.js fs APIs (#54992)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54992 Node.js's `fs` has been updated considerably since it was first covered with Flow, and so far we've only added new APIs piecemeal as we need them. This goes through the whole module top to bottom and attempts to update in line with the Node.js docs at v24. Changelog: [Internal] Reviewed By: vzaidman Differential Revision: D89605689 fbshipit-source-id: 1ad0ef2f7fedb6416471461b8be7bc418afcd28f |
||
|
|
2b74f985fa |
Add Flow lib defs for Node.js streams fromWeb/toWeb (#54615)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54615 Since v17 (and stable since v22.17), Node.js has helper methods for converting [Node streams](https://nodejs.org/api/stream.html) to/from [Web streams](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API) (e.g., as returned by global `fetch`). This adds the Flow typings. - Node docs: https://nodejs.org/api/stream.html#streamreadablefromwebreadablestream-options Changelog: [General][Internal] Monorepo Flow typings Reviewed By: vzaidman Differential Revision: D87543561 fbshipit-source-id: c76b9014ab3ff61f9ce57be1e01bf456b676433f |
||
|
|
dc06a71892 |
Add Flow lib defs for Node's zlib zstd support (#54616)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54616 Since 22.15, Node.js now natively supports zstd (de)compression in `zlib`. This adds the Flow typings. - Node docs: https://nodejs.org/api/zlib.html#zlibcreatezstdcompressoptions - Reference for new constants: https://github.com/nodejs/node/blob/main/deps/zstd/lib/zstd.h Changelog: [General][Internal] Monorepo Flow typings Reviewed By: javache Differential Revision: D87449911 fbshipit-source-id: 48dcf1147895ed780dbad41a04804abcf4d92648 |
||
|
|
2624e2f52e |
Transform mixed to unknown in xplat/js (#54955)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54955 We are transforming the following utility types to be more consistent with typescript and better AI integration: * `$NonMaybeType` -> `NonNullable` * `$ReadOnly` -> `Readonly` * `$ReadOnlyArray` -> `ReadonlyArray` * `$ReadOnlyMap` -> `ReadonlyMap` * `$ReadOnlySet` -> `ReadonlySet` * `$Keys` -> `keyof` * `$Values` -> `Values` * `mixed` -> `unknown` See details in https://fb.workplace.com/groups/flowlang/permalink/1837907750148213/. drop-conflicts Reviewed By: SamChou19815 Differential Revision: D89581584 fbshipit-source-id: cc5953ffea6cf1060f69efc714508e8ba93a040c |
||
|
|
753c1e1231 |
fixed node types for style text "validateStream" (#54778)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54778 Changelog: [Internal] The correct value is `validateStream` and not `validStream` https://nodejs.org/api/util.html#utilstyletextformat-text-options Reviewed By: huntie Differential Revision: D88368928 fbshipit-source-id: 0f9a9bf0aaa13b325dd22aed8c07d8dab38e5f17 |
||
|
|
a3a890f4e1 |
Deploy 0.292.0 to xplat (#54788)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54788 [changelog](https://github.com/facebook/flow/blob/main/Changelog.md) Changelog: [Internal] Reviewed By: panagosg7 Differential Revision: D88379018 fbshipit-source-id: 2a893372e6d1e45f6f657049de9703afb2f7aa1e |
||
|
|
e073ca8ea3 |
Add lib defs for Node.js fs.glob, etc. (#54695)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/54695 Add Flow typing for `fs.glob` APIs introduced in Node v22 Changelog: [Internal] Reviewed By: cipolleschi, vzaidman Differential Revision: D78668287 fbshipit-source-id: 769c22687b4dcd31a64b54d6825279287e558967 |
||
|
|
5c369aa34c |
Add annotations to fix future natural inference errors in xplat/js: 6/n (#53894)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53894 Changelog: [Internal] Reviewed By: marcoww6 Differential Revision: D83000736 fbshipit-source-id: 3ba5c59d9b2f7b967c0dccd24a73056430153bdc |
||
|
|
de4e01bcc6 |
add the nodejs type for process.memoryUsage.rss() (#53805)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53805 Changelog: [Internal] https://nodejs.org/docs/latest-v24.x/api/process.html#processmemoryusagerss Reviewed By: huntie Differential Revision: D82550739 fbshipit-source-id: 11026fb82608e004b10426776592f22e67eb0720 |
||
|
|
26c042724c |
Replace chalk in build scripts (#51904)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51904 Replaces `chalk` with Node's `util.styleText` in `scripts/build/` and `scripts/build-types/`. Will follow up with replacing across the entire repo at a later point. Changelog: [Internal] Reviewed By: robhogan Differential Revision: D76037191 fbshipit-source-id: c28352853f22d455a709f4b752f566626e6fb3fe |
||
|
|
c1216d99f8 |
RN: Flowify flow-typed/{environment/node,npm/jest} (#51777)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51777 Just adding `flow` to these two libdefs that aren't sourced directly from `flow-typed/flow-typed`. Changelog: [Internal] Reviewed By: SamChou19815 Differential Revision: D75877692 fbshipit-source-id: 0ee0ec08e2046fdba38480cddca3686109e8ca45 |
||
|
|
84de8a075e |
RN: Delete @oncall Annotations (#51416)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51416 Deletes `oncall` annotations from the `facebook/react-native` repository. Changelog: [Internal] Reviewed By: javache Differential Revision: D74902524 fbshipit-source-id: 32a6a5b2ff27281792d572f151e2b094d9a79029 |
||
|
|
70c3ffe984 |
Use builtin libdefs from flow-typed (#49929)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/49929 X-link: https://github.com/facebook/metro/pull/1459 In the next version of Flow, we will stop bundling many of the builtin libdefs, and they have been moved to flow-typed. This diff checks in them to prepare for the deployment of the next version of Flow. Changelog: [Internal] Reviewed By: SamChou19815 Differential Revision: D70896122 fbshipit-source-id: aa6bd0b1e653b983a345b0e202c8dad5058a0001 |
||
|
|
785249d05b |
Use builtin libdefs from flow-typed (#49702)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/49702 In the next version of Flow, we will stop bundling many of the builtin libdefs, and they have been moved to flow-typed. This diff checks in them to prepare for the deployment of the next version of Flow. Changelog: [Internal] Reviewed By: alexmckenley Differential Revision: D70256694 fbshipit-source-id: 44e0772cc982add44723c252ea547a9cea0641e6 |