@abide/abide 0.117.2 → 0.118.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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @abide/abide
2
2
 
3
+ ## 0.118.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 1613343: Breaking: a handler file is named <name>.handler.ts (RULEBOOK 23.14, 23.22) ([`5f64c1b`](https://github.com/briancray/abide/commit/5f64c1b02dec18c6e8574a88ee46e2f7477bee71))
8
+ - 1613343: Breaking: a route param names a matcher in a <NAME>.param.ts, and one naming none takes no part carrying a period (RULEBOOK 23.24-23.27, 30.34-30.37, 20.23) ([`db7b00d`](https://github.com/briancray/abide/commit/db7b00d07bbb8f47bc73a757356675555b276b51))
9
+
10
+ ### Patch Changes
11
+
12
+ - 1613343: a page answers 404 to a request that cannot display it, before its setup runs (RULEBOOK 35.19) ([`7276d7c`](https://github.com/briancray/abide/commit/7276d7c41a44b5602b9dd4a779f85b3a05aa260f))
13
+
3
14
  ## 0.117.2
4
15
 
5
16
  ### Patch Changes
package/docs/REGISTRY.md CHANGED
@@ -264,9 +264,9 @@ type Gated<Gate, Accepted> = [Schema<Accepted>] extends [Gate] ? never : Failed<
264
264
 
265
265
  | File | Declares | Served at | Rules |
266
266
  | --- | --- | --- | --- |
267
- | `users/getUser.ts` | `export default GET(…)` | `/users/getUser` | 16.2, 16.73, 19.1, 19.20, 23.14 |
268
- | `health.ts` | `export default GET(…)` | `/health` | 16.2, 23.14 |
269
- | `media/[id]/save.ts` | `export default POST(…)` | `/media/[id]/save`, `id` reaching its `Args` | 16.2, 16.65, 16.66, 16.67, 16.69 |
267
+ | `users/getUser.handler.ts` | `export default GET(…)` | `/users/getUser` | 16.2, 16.73, 19.1, 19.20, 23.14 |
268
+ | `health.handler.ts` | `export default GET(…)` | `/health` | 16.2, 23.14 |
269
+ | `media/[id]/save.handler.ts` | `export default POST(…)` | `/media/[id]/save`, `id` reaching its `Args` | 16.2, 16.65, 16.66, 16.67, 16.69 |
270
270
  | `media/[id]/lib/Comments.abide` | `const addComment = POST(…)` in its `<script server>` | `/__abide/handlers/media/id/lib/Comments/addComment` | 16.70, 16.71, 16.72 |
271
271
 
272
272
  ## Schemas
@@ -315,14 +315,14 @@ type Gated<Gate, Accepted> = [Schema<Accepted>] extends [Gate] ? never : Failed<
315
315
 
316
316
  | Name | Signature | Meaning | Rules |
317
317
  | --- | --- | --- | --- |
318
- | `/__abide/openapi.json` | `GET` | The generated OpenAPI document. | 19.21, 19.22, 20.5, 20.6, 20.7, 20.8, 20.11, 20.13, 20.15, 36.7 |
318
+ | `/__abide/openapi.json` | `GET` | The generated OpenAPI document. | 19.21, 19.22, 20.5, 20.6, 20.7, 20.8, 20.11, 20.13, 20.15, 20.23, 36.7 |
319
319
  | `OpenApiDocument` | `JsonValue` | OpenAPI 3.1, whose schema dialect is `JsonSchema`. | 20.6 |
320
320
 
321
321
  ## MCP
322
322
 
323
323
  | Name | Signature | Meaning | Rules |
324
324
  | --- | --- | --- | --- |
325
- | `/__abide/mcp` | `POST` | The streamable-http MCP endpoint. | 19.21, 19.22, 20.5, 20.7, 20.8, 20.9, 20.10, 20.12, 20.13, 20.14, 20.16, 20.17, 20.19, 20.20, 20.21, 20.22, 36.7, 16.78 |
325
+ | `/__abide/mcp` | `POST` | The streamable-http MCP endpoint. | 19.21, 19.22, 20.5, 20.7, 20.8, 20.9, 20.10, 20.12, 20.13, 20.14, 20.16, 20.17, 20.19, 20.20, 20.21, 20.22, 20.23, 36.7, 16.78 |
326
326
 
327
327
  # Assistant
328
328
 
@@ -513,8 +513,8 @@ type Gated<Gate, Accepted> = [Schema<Accepted>] extends [Gate] ? never : Failed<
513
513
  | `OptionalNames<P>` | `string` | The optional segment names. | 30.4 |
514
514
  | `RestNames<P>` | `string` | The rest segment names. | 30.5 |
515
515
  | `Query` | `Record<string, unknown> \| URLSearchParams` | The query half. | 30.6, 30.28 |
516
- | `ParamsOf<P>` | `& { [K in RequiredNames<P>]: string \| number } & { [K in OptionalNames<P>]?: string \| number } & { [K in RestNames<P>]?: string \| number \| (string \| number)[] }` | What a route literal's segments accept. | 30.3, 30.4, 30.5 |
517
- | `RouteParams<P>` | `{ [K in RequiredNames<P>]: string } & { [K in OptionalNames<P>]?: string } & { [K in RestNames<P>]: string[] }` | What a page filed under `P` reads its params as. | 23.9 |
516
+ | `ParamsOf<P>` | `& { [K in RequiredNames<P>]: string \| number } & { [K in OptionalNames<P>]?: string \| number } & { [K in RestNames<P>]?: string \| number \| (string \| number)[] }` | What a route literal's segments accept, narrowed where `abide check` declares a matcher's literals. | 30.3, 30.4, 30.5 |
517
+ | `RouteParams<P>` | `{ [K in RequiredNames<P>]: string } & { [K in OptionalNames<P>]?: string } & { [K in RestNames<P>]: string[] }` | What a page filed under `P` reads its params as, narrowed where `abide check` declares a matcher's literals. | 23.9 |
518
518
  | `Routes` | `interface Routes {}` | The app's route literals and public file addresses, which `abide check` declares. | 30.26 |
519
519
  | `RouteLiteral` | `[keyof Routes] extends [never] ? string : Extract<keyof Routes, string>` | What `url` takes. | 30.26 |
520
520
 
@@ -619,9 +619,10 @@ type Gated<Gate, Accepted> = [Schema<Accepted>] extends [Gate] ? never : Failed<
619
619
  | --- | --- | --- |
620
620
  | `<head>` | A page's, layout's or component's contribution to the document head. | 39.1, 39.2, 39.3, 39.4, 39.5, 39.6, 39.11, 39.12, 39.13, 39.14, 39.15, 39.16, 39.17 |
621
621
  | `view-transition-name` | What turns view transitions on, in the app's own stylesheet. | 39.7, 39.8, 39.9, 39.10, 39.18, 39.19 |
622
- | `[name]` | A required dynamic segment. | 16.65, 23.5, 30.3 |
623
- | `[[name]]` | An optional segment. | 23.5, 30.4 |
624
- | `[...name]` | A rest segment, terminal. | 23.5, 30.5 |
622
+ | `[name]` | A required dynamic segment. | 16.65, 23.5, 30.3, 30.34, 30.36 |
623
+ | `[[name]]` | An optional segment. | 23.5, 30.4, 30.34, 30.36 |
624
+ | `[...name]` | A rest segment, terminal. | 23.5, 30.5, 30.34, 30.36 |
625
+ | `[name=NAME]` · `[[name=NAME]]` · `[...name=NAME]` | A dynamic segment a param file's matcher decides. | 19.1, 23.26, 23.27, 30.19, 30.35, 30.36, 30.37 |
625
626
  | `/__abide/**` | Every endpoint abide controls. | 20.8 |
626
627
 
627
628
  ## `render`
@@ -684,9 +685,10 @@ type Gated<Gate, Accepted> = [Schema<Accepted>] extends [Gate] ? never : Failed<
684
685
  | `src/public/robots.txt` | The file answered at `/robots.txt`. | 36.11 |
685
686
  | `src/public/icon.png` · `src/public/icon.icns` | The files answered at `/icon.png` and `/icon.icns`, and the desktop app's icon. | 36.11, 38.79, 45.15 |
686
687
  | `src/**/` | A directory of the app's, a segment of the route of every file directly in it. | 23.14, 23.17, 23.22 |
687
- | `**/index.abide` | The page at its directory's route. | 19.1, 23.3, 23.4, 23.14, 23.18 |
688
- | `**/<name>.abide` | The page at its directory's route and then `<name>`. | 19.1, 23.3, 23.4, 23.14, 23.21 |
689
- | `**/<name>.ts` | A handler file: the handler its default export declares, at its directory's route and then `<name>`. | 16.2, 16.28, 16.73, 16.74, 19.1, 23.14, 23.22 |
688
+ | `**/index.abide` | The page at its directory's route. | 19.1, 23.3, 23.4, 23.14, 23.18, 35.19 |
689
+ | `**/<name>.abide` | The page at its directory's route and then `<name>`. | 19.1, 23.3, 23.4, 23.14, 23.21, 35.19 |
690
+ | `**/<NAME>.param.ts` | A param file: the matcher a segment naming `NAME` matches by. | 23.22, 23.24, 23.25, 23.26 |
691
+ | `**/<name>.handler.ts` | A handler file: the handler its default export declares, at its directory's route and then `<name>`. | 16.2, 16.28, 16.73, 16.74, 19.1, 23.14, 23.22 |
690
692
  | `**/layout.abide` | A layout, rendering every page below its route through a slot, and the hooks over that route. | 35.1, 35.12, 35.13, 37.2, 41.11, 41.19, 41.23 |
691
693
  | `src/launcher.abide` | The desktop launcher, beside the root layout: the `onLauncher` it calls, and its page in place of the launcher's own where it has markup. | 38.80, 38.82, 38.84, 38.85, 38.107 |
692
694
  | `src/layout.abide` | The root layout, whose `<script server>` is the app's own, and whose `<html>` is the document its pages are served in. | 35.15, 35.16, 35.17, 37.1, 37.3, 39.4 |
@@ -859,7 +861,7 @@ rows a runner prints, and an adapter for an abide app.
859
861
  | `abide scaffold <name>` | Writes a starter project. | 38.1, 38.42, 38.103, 38.104, 38.106, 38.112, 38.122, 38.124 |
860
862
  | `abide run <file> [args…]` | Runs a script under the abide runtime. | 38.2, 38.57 |
861
863
  | `abide check [dir…]` | The type-checker over a `.abide` tree. | 38.3, 38.31, 38.32, 38.33, 38.40, 38.105, 38.123 |
862
- | `abide routes [--json]` | Every address the app answers, the file answering it, and where each hook is filed. | 38.108, 38.123 |
864
+ | `abide routes [--json]` | Every address the app answers, the file answering it, what each matcher takes, and where each hook is filed. | 38.108, 38.123 |
863
865
  | `abide dev [--port <n>]` | Watches the project and keeps the app up. | 16.23, 16.56, 37.8, 37.9, 38.4, 38.14, 38.15, 38.16, 38.17, 38.19, 38.24, 38.25, 38.26, 38.28, 38.30, 38.35, 38.36, 38.37, 38.38, 38.41, 38.43, 38.58, 38.63, 38.64, 38.65, 38.94, 38.96, 38.97, 38.123 |
864
866
  | `abide build` | Builds the client into content-hashed chunks and a manifest. | 38.43, 38.5, 38.18, 38.25, 38.26, 38.27, 38.30, 38.66, 38.94, 38.123 |
865
867
  | `abide start [--port <n>]` | Boots the built app. | 37.8, 37.10, 37.11, 37.12, 38.6, 38.100, 38.20, 38.21, 38.22, 38.23, 38.25, 38.26, 38.27, 38.28, 38.29, 38.58, 38.67, 38.68, 38.95, 38.97, 38.110, 38.123 |
package/docs/RULEBOOK.md CHANGED
@@ -121,7 +121,9 @@ REGISTRY.md because none of them is a name an app author writes.
121
121
  | server file | A file named `<name>.server.<extension>`. |
122
122
  | test file | A `.test.ts` file. |
123
123
  | declaration file | A `.d.ts` file. |
124
- | handler file | A `.ts` of the app's own, neither a declaration file, a test file nor a server file, directly in a directory under no fence. |
124
+ | handler file | A file of the app's own named `<name>.handler.ts`, directly in a directory under no fence. |
125
+ | param file | A file of the app's own named `<NAME>.param.ts`, directly in a directory under no fence. |
126
+ | matcher | What a param file declares, and what a segment naming it matches by. |
125
127
  | private handler | A handler a `<script server>` declares. |
126
128
  | chapter app | The app the documentation's story has built by the end of one chapter, kept whole so a reader can download it and run it. |
127
129
 
@@ -1266,7 +1268,7 @@ while `outbox` holds a call not yet delivered, and MUST read the value again onc
1266
1268
 
1267
1269
  19.1 A route MUST be answered for each method by one file at most, a page answering `GET` and `HEAD`
1268
1270
  at its own, and a second MUST be a build error naming both files, two routes differing only in
1269
- their parameters' names being one route.
1271
+ their parameters' names or matchers being one route.
1270
1272
 
1271
1273
  19.2 A `Schema` MUST return what it accepts.
1272
1274
 
@@ -1405,6 +1407,10 @@ text, and MUST carry no `structuredContent`.
1405
1407
  20.22 A call to a tool declaring an `outputSchema` that is answered with an `image/*` body MUST be
1406
1408
  refused, its text naming the tool and the image's type, and MUST be logged per 20.18 as a 500.
1407
1409
 
1410
+ 20.23 A path parameter `/__abide/openapi.json` publishes, save a rest's, and a route parameter an MCP
1411
+ tool's input declares, a rest's on each of its items, MUST carry the pattern its segment takes a part
1412
+ by, anchored, and a matcher's name MUST be no part of the path, the operation or the tool.
1413
+
1408
1414
  # 21. Generated headers
1409
1415
 
1410
1416
  21.1 Every response MUST carry `x-content-type-options: nosniff`.
@@ -1517,7 +1523,8 @@ composite.
1517
1523
 
1518
1524
  23.9 In a page or a layout, `route.params()` MUST be typed by that file's own route: a required
1519
1525
  segment as text, an optional one as text that may be absent, a rest as a list, and in a layout any
1520
- segment a page below it adds.
1526
+ segment a page below it adds — under `abide check`, a page's required or optional segment whose
1527
+ matcher is an alternation of literals as the union of those literals.
1521
1528
 
1522
1529
  23.10 `reachable` MUST be true where the host answered a request, whatever the status it answered.
1523
1530
 
@@ -1527,8 +1534,9 @@ segment a page below it adds.
1527
1534
 
1528
1535
  23.13 `reachable` MUST ask a host that names no scheme over https, and an origin as written.
1529
1536
 
1530
- 23.14 A route MUST be the path of its file below the app's `--root` without its extension, and an
1531
- `index.abide`'s, a `layout.abide`'s and an `error.abide`'s MUST be its directory's.
1537
+ 23.14 A route MUST be the path of its file below the app's `--root` without its extension, a handler
1538
+ file's being `.handler.ts`, and an `index.abide`'s, a `layout.abide`'s and an `error.abide`'s MUST be
1539
+ its directory's.
1532
1540
 
1533
1541
  23.15 A file under a fence MUST NOT have a route.
1534
1542
 
@@ -1549,12 +1557,26 @@ error naming the mount.
1549
1557
  `layout.abide`, an `error.abide` and the root's `launcher.abide`.
1550
1558
 
1551
1559
  23.22 A file of the app's own directly in a directory under no fence that is neither a `.abide`, a
1552
- handler file, a test file, a bench file nor a declaration file MUST be a build error naming the file and a `lib` directory, save one
1560
+ handler file, a param file, a test file, a bench file nor a declaration file MUST be a build error naming the file and a `lib` directory, save one
1553
1561
  beside the `package.json` of a root that holds it, nor a `.ts`.
1554
1562
 
1555
1563
  23.23 A server file of the app's own under no `lib` directory MUST be a build error naming the file
1556
1564
  and a `lib` directory.
1557
1565
 
1566
+ 23.24 A param file MUST hold one `export const`, of the name it is filed under, whose value is a
1567
+ regular expression literal carrying no flag, and anything else, an import included, MUST be a build
1568
+ error naming the file.
1569
+
1570
+ 23.25 A matcher repeating, with `*`, `+` or `{n,}`, a group that itself holds such a repetition, or
1571
+ carrying a backreference, MUST be a build error naming its file.
1572
+
1573
+ 23.26 A segment `[name=NAME]`, `[[name=NAME]]` or `[...name=NAME]` MUST name the param file `NAME.param.ts`
1574
+ in the directory holding that segment or the nearest directory above it below the root it is filed
1575
+ under, and one naming none MUST be a build error naming the segment's file and `NAME`.
1576
+
1577
+ 23.27 Two routes naming different matchers, or a matcher and none, at one parameter position after
1578
+ one static prefix MUST be a build error naming both files.
1579
+
1558
1580
  # 24. Tracing
1559
1581
 
1560
1582
  24.1 `trace` MUST be built on first ask and held for the request.
@@ -1741,7 +1763,8 @@ MUST NOT consume `csp.nonce`.
1741
1763
  30.2 `url` MUST require a params argument where the literal carries a required segment, and MUST
1742
1764
  make it optional otherwise.
1743
1765
 
1744
- 30.3 A required segment MUST map to a required key of `ParamsOf<P>`.
1766
+ 30.3 A required segment MUST map to a required key of `ParamsOf<P>`, typed under `abide check` as
1767
+ 23.9 types it where its matcher is an alternation of literals.
1745
1768
 
1746
1769
  30.4 An `OptionalNames<P>` segment MUST map to an optional key, and leaving one out MUST omit that
1747
1770
  segment.
@@ -1783,7 +1806,8 @@ on.
1783
1806
 
1784
1807
  30.18 `navigate` MUST leave an answer other than 204 to the document.
1785
1808
 
1786
- 30.19 `url` MUST throw where a param, or a member of a rest param, is `.` or `..`.
1809
+ 30.19 `url` MUST throw where a param, or a member of a rest param, of a segment naming no matcher
1810
+ carries a `.`, and where any param or member is `.` or `..`.
1787
1811
 
1788
1812
  30.20 A history step to an address that differs from the page shown only in its fragment MUST NOT
1789
1813
  pass through `middleware`, and MUST NOT remount the page.
@@ -1828,6 +1852,17 @@ MUST leave the page and the address where they stand, save where 45.12 holds.
1828
1852
  30.33 A history step under 30.20, and a `navigate` under 30.21, MUST move `route.url` to the address
1829
1853
  it steps to.
1830
1854
 
1855
+ 30.34 A `[param]` or an `[[optional]]` segment naming no matcher MUST NOT match a part carrying a
1856
+ `.`, and such a `[...rest]` MUST NOT take one.
1857
+
1858
+ 30.35 A segment naming a matcher MUST match a part only where the whole part, percent-decoded,
1859
+ matches it, and a `[...rest]` naming one MUST take a part only where it does.
1860
+
1861
+ 30.36 No dynamic segment MUST match a part that is `.` or `..`.
1862
+
1863
+ 30.37 An address whose part a segment refuses, by its matcher or by 30.34, MUST be matched against
1864
+ the routes 30.9 ranks after that route.
1865
+
1831
1866
  # 31. Reading and writing by name
1832
1867
 
1833
1868
  31.1 Inside a `.abide` file a name bound to a `Reactive` MUST be read wherever 31.3 does not hold it.
@@ -2322,6 +2357,9 @@ on any element is.
2322
2357
  35.18 A document an `error.abide` answers MUST NOT be hydrated as the page its address names, and a
2323
2358
  navigation from it MUST load the document it asks for.
2324
2359
 
2360
+ 35.19 A page route MUST answer a request whose `sec-fetch-dest` names neither a destination fetch
2361
+ calls a navigation request's nor `empty` with a bodiless 404, and MUST NOT set up its page.
2362
+
2325
2363
  # 36. Environment and files
2326
2364
 
2327
2365
  36.1 `PORT` MUST default to 3000, and a command's own port flag MUST override it by declaring it.
@@ -2729,8 +2767,9 @@ as one markdown file, in reading order.
2729
2767
  38.107 `onLauncher` called anywhere but `src/launcher.abide` MUST be a build error naming that file.
2730
2768
 
2731
2769
  38.108 `abide routes` MUST print every route with each method it answers and the file answering
2732
- it, every private handler with its address and its file, and every hook with the file that filed it;
2733
- with `--json` it MUST print the same as one JSON document.
2770
+ it, every private handler with its address and its file, every matcher a route names with the
2771
+ pattern it takes a part by, and every hook with the file that filed it; with `--json` it MUST print
2772
+ the same as one JSON document.
2734
2773
 
2735
2774
  38.109 Under `bun test` with `@abide/abide/test` preloaded, a test MUST import a `.abide` of the app as
2736
2775
  the module it compiles to, whether or not `createApp` has run.