@real-router/search-schema-plugin 0.1.2 → 0.2.0
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 +14 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/esm/index.d.mts.map +1 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -54,6 +54,20 @@ router.usePlugin(searchSchemaPlugin({ mode: "development" }));
|
|
|
54
54
|
|
|
55
55
|
> **Schema libraries:** Any library implementing [Standard Schema V1](https://github.com/standard-schema/standard-schema) works — Zod 3.24+, Valibot 1.0+, ArkType. Install and configure your chosen library separately; the plugin has no schema-library dependency.
|
|
56
56
|
|
|
57
|
+
## TypeScript Support
|
|
58
|
+
|
|
59
|
+
Import `@real-router/search-schema-plugin` to enable TypeScript support for `searchSchema` on route definitions:
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
import "@real-router/search-schema-plugin"; // enables Route.searchSchema type
|
|
63
|
+
|
|
64
|
+
const routes = [
|
|
65
|
+
{ name: "users", path: "/users", searchSchema: z.object({ page: z.number() }) },
|
|
66
|
+
];
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
This works via [module augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html) — the package extends the `Route` interface from `@real-router/core`.
|
|
70
|
+
|
|
57
71
|
## Configuration
|
|
58
72
|
|
|
59
73
|
| Option | Type | Default | Description |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/types.ts","../../src/factory.ts","../../src/index.ts"],"mappings":";;;;UAUiB,qBAAA;EAAA,SACN,OAAA;EAAA,SACA,IAAA,aACK,WAAA;IAAA,SAAyB,GAAA,EAAK,WAAA;EAAA;AAAA;;KAKlC,sBAAA;EAAA,SACG,KAAA,EAAO,MAAA;AAAA;EAAA,SACP,MAAA,WAAiB,qBAAA;AAAA;AAFhC;;;;;;AAAA,UAUiB,gBAAA,2BAA2C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;;;EAAA,SAuCF,MAAA;EAjC4B;;;;;;;;AAcvC;;;;;;EAduC,SAiD5B,OAAA,IACP,SAAA,UACA,MAAA,EAAQ,MAAA,EACR,MAAA,WAAiB,qBAAA,OACd,MAAA;AAAA;;;iBCjFS,kBAAA,CACd,OAAA,GAAS,yBAAA,GACR,aAAA;;;;YCLS,KAAA;IACR,YAAA,GAAe,gBAAA;EAAA;AAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@real-router/search-schema-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"description": "Runtime search parameter validation via Standard Schema for Real-Router",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"types": "./dist/esm/index.d.mts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
+
"@real-router/internal-source": "./src/index.ts",
|
|
11
12
|
"types": {
|
|
12
13
|
"import": "./dist/esm/index.d.mts",
|
|
13
14
|
"require": "./dist/cjs/index.d.ts"
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
"homepage": "https://github.com/greydragon888/real-router",
|
|
46
47
|
"sideEffects": false,
|
|
47
48
|
"dependencies": {
|
|
48
|
-
"@real-router/core": "^0.
|
|
49
|
+
"@real-router/core": "^0.47.0"
|
|
49
50
|
},
|
|
50
51
|
"scripts": {
|
|
51
52
|
"test": "vitest",
|
|
@@ -54,7 +55,6 @@
|
|
|
54
55
|
"type-check": "tsc --noEmit",
|
|
55
56
|
"lint": "eslint --cache --ext .ts src/ tests/ --fix --max-warnings 0",
|
|
56
57
|
"lint:package": "publint",
|
|
57
|
-
"lint:types": "attw --pack ."
|
|
58
|
-
"build:dist-only": "tsdown --config-loader unrun"
|
|
58
|
+
"lint:types": "attw --pack ."
|
|
59
59
|
}
|
|
60
60
|
}
|