@alxia/react-router 0.6.1 → 0.6.3
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 +4 -3
- package/docs/guide.md +6 -4
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -290,7 +290,8 @@ An API under `/api`, spec first, is checked against its OpenAPI document
|
|
|
290
290
|
by [`@alxia/openapi`](https://www.npmjs.com/package/@alxia/openapi)'s
|
|
291
291
|
`matchesSpec` (`bun add -d @alxia/openapi`), which reads `app.routes`. The
|
|
292
292
|
catch-all and the client's files are routes too, and no operation of the
|
|
293
|
-
document:
|
|
293
|
+
document: left alone, they only come back as `extra`, and `strict: true`
|
|
294
|
+
makes them fail:
|
|
294
295
|
|
|
295
296
|
```ts
|
|
296
297
|
// app/server.test.ts
|
|
@@ -304,12 +305,12 @@ import server from './server';
|
|
|
304
305
|
test('the API routes every operation of openapi.yaml, and nothing else', async () => {
|
|
305
306
|
const build: ServerBuild = await import(new URL('../build/server/index.js', import.meta.url).href);
|
|
306
307
|
const app = server.create({ build });
|
|
307
|
-
matchesSpec(app, operations, { exclude: isReactRouterRoute });
|
|
308
|
+
matchesSpec(app, operations, { strict: true, exclude: isReactRouterRoute });
|
|
308
309
|
});
|
|
309
310
|
```
|
|
310
311
|
|
|
311
312
|
`isReactRouterRoute` is true for each route this package declared, so
|
|
312
|
-
`matchesSpec` checks your own routes alone
|
|
313
|
+
`matchesSpec` checks your own routes alone, under `strict`.
|
|
313
314
|
|
|
314
315
|
## Built for Bun
|
|
315
316
|
|
package/docs/guide.md
CHANGED
|
@@ -1101,9 +1101,10 @@ refused when the server starts: see
|
|
|
1101
1101
|
alxia is OpenAPI spec first: the document is written by hand, the API's
|
|
1102
1102
|
routes are bound to the operations generated from it, and
|
|
1103
1103
|
[`@alxia/openapi`](https://www.npmjs.com/package/@alxia/openapi)'s
|
|
1104
|
-
`matchesSpec` checks, in a test, that
|
|
1105
|
-
|
|
1106
|
-
|
|
1104
|
+
`matchesSpec` checks, in a test, that every operation has its route; with
|
|
1105
|
+
`strict: true`, that `app.routes` and the operations match both ways. The
|
|
1106
|
+
catch-all and the client's files are routes of `app.routes`, and no
|
|
1107
|
+
operation of the document. Under `strict`, leave them out with
|
|
1107
1108
|
`isReactRouterRoute`, which is true for each route this package declared:
|
|
1108
1109
|
|
|
1109
1110
|
```ts
|
|
@@ -1132,6 +1133,7 @@ test('the API routes every operation of openapi.yaml, and nothing else', async (
|
|
|
1132
1133
|
const build: ServerBuild = await import(new URL('../build/server/index.js', import.meta.url).href);
|
|
1133
1134
|
const app = server.create({ build });
|
|
1134
1135
|
matchesSpec(app, operations, {
|
|
1136
|
+
strict: true,
|
|
1135
1137
|
exclude: (route) => isReactRouterRoute(route) || route.path === '/api/health',
|
|
1136
1138
|
});
|
|
1137
1139
|
});
|
|
@@ -1140,7 +1142,7 @@ test('the API routes every operation of openapi.yaml, and nothing else', async (
|
|
|
1140
1142
|
When the app puts the operations under a prefix the document's paths
|
|
1141
1143
|
leave out, `app.group('/api', (api) => api.route(…))`, give `matchesSpec`
|
|
1142
1144
|
the same `prefix: '/api'`. See
|
|
1143
|
-
[`@alxia/openapi`'s
|
|
1145
|
+
[`@alxia/openapi`'s matching](https://github.com/softistx/alxia/blob/develop/packages/openapi/docs/guide/matching.md#under-a-prefix).
|
|
1144
1146
|
|
|
1145
1147
|
## Testing
|
|
1146
1148
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alxia/react-router",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "alxia as the server of a React Router framework app: server rendering behind the app's hooks, loaders reading its typed context, the client's assets served",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
]
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@alxia/compress": "^0.3.
|
|
55
|
-
"@alxia/core": "^0.
|
|
56
|
-
"@alxia/openapi": "^0.
|
|
54
|
+
"@alxia/compress": "^0.3.3",
|
|
55
|
+
"@alxia/core": "^0.8.0",
|
|
56
|
+
"@alxia/openapi": "^0.6.2",
|
|
57
57
|
"@react-router/dev": "^8.4.0",
|
|
58
58
|
"@types/bun": "^1.4.2",
|
|
59
59
|
"@types/react": "^19.3.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"vite": "^7.0.0"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"@alxia/core": "^0.
|
|
68
|
+
"@alxia/core": "^0.8.0",
|
|
69
69
|
"react-router": "^8.0.0",
|
|
70
70
|
"typescript": "^6.0.3 || ^7.0.0",
|
|
71
71
|
"vite": "^7.0.0 || ^8.0.0"
|