toiljs 0.0.61 → 0.0.63

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.
@@ -356,8 +356,12 @@ describe('ssr build orchestration', () => {
356
356
 
357
357
  const tmpl = art.tmpl.toString('utf8');
358
358
  // Full document with the layout + page scaffold spliced into #root, holes removed.
359
+ // `<!--$-->` / `<!--/$-->` are the Suspense dehydration markers `assembleRouteElement`
360
+ // emits by wrapping each layout AND the route in `Suspense` (mirroring the client
361
+ // Router), so `hydrateRoot` can align its Suspense boundaries. The `<!-- -->` after `@`
362
+ // is React's text-boundary marker for the `username` hole; the hole text is stripped.
359
363
  expect(tmpl).toContain(
360
- '<div id="root"><div class="app"><main><h1>@</h1><div></div><ul></ul></main></div></div>',
364
+ '<div id="root"><!--$--><div class="app"><!--$--><main><h1>@<!-- --></h1><div></div><ul></ul></main><!--/$--></div><!--/$--></div>',
361
365
  );
362
366
  expect(tmpl).toContain('<template id="__toil_ssr"></template>');
363
367
  expect(tmpl).toContain('/assets/app-abc123.js'); // bootstrap script preserved
@@ -1,49 +0,0 @@
1
- /**
2
- * A `@stream` protocol handler mounted at `/echo`, running as a RESIDENT wasm box
3
- * per WebTransport connection on the Toil edge - distributed across the eligible
4
- * L2/L3 nodes and pinned to ONE worker for the connection's lifetime via QUIC
5
- * connection-id steering.
6
- *
7
- * The defining property of a `@stream` (vs a `@rest` handler): the box is
8
- * RESIDENT, so instance state PERSISTS across events on the same connection. Here
9
- * `count` survives every `@message` because the box is never reset between events
10
- * - unlike a `@rest` handler, which is fresh per request. On the client:
11
- *
12
- * const stream = await Server.STREAM.echo.connect();
13
- * stream.send(new TextEncoder().encode('hi'));
14
- *
15
- * Lifecycle hooks: `@connect` (open), `@message` (an inbound frame), `@close`
16
- * (graceful close), `@disconnect` (abrupt transport loss).
17
- *
18
- * NOTE: reading the inbound frame and replying is the NEXT increment (the
19
- * `StreamPacket` / `StreamOutbound` message bridge). The intended shape is:
20
- *
21
- * @message reply(packet: StreamPacket): StreamOutbound {
22
- * return StreamOutbound.reply(packet.bytes()); // echo the bytes back
23
- * }
24
- *
25
- * Until that lands, the hooks run on the connection lifecycle; this example counts
26
- * frames to demonstrate that the resident box keeps state across them.
27
- */
28
- @stream('echo')
29
- class Echo {
30
- // Resident per-connection state: survives across events (ResetMode::None).
31
- private count: i32 = 0;
32
-
33
- @connect
34
- onConnect(): void {
35
- // A fresh connection: its dedicated box starts the counter at 0.
36
- this.count = 0;
37
- }
38
-
39
- @message
40
- onMessage(): void {
41
- // Persists across frames because the box is resident, not reset per event.
42
- this.count = this.count + 1;
43
- }
44
-
45
- @close
46
- onClose(): void {
47
- // Graceful close: the per-connection box is torn down after this hook.
48
- }
49
- }