Skip to content

Commit 2acaf31

Browse files
committed
docs: document the new version features
1 parent 2db1c4d commit 2acaf31

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

docs/content/2.guide/1.features.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,25 @@ navigation:
77

88
npmx.dev provides a comprehensive set of features for browsing npm packages.
99

10+
## Search
11+
12+
### Find packages
13+
14+
Type a package name in the search bar to find it. Press `Enter` to navigate directly to an exact match.
15+
16+
### Jump to a specific version
17+
18+
Type `package@version` in the search bar and press `Enter` to go directly to that version:
19+
20+
| Input | Navigates to |
21+
| -------------------- | ---------------------------------------------------------- |
22+
| `vue@3.4.0` | Version page for vue 3.4.0 |
23+
| `@nuxt/kit@^3.0.0` | Package page with versions matching `^3.0.0` pre-filtered |
24+
| `react@^18 \|\| ^19` | Package page with versions matching the union pre-filtered |
25+
| `nuxt@latest` | Package page with `latest` dist-tag filter |
26+
27+
When the version is an exact version number (e.g. `3.4.0`), you'll land on that version's page. When it's a [semver range](/guide/semver-ranges) (e.g. `^3.0.0`), you'll land on the package page with the version filter pre-populated.
28+
1029
## Browse packages
1130

1231
### View package details

docs/content/2.guide/2.keyboard-shortcuts.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ These shortcuts work anywhere on the site. Press `/` from any page to quickly se
2727
| `Arrow Up` / `Arrow Down` | Move through results |
2828
| `Enter` | Open selected package |
2929

30+
::tip
31+
Type `package@version` (e.g. `vue@3.4.0` or `react@^18`) and press `Enter` to jump directly to that version or filter matching versions.
32+
::
33+
3034
## Package page
3135

3236
| Key | Action |

docs/content/2.guide/3.url-structure.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@ npmx.dev also supports shorter, cleaner URLs:
3636
| `/@org` | [`/@nuxt`](https://npmx.dev/@nuxt) |
3737
| `/~username` | [`/~sindresorhus`](https://npmx.dev/~sindresorhus) |
3838

39+
## Filter versions via URL
40+
41+
Append `?semver=<range>#versions` to any package URL to pre-populate the version filter:
42+
43+
| URL | Effect |
44+
| --------------------------------------------- | --------------------------------------------- |
45+
| `/package/vue?semver=^3.0.0#versions` | Shows vue versions matching `^3.0.0` |
46+
| `/package/react?semver=^18 \|\| ^19#versions` | Shows react versions matching `^18 \|\| ^19` |
47+
| `/package/nuxt?semver=latest#versions` | Shows nuxt versions matching the `latest` tag |
48+
49+
This is the same filter used on the [semver ranges](/guide/semver-ranges) page. Dependency links with version ranges (e.g. `^18.0.0 || ^19.0.0`) automatically link to the package page with this filter applied.
50+
3951
## Understand URL limitations
4052

4153
Some npm URLs are not yet supported:

docs/content/2.guide/5.semver-ranges.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ Type the exact version number, like `5.3.1`, to check if it exists.
5353

5454
Type `>=3.0.0-alpha.0` to find alpha, beta, and release candidate versions for a major release.
5555

56+
## Use semver ranges across npmx
57+
58+
Semver ranges appear in several places on npmx:
59+
60+
- **Version filter** - Type a range into the filter on any package page to find matching versions
61+
- **Dependency links** - Dependencies with version ranges (like `^18.0.0 || ^19.0.0`) link to the package page with the filter pre-populated
62+
- **Search bar** - Type `package@range` (e.g. `react@^18`) and press `Enter` to jump to the package with versions pre-filtered
63+
- **URL query param** - Add `?semver=^3.0.0#versions` to any package URL to share a filtered view
64+
5665
## Learn more
5766

5867
The full semver range specification is documented at [node-semver](https://github.com/npm/node-semver#ranges).

0 commit comments

Comments
 (0)