@akanjs/devkit 3.3.0-rc.60 → 3.3.0-rc.61

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.
@@ -78,10 +78,17 @@ File names, stages, the `.render()` order and what a route file must never do ar
78
78
  - A page state a push opens in the query (a record in `?id=`): close it with `router.backOrReplace(href)`, never
79
79
  `router.back()` or a `renderMode` branch. A CSR or native stack rewrites a push that keeps the pathname rather than
80
80
  stacking it, and the address may be opened directly.
81
- - A client filter kept in the URL without reloading the page: ``router.replace(`/books?q=${q}`, { shallow: true,
82
- scrollToTop: false })`` in a `"use client"` component, read back with `usePageLocation().searchParams`, which
83
- follows the replace and the back and forward buttons. Shallow holds only while the path stays the same; a server
84
- `.search()` sees the value at the next full navigation.
81
+ - A client filter kept in the URL without reloading the page: the URL is the state, in a `"use client"` component.
82
+
83
+ ```tsx
84
+ const { searchParams } = usePageLocation(); // akanjs/webkit
85
+ const genre = typeof searchParams.genre === "string" ? searchParams.genre : "all";
86
+ const setGenre = (next: string) => router.replace(`/books?genre=${next}`, { shallow: true, scrollToTop: false });
87
+ ```
88
+
89
+ `searchParams` follows the replace and the back and forward buttons. Never keep the filter in `useState`: a shallow
90
+ back draws no page, so the copy stays on the old value while the URL moves. Shallow holds only while the path stays
91
+ the same; a server `.search()` sees the value at the next full navigation.
85
92
  - On a web page's first render `st.use.searchParams()` is still the server's empty snapshot, synced right after
86
93
  hydration, so an effect that needs the query on its first run takes the page's `.search()` value as a prop.
87
94
  - A `Link` renders its page ahead of the click, guards included: on hover, on keyboard focus, or as it shows with
@@ -28,6 +28,16 @@ describe("ApiReference", () => {
28
28
  expect(rendered).toMatch(/^\/\*\* .+ \*\/\nserverMode\?: "batch" \| "federation";$/m);
29
29
  });
30
30
 
31
+ test("says under an entry what its signature cannot: a search is always optional, an adaptor has a logger and hooks", () => {
32
+ expect(rendered).toMatch(/^\.search<.+option\?: Omit<EndpointArgProps, "nullable">\)$/m);
33
+ expect(rendered).toMatch(
34
+ /^```\n\n`\.search\(\)` is always optional and takes no `nullable`: .+`T \| undefined`\./m,
35
+ );
36
+ expect(rendered).toMatch(
37
+ /^```\n\nA class extending `adapt\(name\)` has `this\.logger`; .+`onInit\(\)` .+`onDestroy\(\)` .+\.$/m,
38
+ );
39
+ });
40
+
31
41
  test("says what each listed subpath holds, and lists only subpaths the package exports", async () => {
32
42
  const exports = Object.keys((await Bun.file(path.join(akanjsDir, "package.json")).json()).exports);
33
43
  const listed = [...rendered.matchAll(/^- `akanjs\/([^`]+)` — .+\.$/gm)].map(([, subpath]) => `./${subpath}`);
@@ -12,6 +12,7 @@ interface Item {
12
12
  from?: string;
13
13
  file?: string;
14
14
  show: Show;
15
+ note?: string;
15
16
  }
16
17
 
17
18
  interface Section {
@@ -58,7 +59,12 @@ const sections: Section[] = [
58
59
  {
59
60
  title: "Services and adapters (`lib/_<service>/`, `srvkit/`)",
60
61
  items: [
61
- { name: "adapt", from: "akanjs/service", show: { kind: "signature" } },
62
+ {
63
+ name: "adapt",
64
+ from: "akanjs/service",
65
+ show: { kind: "signature" },
66
+ note: "A class extending `adapt(name)` has `this.logger`; the server awaits its `onInit()` before the app serves and its `onDestroy()` when it stops.",
67
+ },
62
68
  { name: "serve", from: "akanjs/service", show: { kind: "signature" } },
63
69
  { name: "ServiceOptions", file: "service/serve.ts", show: { kind: "props" } },
64
70
  ],
@@ -74,6 +80,7 @@ const sections: Section[] = [
74
80
  name: "EndpointInfo",
75
81
  file: "signal/endpointInfo.ts",
76
82
  show: { kind: "members", only: ["param", "search", "body", "room", "msg", "with", "exec"] },
83
+ note: "`.search()` is always optional and takes no `nullable`: the caller may omit it or pass `null`, and the handler gets `T | undefined`.",
77
84
  },
78
85
  { name: "EndpointArgProps", file: "signal/endpointInfo.ts", show: { kind: "props" } },
79
86
  {
@@ -194,18 +201,19 @@ export class ApiReference {
194
201
  const symbol = item.from ? reader.exported(item.from, item.name) : reader.declared(item.file ?? "", item.name);
195
202
  const where = item.from ? ` · \`${item.from}\`` : "";
196
203
  const heading = `### \`${item.name}\`${where}`;
204
+ const note = item.note ? ["", item.note] : [];
197
205
  if (item.show.kind === "declaration")
198
- return [heading, "", "```ts", reader.declarationText(symbol), "```"].join("\n");
206
+ return [heading, "", "```ts", reader.declarationText(symbol), "```", ...note].join("\n");
199
207
  if (item.show.kind === "signature")
200
- return [heading, "", "```ts", ...reader.signatures(symbol, item.name), "```"].join("\n");
208
+ return [heading, "", "```ts", ...reader.signatures(symbol, item.name), "```", ...note].join("\n");
201
209
  if (item.show.kind === "props") {
202
210
  const bases = reader.foreignBases(symbol).map((base) => `\`${base}\``);
203
211
  const inherits = bases.length ? ["", `Every prop of ${bases.join(" and ")}, and:`] : [];
204
212
  const props = reader.props(reader.declaredType(symbol), item.show.omit);
205
- return [heading, ...inherits, "", "```ts", ...props, "```"].join("\n");
213
+ return [heading, ...inherits, "", "```ts", ...props, "```", ...note].join("\n");
206
214
  }
207
215
  const members = reader.members(reader.instanceType(symbol), item.show);
208
- return [heading, "", "```ts", ...members.map(([, line]) => line), "```"].join("\n");
216
+ return [heading, "", "```ts", ...members.map(([, line]) => line), "```", ...note].join("\n");
209
217
  }
210
218
 
211
219
  static #routeStages(reader: DeclarationReader): string {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/devkit",
3
- "version": "3.3.0-rc.60",
3
+ "version": "3.3.0-rc.61",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -50,7 +50,7 @@
50
50
  "./workspace/getRelatedCnsts": "./workspace/getRelatedCnsts.ts"
51
51
  },
52
52
  "dependencies": {
53
- "@akanjs/language": "3.3.0-rc.60",
53
+ "@akanjs/language": "3.3.0-rc.61",
54
54
  "@earendil-works/pi-agent-core": "1.5.2",
55
55
  "@earendil-works/pi-ai": "1.5.2",
56
56
  "@earendil-works/pi-codemode": "1.5.2",
@@ -59,7 +59,7 @@
59
59
  "@earendil-works/pi-tui": "1.5.2",
60
60
  "@inquirer/prompts": "^8.7.3",
61
61
  "@tailwindcss/node": "^4.3.3",
62
- "akanjs": "3.3.0-rc.60",
62
+ "akanjs": "3.3.0-rc.61",
63
63
  "chalk": "^6.0.1",
64
64
  "commander": "^15.0.0",
65
65
  "dayjs": "^1.11.23",