paramour 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# paramour
|
|
2
|
+
|
|
3
|
+
Type-safe routing companion for the Next.js App Router: validated, typed
|
|
4
|
+
route and search params, type-checked path building, and a predictable,
|
|
5
|
+
human-readable URL wire format. Validation is bring-your-own via
|
|
6
|
+
[Standard Schema](https://github.com/standard-schema/standard-schema) —
|
|
7
|
+
paramour owns serialization (the part validators can't do), your validator
|
|
8
|
+
owns the rules.
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
pnpm add paramour @paramour-js/next
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import { defineAppRoute, href, p } from "paramour";
|
|
16
|
+
|
|
17
|
+
export const productRoute = defineAppRoute("/product/[id]", {
|
|
18
|
+
params: { id: p.integer() },
|
|
19
|
+
search: { q: p.string().optional() },
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// typed, validated, explicit: "/product/42?q=paramour"
|
|
23
|
+
href(productRoute, { params: { id: 42 }, search: { q: "paramour" } });
|
|
24
|
+
|
|
25
|
+
// a string into p.integer() fails to compile
|
|
26
|
+
href(productRoute, { params: { id: "42" } });
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Routes are plain imported objects — no central registry, nothing to
|
|
30
|
+
tree-shake around. Codecs are bidirectional wire converters with a
|
|
31
|
+
type-state modifier API (`.optional()`, `.default()`, `.catch()`) where
|
|
32
|
+
illegal chains fail to compile, and every codec serializes by a
|
|
33
|
+
[published, numbered spec](https://paramour.dev/docs/reference/wire-format).
|
|
34
|
+
|
|
35
|
+
## Docs
|
|
36
|
+
|
|
37
|
+
- [Getting started](https://paramour.dev/docs/getting-started)
|
|
38
|
+
- [Core API reference](https://paramour.dev/docs/reference/core)
|
|
39
|
+
- [Wire-format spec & explorer](https://paramour.dev/docs/reference/wire-format)
|
|
40
|
+
- [Migrating from next-typesafe-url](https://paramour.dev/docs/migrate)
|
|
41
|
+
|
|
42
|
+
## License
|
|
43
|
+
|
|
44
|
+
MIT © Jason Paff
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paramour",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"url": "git+https://github.com/JasonPaff/paramour.git",
|
|
34
34
|
"directory": "packages/core"
|
|
35
35
|
},
|
|
36
|
-
"homepage": "https://
|
|
36
|
+
"homepage": "https://paramour.dev",
|
|
37
37
|
"bugs": {
|
|
38
38
|
"url": "https://github.com/JasonPaff/paramour/issues"
|
|
39
39
|
},
|