parseUri is a highly compact and comprehensive JavaScript library for parsing URIs, URNs, and URLs into their constituent parts. The current stable version is 3.0.2, with major breaking changes introduced in v2.0.0 and v3.0.0; the latter also transitioned the package to pure ESM. Historically, releases were infrequent, but v3 indicates renewed activity. Its key differentiators include its small footprint (1KB min/gzip), zero dependencies, and robust handling of partial or invalid URIs where the built-in `URL` constructor might throw errors. It also provides a richer set of URI properties, such as `authority`, `userinfo`, `subdomain`, `domain`, `tld`, and `resource`, which are not exposed by the native `URL` object, making it suitable for complex URI analysis beyond standard web URLs. It supports a 'friendly' parsing mode and configurable multi-level TLDs.
npm install parseuriVerified import paths — ran on the pinned version, not inferred.
Demonstrates importing `parseUri` and `setTlds`, parsing a complex URI, accessing various parts including query parameters, and showing usage of friendly mode and non-web protocols.
Update your code to use the new URI part property names. Refer to the v2.0.0 release notes or the demo page for a comprehensive comparison.
Replace calls to `setSld` with `setTlds`. If TLD parsing is critical, you must now provide your own comprehensive TLD map to `setTlds`.
Migrate your project to use ES module `import` syntax (e.g., `import parseUri from 'parseuri';`) and ensure your environment supports ESM.
Understand `parseUri`'s parsing logic for non-standard URIs. Use the demo page to compare results with `URL` if in doubt about specific edge cases or non-web protocols.
If URI normalization is required, you must implement it explicitly after `parseUri` has processed the URI.
Call `setTlds({})` if you need to disable TLD parsing or ensure no TLDs are recognized.Update your import statement to use ES module syntax: `import parseUri from 'parseuri';`. Ensure your project and environment are configured for ESM.
Verify that `import parseUri from 'parseuri';` is correctly placed and that your build tools (e.g., Webpack, Rollup) are configured to handle ES modules.
Refer to the v2.0.0 release notes and update property names in your code. For instance, `source` is now `href`, `host` is `hostname`, and `userInfo` is `userinfo`.
The `setSld` function was renamed to `setTlds` in v3.0.0. Update your code to call `setTlds` instead: `import { setTlds } from 'parseuri'; setTlds(...)`.No dependency data recorded yet.