@abide/abide 0.54.0 → 0.55.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.
Files changed (96) hide show
  1. package/AGENTS.md +330 -498
  2. package/CHANGELOG.md +49 -0
  3. package/README.md +166 -146
  4. package/package.json +2 -3
  5. package/src/lib/server/rpc/defineRpc.ts +2 -1
  6. package/src/lib/server/rpc/types/RpcHelper.ts +29 -22
  7. package/src/lib/server/runtime/SSR_SWAP_SCRIPT.ts +3 -2
  8. package/src/lib/server/runtime/createUiPageRenderer.ts +34 -26
  9. package/src/lib/shared/SEEDS.ts +33 -0
  10. package/src/lib/shared/SOCKET_SEED.ts +4 -5
  11. package/src/lib/shared/cache.ts +169 -75
  12. package/src/lib/shared/createRemoteFunction.ts +4 -1
  13. package/src/lib/shared/encodeSeedValue.ts +24 -0
  14. package/src/lib/shared/jsonSchemaForType.ts +3 -16
  15. package/src/lib/shared/peek.ts +3 -6
  16. package/src/lib/ui/amendReaderHook.ts +1 -1
  17. package/src/lib/ui/compile/UI_RUNTIME_IMPORTS.ts +1 -6
  18. package/src/lib/ui/compile/analyzeComponent.ts +0 -2
  19. package/src/lib/ui/compile/awaitSubjectExpr.ts +23 -0
  20. package/src/lib/ui/compile/cachedShadowProgram.ts +2 -1
  21. package/src/lib/ui/compile/compileComponent.ts +1 -10
  22. package/src/lib/ui/compile/componentOrdinals.ts +39 -0
  23. package/src/lib/ui/compile/desugarSignals.ts +8 -44
  24. package/src/lib/ui/compile/generateBuild.ts +25 -24
  25. package/src/lib/ui/compile/generateSSR.ts +37 -24
  26. package/src/lib/ui/compile/hoistableAwaits.ts +1 -11
  27. package/src/lib/ui/compile/isSpuriousAsyncReadDiagnostic.ts +46 -5
  28. package/src/lib/ui/compile/lowerContext.ts +26 -6
  29. package/src/lib/ui/compile/lowerScript.ts +1 -11
  30. package/src/lib/ui/compile/renameSignalRefs.ts +7 -21
  31. package/src/lib/ui/compile/seedTypeClassifierForRoot.ts +1 -1
  32. package/src/lib/ui/compile/shadowInterpolationClassifier.ts +1 -1
  33. package/src/lib/ui/compile/types/AnalyzedComponent.ts +3 -5
  34. package/src/lib/ui/compile/wrapReactiveSeeds.ts +44 -0
  35. package/src/lib/ui/compile/wrapSeed.ts +28 -0
  36. package/src/lib/ui/computed.ts +16 -0
  37. package/src/lib/ui/createScope.ts +4 -3
  38. package/src/lib/ui/dom/anchorCursor.ts +2 -1
  39. package/src/lib/ui/dom/anchoredBranch.ts +14 -3
  40. package/src/lib/ui/dom/appendStatic.ts +11 -20
  41. package/src/lib/ui/dom/appendText.ts +41 -43
  42. package/src/lib/ui/dom/appendTextAt.ts +10 -57
  43. package/src/lib/ui/dom/awaitBlock.ts +30 -44
  44. package/src/lib/ui/dom/awaitSubject.ts +118 -0
  45. package/src/lib/ui/dom/claimText.ts +38 -0
  46. package/src/lib/ui/dom/cloneStatic.ts +2 -8
  47. package/src/lib/ui/dom/discardAndRebuild.ts +23 -0
  48. package/src/lib/ui/dom/discardBoundary.ts +5 -4
  49. package/src/lib/ui/dom/each.ts +3 -5
  50. package/src/lib/ui/dom/fillBoundary.ts +2 -1
  51. package/src/lib/ui/dom/hydrate.ts +5 -12
  52. package/src/lib/ui/dom/mountChild.ts +73 -5
  53. package/src/lib/ui/dom/mountSwappableRange.ts +2 -1
  54. package/src/lib/ui/dom/openMarker.ts +2 -4
  55. package/src/lib/ui/dom/outlet.ts +4 -3
  56. package/src/lib/ui/dom/readCell.ts +26 -11
  57. package/src/lib/ui/dom/skeleton.ts +2 -7
  58. package/src/lib/ui/dom/switchBlock.ts +2 -1
  59. package/src/lib/ui/dom/tryBlock.ts +26 -38
  60. package/src/lib/ui/dom/when.ts +6 -2
  61. package/src/lib/ui/linked.ts +14 -0
  62. package/src/lib/ui/resumeSeedScript.ts +1 -1
  63. package/src/lib/ui/router.ts +12 -24
  64. package/src/lib/ui/runtime/AsyncCellError.ts +2 -1
  65. package/src/lib/ui/runtime/BRANCH_SEGMENT.ts +24 -0
  66. package/src/lib/ui/runtime/CELL_SEED.ts +4 -6
  67. package/src/lib/ui/runtime/DOC_SEED.ts +5 -6
  68. package/src/lib/ui/runtime/RENDER.ts +7 -5
  69. package/src/lib/ui/runtime/RESUME.ts +5 -7
  70. package/src/lib/ui/runtime/SEED_MARKS.ts +14 -0
  71. package/src/lib/ui/runtime/SuspenseSignal.ts +2 -2
  72. package/src/lib/ui/runtime/claimChild.ts +5 -7
  73. package/src/lib/ui/runtime/claimExpected.ts +2 -6
  74. package/src/lib/ui/runtime/claimMarker.ts +13 -0
  75. package/src/lib/ui/runtime/claimRun.ts +22 -0
  76. package/src/lib/ui/runtime/consumeSeed.ts +38 -0
  77. package/src/lib/ui/runtime/createAsyncCell.ts +56 -8
  78. package/src/lib/ui/runtime/createComputedNode.ts +1 -0
  79. package/src/lib/ui/runtime/createEffectNode.ts +1 -0
  80. package/src/lib/ui/runtime/createSignalNode.ts +1 -0
  81. package/src/lib/ui/runtime/parkCursor.ts +10 -0
  82. package/src/lib/ui/runtime/readNode.ts +21 -1
  83. package/src/lib/ui/runtime/renderPath.ts +2 -2
  84. package/src/lib/ui/runtime/routeBareSeed.ts +28 -0
  85. package/src/lib/ui/runtime/runHydrationPass.ts +69 -0
  86. package/src/lib/ui/runtime/runNode.ts +14 -0
  87. package/src/lib/ui/runtime/types/HydrationCursor.ts +8 -0
  88. package/src/lib/ui/runtime/types/ReactiveNode.ts +5 -0
  89. package/src/lib/ui/settleAsyncCells.ts +30 -3
  90. package/src/lib/ui/startClient.ts +0 -7
  91. package/src/lib/ui/tryEncodeResume.ts +6 -15
  92. package/src/lib/ui/watch.ts +3 -11
  93. package/src/lib/ui/dom/mountStreamedChild.ts +0 -84
  94. package/src/lib/ui/dom/readCellBlocking.ts +0 -29
  95. package/src/lib/ui/runtime/restoreWarmSeeds.ts +0 -20
  96. package/src/lib/ui/runtime/warmSeedBackup.ts +0 -10
@@ -1,29 +0,0 @@
1
- import { isAsyncCell } from '../../shared/isAsyncCell.ts'
2
- import type { AsyncComputed } from '../../shared/types/AsyncComputed.ts'
3
- import { SuspenseSignal } from '../runtime/SuspenseSignal.ts'
4
- import { readCell } from './readCell.ts'
5
-
6
- /*
7
- The blocking-cell read the compiler lowers to `$$readCellBlocking(NAME)` for an `await`-marked
8
- cell (ADR-0042 D5.3). Exactly `readCell`, with one added rule ahead of it: a cell with no value
9
- *yet* throws a `SuspenseSignal` so the enclosing region SUSPENDS until the value resolves rather
10
- than rendering against `undefined`. This is what makes an `await` binding read as a resolved `T`
11
- (never `undefined`-while-pending) on both sides — the client mirrors the server flush barrier.
12
-
13
- The suspend is keyed on `cell.pending()` (in-flight AND no value), NOT `peek() === undefined`:
14
- - a blocking cell that legitimately resolves to `undefined` is not pending, so it does not
15
- suspend forever;
16
- - a warm-seeded cell on hydrate is `refreshing()` (has value, in flight), not `pending()`, so it
17
- reads its held value and adopts the SSR markup with no suspend and no flash (ADR-0042 D4).
18
- Everything past the pending gate — the throwing peek (error-with-no-retained-value → `AsyncCellError`
19
- to `{#try}`, a retained value winning over pending/error via SWR), a function call, or a `.value`
20
- read — is `readCell` verbatim, so the two reads can never drift.
21
- */
22
- // @documentation plumbing
23
- export function readCellBlocking(cell: unknown): unknown {
24
- /* No value yet → suspend the reading region (distinct from an error, which `readCell` routes). */
25
- if (isAsyncCell(cell) && (cell as AsyncComputed<unknown>).pending()) {
26
- throw new SuspenseSignal(cell as AsyncComputed<unknown>)
27
- }
28
- return readCell(cell)
29
- }
@@ -1,20 +0,0 @@
1
- import { CELL_SEED } from './CELL_SEED.ts'
2
- import { DOC_SEED } from './DOC_SEED.ts'
3
- import { warmSeedBackup } from './warmSeedBackup.ts'
4
-
5
- /*
6
- Re-populate the async-cell and doc-state warm-seed manifests from the pristine SSR copies stashed at
7
- boot, undoing the consume-once deletes the failed hydration pass made. The router's hydration-desync
8
- recovery calls this before it rebuilds the page COLD: with the seeds restored, each rebuilt cell
9
- re-adopts its SSR-resolved value (reads settled, not pending) instead of refetching — so a blocking
10
- `await` cell can't throw an uncaught SuspenseSignal at mount, and the cold render shows real data with
11
- no loading flash. A no-op when boot never seeded (a fresh client-only mount).
12
- */
13
- export function restoreWarmSeeds(): void {
14
- if (warmSeedBackup.cells !== undefined) {
15
- Object.assign(CELL_SEED, warmSeedBackup.cells)
16
- }
17
- if (warmSeedBackup.docs !== undefined) {
18
- Object.assign(DOC_SEED, warmSeedBackup.docs)
19
- }
20
- }
@@ -1,10 +0,0 @@
1
- import type { SsrPayload } from '../../shared/types/SsrPayload.ts'
2
-
3
- /* The pristine SSR warm-seed manifests (`__SSR__.cells` / `__SSR__.docs`), stashed by `startClient`
4
- before the hydration pass drains their client copies — each adopted seed is DELETED from CELL_SEED /
5
- consumed from DOC_SEED as it hydrates. `Object.assign`-ing into those seeds leaves these source
6
- records untouched, so they stay a clean re-seed source. The router's discard→cold-rebuild recovery
7
- reads them via `restoreWarmSeeds` so the rebuilt cells re-adopt the SSR-resolved values instead of
8
- refetching cold — a cold refetch would leave a blocking `await` cell pending and throw an uncaught
9
- SuspenseSignal at mount, killing the page. Empty on a fresh client-only mount (nothing seeded). */
10
- export const warmSeedBackup: { cells?: SsrPayload['cells']; docs?: SsrPayload['docs'] } = {}