You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5e8711f
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: src/content/docs/router/api/index.mdx
+12-15Lines changed: 12 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
---
2
2
title: API reference
3
-
description: Every export of @bomb.sh/router 0.7.1, grouped by what it does
3
+
description: Every export of @bomb.sh/router 0.8.0, grouped by what it does
4
4
---
5
5
6
-
This page lists every export of `@bomb.sh/router` 0.7.1. Signatures leave out generic parameters, because TypeScript infers them from your definitions.
6
+
This page lists every export of `@bomb.sh/router` 0.8.0. Signatures leave out generic parameters, because TypeScript infers them from your definitions.
7
7
8
8
## Definitions
9
9
@@ -13,11 +13,7 @@ Declares a route that supports `help` and `execute`. Returns a route. Same as `r
13
13
14
14
### route(name, ...elements)
15
15
16
-
Declares a route that supports `help` only. Returns a route.
17
-
18
-
### routes(...children)
19
-
20
-
Attaches child routes to the route it is passed to.
16
+
Declares a route that supports `help` only. Returns a route. Child routes are passed directly as elements of `route()` and `command()`.
21
17
22
18
### name(value)
23
19
@@ -79,7 +75,7 @@ Attaches environment sources to a route.
79
75
80
76
### extend(...elements)
81
77
82
-
Bundles elements into one reusable element:
78
+
Bundles elements, including child routes, into one reusable element:
83
79
84
80
```ts twoslash
85
81
import {
@@ -127,7 +123,11 @@ const serve = command(
127
123
128
124
### checkpoint()
129
125
130
-
Pauses parsing so the application can load configuration before parsing continues. `parse()` returns a step whose `resume()` takes a `Result` with a list of value sources.
126
+
Pauses parsing so the application can load configuration before parsing continues. `parse()` returns a step whose `resume()` takes the list of value sources to load.
127
+
128
+
### dynamic(schema, extension)
129
+
130
+
Pauses parsing until the application supplies a value. `resume()` takes that value, `schema` validates it, and `extension` receives the validated value and returns the elements to add, such as options or child routes. An invalid value fails with `unprocessable-content`.
Copy file name to clipboardExpand all lines: src/content/docs/router/guides/routes-and-methods.mdx
+21-26Lines changed: 21 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,11 +9,12 @@ A **route** is an address in your CLI, such as `/` or `/database/clean`. A **met
9
9
10
10
## Declare routes
11
11
12
-
Three functions build the route tree:
12
+
Two functions build the route tree:
13
13
14
14
-`route(name(...), ...)` declares an address that supports help only.
15
15
-`command(name(...), ...)` declares an address that supports help and execute.
16
-
-`routes(...)` attaches child routes to a parent.
16
+
17
+
A child route is passed straight to its parent, next to the parent's options and other elements. To reuse a group of routes, bundle them with [`extend()`](/docs/router/api/#extendelements). Before 0.8.0, child routes went inside a `routes()` wrapper, which no longer exists.
17
18
18
19
`command()` is exactly a `route()` with `executable()` added, so these two definitions are equivalent:
0 commit comments