Commit ca2d244
Align Flow lib defs for Node.js url with v24
Summary:
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: D899432531 parent 4862cc7 commit ca2d244
1 file changed
Lines changed: 68 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3551 | 3551 | | |
3552 | 3552 | | |
3553 | 3553 | | |
3554 | | - | |
3555 | | - | |
| 3554 | + | |
| 3555 | + | |
| 3556 | + | |
| 3557 | + | |
| 3558 | + | |
| 3559 | + | |
| 3560 | + | |
| 3561 | + | |
| 3562 | + | |
| 3563 | + | |
3556 | 3564 | | |
3557 | 3565 | | |
3558 | 3566 | | |
| |||
3588 | 3596 | | |
3589 | 3597 | | |
3590 | 3598 | | |
| 3599 | + | |
3591 | 3600 | | |
3592 | 3601 | | |
3593 | 3602 | | |
| |||
3607 | 3616 | | |
3608 | 3617 | | |
3609 | 3618 | | |
| 3619 | + | |
| 3620 | + | |
| 3621 | + | |
| 3622 | + | |
| 3623 | + | |
| 3624 | + | |
| 3625 | + | |
| 3626 | + | |
| 3627 | + | |
| 3628 | + | |
| 3629 | + | |
| 3630 | + | |
| 3631 | + | |
| 3632 | + | |
| 3633 | + | |
| 3634 | + | |
| 3635 | + | |
| 3636 | + | |
| 3637 | + | |
| 3638 | + | |
| 3639 | + | |
| 3640 | + | |
| 3641 | + | |
| 3642 | + | |
| 3643 | + | |
| 3644 | + | |
| 3645 | + | |
| 3646 | + | |
| 3647 | + | |
| 3648 | + | |
| 3649 | + | |
| 3650 | + | |
| 3651 | + | |
| 3652 | + | |
| 3653 | + | |
| 3654 | + | |
| 3655 | + | |
| 3656 | + | |
| 3657 | + | |
| 3658 | + | |
| 3659 | + | |
| 3660 | + | |
| 3661 | + | |
| 3662 | + | |
| 3663 | + | |
| 3664 | + | |
| 3665 | + | |
| 3666 | + | |
| 3667 | + | |
| 3668 | + | |
| 3669 | + | |
| 3670 | + | |
| 3671 | + | |
| 3672 | + | |
| 3673 | + | |
| 3674 | + | |
| 3675 | + | |
3610 | 3676 | | |
3611 | 3677 | | |
3612 | 3678 | | |
| |||
0 commit comments