@weftui/router 0.31.0 → 0.31.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 +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +2 -2
- package/dist/{compile-DFlX4Atp.d.ts → compile-5obouTv5.d.ts} +2 -2
- package/dist/{href-wIrP-_-3.js → href-CKWRrVHS.js} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/{outlet-Crd9mxZA.js → outlet-CjFu693e.js} +4 -4
- package/dist/{outlet-CWpiNOxW.d.ts → outlet-MSeMrGHd.d.ts} +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +1 -1
- package/docs/how-to/add-routing.md +1 -1
- package/docs/how-to/load-data-with-rpc.md +1 -1
- package/docs/reference/router.md +2 -2
- package/docs/tutorial/01-your-first-app.md +2 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -9,10 +9,10 @@ Three entry points mirror `@weftui/dom`: `@weftui/router` (authoring + universal
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npm install @weftui/core @weftui/dom @weftui/router effect@
|
|
12
|
+
npm install @weftui/core @weftui/dom @weftui/router effect@rc
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
Weft tracks Effect 4's beta
|
|
15
|
+
Weft tracks Effect 4's prerelease line (beta, then rc). This release is built and tested against `effect@4.0.0-rc.112`; the peer range accepts newer 4.0 prereleases, which may contain upstream breaking changes.
|
|
16
16
|
|
|
17
17
|
`effect` is a peer dependency; `@weftui/core` and `@weftui/dom` provide the tree and renderer.
|
|
18
18
|
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as Router, b as NavState, i as RouterDef, m as RouteNode, u as Fields, x as NavigateOptions } from "../compile-
|
|
2
|
-
import { n as outletNode, r as HrefArgs, t as RouterApp } from "../outlet-
|
|
1
|
+
import { S as Router, b as NavState, i as RouterDef, m as RouteNode, u as Fields, x as NavigateOptions } from "../compile-5obouTv5.js";
|
|
2
|
+
import { n as outletNode, r as HrefArgs, t as RouterApp } from "../outlet-MSeMrGHd.js";
|
|
3
3
|
import { Effect, Layer, Scope } from "effect";
|
|
4
4
|
import { AppRpcClientTag } from "@weftui/core";
|
|
5
5
|
import { RpcGroup } from "effect/unstable/rpc";
|
package/dist/client/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as Router, i as setResolvedCommit, n as outletNode, o as getPreload, r as preRunLeaf, t as RouterApp } from "../outlet-
|
|
2
|
-
import { r as match, t as href } from "../href-
|
|
1
|
+
import { a as Router, i as setResolvedCommit, n as outletNode, o as getPreload, r as preRunLeaf, t as RouterApp } from "../outlet-CjFu693e.js";
|
|
2
|
+
import { r as match, t as href } from "../href-CKWRrVHS.js";
|
|
3
3
|
import { HttpApiClient } from "effect/unstable/httpapi";
|
|
4
4
|
import { Context, Effect, Exit, Fiber, Layer, Option, Schema, Scope, Stream, SubscriptionRef } from "effect";
|
|
5
5
|
import { AppRpcClientTag, Subscribable } from "@weftui/core";
|
|
@@ -12,7 +12,7 @@ declare const RouterNotFound_base: Schema.Class<RouterNotFound, Schema.TaggedStr
|
|
|
12
12
|
* `Boundary.catchTag("RouterNotFound", …)` to override the fallback for a subtree
|
|
13
13
|
* (the router's internal boundary is outermost, so a nearer user boundary wins).
|
|
14
14
|
*
|
|
15
|
-
* Modeled as a `Schema.
|
|
15
|
+
* Modeled as a `Schema.TaggedError` so it can be encoded/decoded across the wire
|
|
16
16
|
* the same way `Boundary.rpc` replays typed failures.
|
|
17
17
|
*/
|
|
18
18
|
declare class RouterNotFound extends RouterNotFound_base {}
|
|
@@ -43,7 +43,7 @@ declare const RouterParamsError_base: Schema.Class<RouterParamsError, Schema.Tag
|
|
|
43
43
|
* It bubbles up through the route tree's aggregate error channel, so a user may
|
|
44
44
|
* place a `Boundary.catchTag("RouterParamsError", …)` to recover within a subtree.
|
|
45
45
|
*
|
|
46
|
-
* Modeled as a `Schema.
|
|
46
|
+
* Modeled as a `Schema.TaggedError` so it can be encoded/decoded across the wire
|
|
47
47
|
* the same way `RouterNotFound` and `Boundary.rpc` replay typed failures.
|
|
48
48
|
*/
|
|
49
49
|
declare class RouterParamsError extends RouterParamsError_base {}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as notFound, C as RouterHttpApiClient, D as RouterNotFound, E as match, O as RouterParamsError, S as Router, T as compileMatchers, _ as TreeE, a as RouterOptions, b as NavState, c as leafRegistry, d as FieldsType, f as LayoutNode, g as SubtreeR, h as SubtreeE, i as RouterDef, k as isRouterNotFound, l as ComponentSlot, m as RouteNode, n as CompiledLayout, o as buildHttpApi, p as RouteHandlerProps, r as CompiledLeaf, s as compile, t as Compiled, u as Fields, v as TreeNode, w as RouteMatch, x as NavigateOptions, y as TreeR } from "./compile-
|
|
2
|
-
import { i as href, n as outletNode, r as HrefArgs, t as RouterApp } from "./outlet-
|
|
1
|
+
import { A as notFound, C as RouterHttpApiClient, D as RouterNotFound, E as match, O as RouterParamsError, S as Router, T as compileMatchers, _ as TreeE, a as RouterOptions, b as NavState, c as leafRegistry, d as FieldsType, f as LayoutNode, g as SubtreeR, h as SubtreeE, i as RouterDef, k as isRouterNotFound, l as ComponentSlot, m as RouteNode, n as CompiledLayout, o as buildHttpApi, p as RouteHandlerProps, r as CompiledLeaf, s as compile, t as Compiled, u as Fields, v as TreeNode, w as RouteMatch, x as NavigateOptions, y as TreeR } from "./compile-5obouTv5.js";
|
|
2
|
+
import { i as href, n as outletNode, r as HrefArgs, t as RouterApp } from "./outlet-MSeMrGHd.js";
|
|
3
3
|
export { type Compiled, type CompiledLayout, type CompiledLeaf, type ComponentSlot, type Fields, type FieldsType, type HrefArgs, type LayoutNode, type NavState, type NavigateOptions, type RouteHandlerProps, type RouteMatch, type RouteNode, Router, RouterApp, type RouterDef, type RouterHttpApiClient, RouterNotFound, type RouterOptions, RouterParamsError, type SubtreeE, type SubtreeR, type TreeE, type TreeNode, type TreeR, buildHttpApi, compile, compileMatchers, href, isRouterNotFound, leafRegistry, match, notFound, outletNode };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as Router, c as compile, d as RouterParamsError, f as isRouterNotFound, l as leafRegistry, n as outletNode, p as notFound, s as buildHttpApi, t as RouterApp, u as RouterNotFound } from "./outlet-
|
|
2
|
-
import { n as compileMatchers, r as match, t as href } from "./href-
|
|
1
|
+
import { a as Router, c as compile, d as RouterParamsError, f as isRouterNotFound, l as leafRegistry, n as outletNode, p as notFound, s as buildHttpApi, t as RouterApp, u as RouterNotFound } from "./outlet-CjFu693e.js";
|
|
2
|
+
import { n as compileMatchers, r as match, t as href } from "./href-CKWRrVHS.js";
|
|
3
3
|
export { Router, RouterApp, RouterNotFound, RouterParamsError, buildHttpApi, compile, compileMatchers, href, isRouterNotFound, leafRegistry, match, notFound, outletNode };
|
|
@@ -8,10 +8,10 @@ import { Boundary, Subscribable, getElementDescriptor, h } from "@weftui/core";
|
|
|
8
8
|
* `Boundary.catchTag("RouterNotFound", …)` to override the fallback for a subtree
|
|
9
9
|
* (the router's internal boundary is outermost, so a nearer user boundary wins).
|
|
10
10
|
*
|
|
11
|
-
* Modeled as a `Schema.
|
|
11
|
+
* Modeled as a `Schema.TaggedError` so it can be encoded/decoded across the wire
|
|
12
12
|
* the same way `Boundary.rpc` replays typed failures.
|
|
13
13
|
*/
|
|
14
|
-
var RouterNotFound = class extends Schema.
|
|
14
|
+
var RouterNotFound = class extends Schema.TaggedError()("RouterNotFound", {
|
|
15
15
|
/** The path that could not be resolved, when known. */
|
|
16
16
|
path: Schema.optional(Schema.String) }) {};
|
|
17
17
|
/**
|
|
@@ -35,10 +35,10 @@ const isRouterNotFound = (u) => typeof u === "object" && u !== null && "_tag" in
|
|
|
35
35
|
* It bubbles up through the route tree's aggregate error channel, so a user may
|
|
36
36
|
* place a `Boundary.catchTag("RouterParamsError", …)` to recover within a subtree.
|
|
37
37
|
*
|
|
38
|
-
* Modeled as a `Schema.
|
|
38
|
+
* Modeled as a `Schema.TaggedError` so it can be encoded/decoded across the wire
|
|
39
39
|
* the same way `RouterNotFound` and `Boundary.rpc` replay typed failures.
|
|
40
40
|
*/
|
|
41
|
-
var RouterParamsError = class extends Schema.
|
|
41
|
+
var RouterParamsError = class extends Schema.TaggedError()("RouterParamsError", {
|
|
42
42
|
/** Which side of the match failed validation. */
|
|
43
43
|
source: Schema.Literals(["path", "query"]),
|
|
44
44
|
/** The requested field names, for diagnostics. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as RouterNotFound, S as Router, d as FieldsType, i as RouterDef, m as RouteNode, u as Fields } from "./compile-
|
|
1
|
+
import { D as RouterNotFound, S as Router, d as FieldsType, i as RouterDef, m as RouteNode, u as Fields } from "./compile-5obouTv5.js";
|
|
2
2
|
import { Node } from "@weftui/core";
|
|
3
3
|
//#region src/href.d.ts
|
|
4
4
|
/**
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as Router, i as RouterDef, l as ComponentSlot } from "../compile-
|
|
1
|
+
import { S as Router, i as RouterDef, l as ComponentSlot } from "../compile-5obouTv5.js";
|
|
2
2
|
import { Effect, Layer } from "effect";
|
|
3
3
|
import { AppRpcClientTag } from "@weftui/core";
|
|
4
4
|
import { RpcGroup } from "effect/unstable/rpc";
|
package/dist/server/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as Router, f as isRouterNotFound, n as outletNode, u as RouterNotFound } from "../outlet-
|
|
1
|
+
import { a as Router, f as isRouterNotFound, n as outletNode, u as RouterNotFound } from "../outlet-CjFu693e.js";
|
|
2
2
|
import { HttpApiBuilder, HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
|
|
3
3
|
import { Cause, Effect, Exit, Layer, Option, Schema, Scope, Stream } from "effect";
|
|
4
4
|
import { AppRpcClientTag, Subscribable } from "@weftui/core";
|
|
@@ -551,7 +551,7 @@ Option.isSome(httpApiClient); // true under RouterLive, false under RouterServer
|
|
|
551
551
|
| `RouterNotFound` | `notFound()`, or no route matched | `Boundary.catchTag(…)` (or the app-level `notFound` page) |
|
|
552
552
|
| `RouterParamsError` | `Router.params` / `Router.query` on a missing/invalid key or no match | `Boundary.catchTag(…)` |
|
|
553
553
|
|
|
554
|
-
Both are modeled as `Schema.
|
|
554
|
+
Both are modeled as `Schema.TaggedError`, so they encode/decode across the wire the same way `Boundary.rpc` replays typed failures.
|
|
555
555
|
|
|
556
556
|
Recover locally by wrapping just the subtree that can fail, rather than relying on the app-level `notFound` page for everything:
|
|
557
557
|
|
|
@@ -163,7 +163,7 @@ Give the rpc an `error` schema and a resolved rpc **error** on the SSR pass is `
|
|
|
163
163
|
import { Rpc, RpcGroup } from "effect/unstable/rpc";
|
|
164
164
|
import { Schema } from "effect";
|
|
165
165
|
|
|
166
|
-
export class OutOfStock extends Schema.
|
|
166
|
+
export class OutOfStock extends Schema.TaggedError<OutOfStock>()("OutOfStock", {
|
|
167
167
|
reason: Schema.String,
|
|
168
168
|
}) {}
|
|
169
169
|
|
package/docs/reference/router.md
CHANGED
|
@@ -316,11 +316,11 @@ Dispatch runs through the `def.httpApi` spine via `HttpApiBuilder`: platform own
|
|
|
316
316
|
|
|
317
317
|
### `RouterNotFound`
|
|
318
318
|
|
|
319
|
-
`Schema.
|
|
319
|
+
`Schema.TaggedError` with an optional `path: string`. Raised by [`notFound`](#notfound) or when no route matches. Caught by the router's internal not-found boundary; export it to place your own `Boundary.catchTag("RouterNotFound", …)` (a nearer user boundary wins).
|
|
320
320
|
|
|
321
321
|
### `RouterParamsError`
|
|
322
322
|
|
|
323
|
-
`Schema.
|
|
323
|
+
`Schema.TaggedError` with `source: "path" | "query"` and `keys: readonly string[]`. Raised by `Router.params` / `Router.query` when the live match doesn't satisfy the requested fields. Bubbles into the tree's aggregate error channel.
|
|
324
324
|
|
|
325
325
|
### `notFound`
|
|
326
326
|
|
|
@@ -14,10 +14,10 @@ Across this tutorial you build one app: a counter. This step renders its static
|
|
|
14
14
|
## Install
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
npm install @weftui/core @weftui/dom effect@
|
|
17
|
+
npm install @weftui/core @weftui/dom effect@rc
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
Weft tracks Effect 4's beta
|
|
20
|
+
Weft tracks Effect 4's prerelease line (beta, then rc). This release is built and tested against `effect@4.0.0-rc.112`; the peer range accepts newer 4.0 prereleases, which may contain upstream breaking changes.
|
|
21
21
|
|
|
22
22
|
## Build and mount it
|
|
23
23
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weftui/router",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.1",
|
|
4
4
|
"description": "Universal nested router for Weft: one route tree, server and client, with type-safe params and href",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"effect",
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@weftui/core": "0.31.
|
|
48
|
-
"@weftui/dom": "0.31.
|
|
47
|
+
"@weftui/core": "0.31.1",
|
|
48
|
+
"@weftui/dom": "0.31.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/jsdom": "^28.0.3",
|
|
52
52
|
"@types/node": "^26.1.1",
|
|
53
|
-
"effect": "4.0.0-
|
|
53
|
+
"effect": "4.0.0-rc.112",
|
|
54
54
|
"jsdom": "^29.1.1",
|
|
55
55
|
"tstyche": "^7.2.2",
|
|
56
56
|
"tsx": "^4.23.1",
|
|
@@ -59,6 +59,6 @@
|
|
|
59
59
|
"vite-plus": "0.2.5"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
|
-
"effect": ">=4.0.0-
|
|
62
|
+
"effect": ">=4.0.0-rc.112 <4.0.0"
|
|
63
63
|
}
|
|
64
64
|
}
|