@abide/abide 0.48.0 → 0.50.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/AGENTS.md +85 -59
- package/CHANGELOG.md +216 -0
- package/README.md +21 -10
- package/package.json +15 -4
- package/src/abideLsp.ts +5 -6
- package/src/abideResolverPlugin.ts +197 -169
- package/src/build.ts +79 -56
- package/src/buildCli.ts +3 -5
- package/src/buildDisconnected.ts +2 -5
- package/src/bundleApp.ts +2 -3
- package/src/checkAbide.ts +12 -2
- package/src/compile.ts +2 -4
- package/src/devEntry.ts +113 -28
- package/src/discoveryEntry.ts +3 -2
- package/src/lib/bundle/disconnected.abide +69 -73
- package/src/lib/bundle/infoPlist.ts +13 -7
- package/src/lib/bundle/installDownloads.ts +13 -3
- package/src/lib/bundle/installMacMenu.ts +13 -3
- package/src/lib/bundle/spawnEmbeddedServer.ts +13 -4
- package/src/lib/bundle/waitForServer.ts +6 -1
- package/src/lib/cli/parseArgvForRpc.ts +36 -9
- package/src/lib/cli/tokenizeArgvFlags.ts +4 -2
- package/src/lib/mcp/createMcpResourceServer.ts +13 -2
- package/src/lib/mcp/mcpTools.ts +15 -6
- package/src/lib/mcp/toolResultFromResponse.ts +40 -12
- package/src/lib/server/error.ts +6 -6
- package/src/lib/server/json.ts +17 -3
- package/src/lib/server/rpc/defineRpc.ts +58 -24
- package/src/lib/server/rpc/parseArgs.ts +113 -14
- package/src/lib/server/rpc/resolveRpcJsonSchema.ts +28 -0
- package/src/lib/server/rpc/runWithRpcTimeout.ts +12 -1
- package/src/lib/server/rpc/types/RpcHelper.ts +75 -105
- package/src/lib/server/rpc/types/RpcRegistryEntry.ts +24 -9
- package/src/lib/server/rpc/validationError.ts +1 -1
- package/src/lib/server/runtime/DEV_RELOAD_CLIENT_SCRIPT.ts +0 -15
- package/src/lib/server/runtime/buildCacheSnapshot.ts +10 -9
- package/src/lib/server/runtime/buildInspectorSurface.ts +6 -4
- package/src/lib/server/runtime/buildOpenApiSpec.ts +55 -11
- package/src/lib/server/runtime/buildPreloadManifest.ts +12 -10
- package/src/lib/server/runtime/createAppAssetServer.ts +18 -15
- package/src/lib/server/runtime/createAppRouteResolver.ts +145 -0
- package/src/lib/server/runtime/createPlumbingRouter.ts +212 -0
- package/src/lib/server/runtime/createRouteDispatcher.ts +4 -10
- package/src/lib/server/runtime/createServer.ts +120 -324
- package/src/lib/server/runtime/createUiPageRenderer.ts +137 -26
- package/src/lib/server/runtime/devClientFingerprint.ts +19 -34
- package/src/lib/server/runtime/finalizeResponse.ts +11 -1
- package/src/lib/server/runtime/installAmbientScopeStore.ts +30 -9
- package/src/lib/server/runtime/logExposedSurfaces.ts +8 -7
- package/src/lib/server/runtime/pathStore.ts +15 -0
- package/src/lib/server/runtime/registryManifests.ts +1 -1
- package/src/lib/server/runtime/renderCellBarrierStore.ts +15 -0
- package/src/lib/server/runtime/runWithRequestScope.ts +3 -0
- package/src/lib/server/runtime/serializeCacheSnapshot.ts +6 -4
- package/src/lib/server/runtime/snapshotEntryFromCache.ts +24 -16
- package/src/lib/server/runtime/streamCacheResolutions.ts +14 -7
- package/src/lib/server/runtime/streamFromIterator.ts +30 -2
- package/src/lib/server/runtime/textResponse.ts +23 -0
- package/src/lib/server/runtime/types/DevReloadStamp.ts +6 -10
- package/src/lib/server/runtime/types/InspectorCacheEntry.ts +1 -1
- package/src/lib/server/runtime/types/RequestStore.ts +27 -0
- package/src/lib/server/runtime/warnUnguardedMcp.ts +15 -5
- package/src/lib/server/sockets/createSocketDispatcher.ts +9 -11
- package/src/lib/server/sockets/defineSocket.ts +5 -4
- package/src/lib/server/sse.ts +5 -1
- package/src/lib/shared/ASYNC_CELL.ts +5 -0
- package/src/lib/shared/DEV_REBUILD_PATH.ts +6 -0
- package/src/lib/shared/HTTP_METHODS.ts +6 -0
- package/src/lib/shared/HttpError.ts +1 -5
- package/src/lib/shared/MCP_PATH.ts +6 -0
- package/src/lib/shared/PROXIED_SERVER_SUBDIRS.ts +15 -0
- package/src/lib/shared/REF_JSON_TAGS.ts +13 -1
- package/src/lib/shared/RPC_SHIM_GLOBALS.ts +9 -0
- package/src/lib/shared/activeCacheStore.ts +1 -0
- package/src/lib/shared/activePage.ts +1 -0
- package/src/lib/shared/buildArtifact.ts +20 -0
- package/src/lib/shared/buildRpcRequest.ts +6 -2
- package/src/lib/shared/buildSocketOverChannel.ts +4 -3
- package/src/lib/shared/bundleGraphFromMetafile.ts +68 -0
- package/src/lib/shared/cache.ts +156 -131
- package/src/lib/shared/canonicalJson.ts +24 -1
- package/src/lib/shared/changeAffectsClient.ts +12 -7
- package/src/lib/shared/createCacheStore.ts +31 -8
- package/src/lib/shared/createChannelLog.ts +24 -0
- package/src/lib/shared/createLifecycleChannel.ts +7 -1
- package/src/lib/shared/createReachable.ts +47 -78
- package/src/lib/shared/createRemoteFunction.ts +52 -30
- package/src/lib/shared/createRpcServerProgram.ts +820 -0
- package/src/lib/shared/decodeRefJson.ts +4 -4
- package/src/lib/shared/decodeResponse.ts +2 -2
- package/src/lib/shared/decodeWireBody.ts +35 -0
- package/src/lib/shared/detectRpcMethod.ts +8 -1
- package/src/lib/shared/done.ts +8 -2
- package/src/lib/shared/encodeRefJson.ts +4 -4
- package/src/lib/shared/encodeWireBody.ts +18 -0
- package/src/lib/shared/exitOnBuildFailure.ts +4 -3
- package/src/lib/{server/rpc → shared}/fieldErrorsFromIssues.ts +5 -1
- package/src/lib/shared/generateDeclarations.ts +72 -0
- package/src/lib/shared/hasSeedableRequest.ts +25 -0
- package/src/lib/shared/hydrationWindow.ts +53 -0
- package/src/lib/shared/isAsyncCell.ts +11 -0
- package/src/lib/shared/isAsyncIterable.ts +8 -0
- package/src/lib/shared/isSubscribable.ts +3 -3
- package/src/lib/shared/isThenable.ts +9 -0
- package/src/lib/shared/jsonSchemaForType.ts +258 -0
- package/src/lib/shared/lenientDecode.ts +15 -0
- package/src/lib/shared/loadProjectTsConfig.ts +28 -0
- package/src/lib/shared/markFrameworkSourcesIgnored.ts +1 -1
- package/src/lib/shared/matchRoute.ts +4 -14
- package/src/lib/shared/parseEnv.ts +17 -6
- package/src/lib/shared/peek.ts +14 -0
- package/src/lib/shared/pending.ts +9 -6
- package/src/lib/shared/pendingAsyncCellsSlot.ts +13 -0
- package/src/lib/shared/prepareRpcModule.ts +91 -93
- package/src/lib/shared/prepareSocketModule.ts +3 -2
- package/src/lib/shared/probeRegistries.ts +5 -18
- package/src/lib/shared/reachable.ts +7 -10
- package/src/lib/shared/refresh.ts +12 -2
- package/src/lib/shared/refreshing.ts +8 -2
- package/src/lib/shared/resolvedCellsSlot.ts +13 -0
- package/src/lib/shared/reviveWireField.ts +49 -0
- package/src/lib/shared/reviveWireOutput.ts +36 -0
- package/src/lib/shared/rpcServerForRoot.ts +25 -0
- package/src/lib/shared/scanPages.ts +25 -0
- package/src/lib/shared/serializeEnv.ts +18 -6
- package/src/lib/shared/snapshotShippable.ts +8 -7
- package/src/lib/shared/snippet.ts +11 -6
- package/src/lib/shared/streamedCellsSlot.ts +14 -0
- package/src/lib/shared/subscribableFromResponse.ts +4 -4
- package/src/lib/shared/subscribableProbes.ts +1 -1
- package/src/lib/shared/tailProbeSlot.ts +1 -1
- package/src/lib/shared/types/AsyncComputed.ts +20 -0
- package/src/lib/shared/types/AsyncState.ts +13 -0
- package/src/lib/shared/types/CacheEntry.ts +7 -7
- package/src/lib/shared/types/CacheOptions.ts +23 -37
- package/src/lib/shared/types/CachePolicy.ts +25 -0
- package/src/lib/shared/types/CacheSnapshotEntry.ts +6 -5
- package/src/lib/shared/types/ErrorJsonSchemas.ts +8 -0
- package/src/lib/shared/types/HttpMethod.ts +3 -1
- package/src/lib/shared/types/InputCoercion.ts +17 -0
- package/src/lib/shared/types/{Subscribable.ts → NamedAsyncIterable.ts} +1 -1
- package/src/lib/shared/types/OutputWirePlan.ts +17 -0
- package/src/lib/shared/types/PagesScan.ts +7 -0
- package/src/lib/shared/types/PendingAsyncCells.ts +10 -0
- package/src/lib/shared/types/RawRemoteFunction.ts +6 -0
- package/src/lib/shared/types/RemoteCallable.ts +8 -7
- package/src/lib/shared/types/RemoteFunction.ts +16 -15
- package/src/lib/shared/types/ResolvedCells.ts +11 -0
- package/src/lib/shared/types/ReturnBody.ts +15 -0
- package/src/lib/shared/types/RpcBuildStamps.ts +23 -0
- package/src/lib/shared/types/RpcErrorGuard.ts +3 -8
- package/src/lib/shared/types/Socket.ts +4 -4
- package/src/lib/shared/types/SsrPayload.ts +5 -1
- package/src/lib/shared/types/StreamPolicy.ts +11 -0
- package/src/lib/shared/types/StreamedCells.ts +19 -0
- package/src/lib/shared/types/StreamedResolution.ts +24 -6
- package/src/lib/shared/types/TailHooks.ts +1 -1
- package/src/lib/shared/types/WireKind.ts +11 -0
- package/src/lib/shared/url.ts +5 -0
- package/src/lib/shared/validationHttpError.ts +33 -0
- package/src/lib/shared/warmSeedKey.ts +16 -0
- package/src/lib/shared/wireJsonReplacer.ts +30 -0
- package/src/lib/shared/writeRpcDts.ts +11 -1
- package/src/lib/shared/writeTestSocketsDts.ts +1 -1
- package/src/lib/test/createTestApp.ts +19 -1
- package/src/lib/ui/README.md +1 -1
- package/src/lib/ui/activePendingCells.ts +14 -0
- package/src/lib/ui/compile/BLOCK_KEYWORDS.ts +21 -0
- package/src/lib/ui/compile/SSR_ESCAPE.ts +4 -1
- package/src/lib/ui/compile/UI_RUNTIME_IMPORTS.ts +35 -7
- package/src/lib/ui/compile/abideUiPlugin.ts +19 -2
- package/src/lib/ui/compile/analyzeComponent.ts +89 -6
- package/src/lib/ui/compile/assignmentTargetNames.ts +54 -0
- package/src/lib/ui/compile/asyncInterpolationFields.ts +152 -0
- package/src/lib/ui/compile/asyncValuePositionError.ts +21 -0
- package/src/lib/ui/compile/asyncValuePositionInterpolations.ts +64 -0
- package/src/lib/ui/compile/attrLiftPosition.ts +18 -0
- package/src/lib/ui/compile/bindListenEvent.ts +5 -6
- package/src/lib/ui/compile/cachedSourceFile.ts +40 -0
- package/src/lib/ui/compile/catchBinding.ts +7 -5
- package/src/lib/ui/compile/classifyInterpolationType.ts +46 -0
- package/src/lib/ui/compile/collectAbideDiagnostics.ts +96 -0
- package/src/lib/ui/compile/compileComponent.ts +19 -3
- package/src/lib/ui/compile/compileModule.ts +27 -58
- package/src/lib/ui/compile/compileSSR.ts +52 -13
- package/src/lib/ui/compile/compileShadow.ts +265 -42
- package/src/lib/ui/compile/composeProps.ts +15 -4
- package/src/lib/ui/compile/createShadowLanguageService.ts +116 -68
- package/src/lib/ui/compile/createShadowProgram.ts +35 -6
- package/src/lib/ui/compile/declaredNames.ts +36 -0
- package/src/lib/ui/compile/desugarSignals.ts +419 -37
- package/src/lib/ui/compile/expressionIsPrefixEvaluable.ts +19 -0
- package/src/lib/ui/compile/generateBuild.ts +74 -17
- package/src/lib/ui/compile/generateSSR.ts +286 -75
- package/src/lib/ui/compile/hoistableAwaits.ts +193 -0
- package/src/lib/ui/compile/hoistableChildRenders.ts +112 -0
- package/src/lib/ui/compile/interpolatedTemplateLiteral.ts +3 -1
- package/src/lib/ui/compile/interpolationClassifierForRoot.ts +37 -0
- package/src/lib/ui/compile/isSpuriousAsyncReadDiagnostic.ts +174 -0
- package/src/lib/ui/compile/isWhitespaceText.ts +10 -2
- package/src/lib/ui/compile/liftAsyncSubExpressions.ts +166 -0
- package/src/lib/ui/compile/lowerAsyncInterpolations.ts +92 -0
- package/src/lib/ui/compile/lowerContext.ts +10 -0
- package/src/lib/ui/compile/lowerDocAccess.ts +51 -10
- package/src/lib/ui/compile/lowerScript.ts +40 -4
- package/src/lib/ui/compile/nodeAtShadowOffset.ts +28 -0
- package/src/lib/ui/compile/parseTemplate.ts +18 -1090
- package/src/lib/ui/compile/parseTemplateRecovering.ts +1385 -0
- package/src/lib/ui/compile/referencedIdentifiers.ts +35 -0
- package/src/lib/ui/compile/renameSignalRefs.ts +26 -40
- package/src/lib/ui/compile/resolveReactiveExport.ts +4 -7
- package/src/lib/ui/compile/scopeCss.ts +27 -4
- package/src/lib/ui/compile/seedTypeClassifierForRoot.ts +65 -0
- package/src/lib/ui/compile/shadowInterpolationClassifier.ts +47 -0
- package/src/lib/ui/compile/sourceFileOptionsSignature.ts +20 -0
- package/src/lib/ui/compile/structuralHeadTokens.ts +107 -0
- package/src/lib/ui/compile/templateSemanticTokens.ts +21 -0
- package/src/lib/ui/compile/templateStartOffset.ts +15 -0
- package/src/lib/ui/compile/tryPlan.ts +4 -3
- package/src/lib/ui/compile/types/AnalyzedComponent.ts +4 -0
- package/src/lib/ui/compile/types/AsyncInterpolationField.ts +19 -0
- package/src/lib/ui/compile/types/InterpolationClassifier.ts +12 -0
- package/src/lib/ui/compile/types/InterpolationKind.ts +7 -0
- package/src/lib/ui/compile/types/ParseDiagnostic.ts +8 -0
- package/src/lib/ui/compile/types/SeedTypeClassifier.ts +15 -0
- package/src/lib/ui/compile/types/TemplateNode.ts +36 -4
- package/src/lib/ui/compile/types/ValuePositionInterpolation.ts +13 -0
- package/src/lib/ui/compile/writtenTemplateNames.ts +84 -0
- package/src/lib/ui/computed.ts +28 -1
- package/src/lib/ui/createScope.ts +35 -68
- package/src/lib/ui/dom/anchoredBranch.ts +142 -0
- package/src/lib/ui/dom/appendText.ts +8 -3
- package/src/lib/ui/dom/awaitBlock.ts +62 -75
- package/src/lib/ui/dom/bindProp.ts +22 -0
- package/src/lib/ui/dom/bindableProp.ts +47 -0
- package/src/lib/ui/dom/cellPending.ts +24 -0
- package/src/lib/ui/dom/discardBoundary.ts +24 -6
- package/src/lib/ui/dom/disposeRange.ts +2 -1
- package/src/lib/ui/dom/each.ts +41 -12
- package/src/lib/ui/dom/eachAsync.ts +39 -3
- package/src/lib/ui/dom/fillBefore.ts +6 -7
- package/src/lib/ui/dom/fillBoundary.ts +2 -3
- package/src/lib/ui/dom/fillRange.ts +4 -4
- package/src/lib/ui/dom/hydrate.ts +6 -12
- package/src/lib/ui/dom/isComment.ts +1 -1
- package/src/lib/ui/dom/matchingRangeClose.ts +29 -0
- package/src/lib/ui/dom/mergeProps.ts +1 -1
- package/src/lib/ui/dom/mount.ts +1 -2
- package/src/lib/ui/dom/mountChild.ts +9 -40
- package/src/lib/ui/dom/mountRange.ts +2 -3
- package/src/lib/ui/dom/mountSlot.ts +1 -1
- package/src/lib/ui/dom/mountStreamedChild.ts +84 -0
- package/src/lib/ui/dom/mountSwappableRange.ts +46 -4
- package/src/lib/ui/dom/mutateDocContainer.ts +65 -0
- package/src/lib/ui/dom/on.ts +2 -2
- package/src/lib/ui/dom/readCell.ts +40 -0
- package/src/lib/ui/dom/restProps.ts +2 -2
- package/src/lib/ui/dom/spreadProps.ts +3 -4
- package/src/lib/ui/dom/switchBlock.ts +30 -7
- package/src/lib/ui/dom/tryBlock.ts +233 -70
- package/src/lib/ui/dom/types/SwitchCase.ts +5 -1
- package/src/lib/ui/dom/when.ts +12 -2
- package/src/lib/ui/dom/withScope.ts +9 -2
- package/src/lib/ui/finalizeStreamedChildren.ts +89 -0
- package/src/lib/ui/flight.ts +56 -0
- package/src/lib/ui/html.ts +12 -1
- package/src/lib/ui/isolateCellBarrier.ts +17 -0
- package/src/lib/ui/linked.ts +48 -2
- package/src/lib/ui/props.ts +17 -0
- package/src/lib/ui/remoteProxy.ts +84 -159
- package/src/lib/ui/renderChain.ts +53 -13
- package/src/lib/ui/renderToStream.ts +22 -18
- package/src/lib/ui/resumeSeedScript.ts +1 -1
- package/src/lib/ui/router.ts +86 -53
- package/src/lib/ui/runtime/AsyncCellError.ts +20 -0
- package/src/lib/ui/runtime/CELL_SEED.ts +14 -0
- package/src/lib/ui/runtime/CHILD_PRESENT.ts +2 -2
- package/src/lib/ui/runtime/CURRENT_BOUNDARY.ts +11 -0
- package/src/lib/ui/runtime/CURRENT_PATH.ts +29 -0
- package/src/lib/ui/runtime/RENDER.ts +10 -7
- package/src/lib/ui/runtime/RESUME.ts +4 -4
- package/src/lib/ui/runtime/STREAMED_CELLS.ts +57 -0
- package/src/lib/ui/runtime/ambientPathBacking.ts +32 -0
- package/src/lib/ui/runtime/applyPatchToTree.ts +17 -4
- package/src/lib/ui/runtime/blockId.ts +31 -0
- package/src/lib/ui/runtime/boundaryFor.ts +11 -0
- package/src/lib/ui/runtime/cellBarrierBacking.ts +30 -0
- package/src/lib/ui/runtime/createAsyncCell.ts +300 -0
- package/src/lib/ui/runtime/createDoc.ts +31 -54
- package/src/lib/ui/runtime/createEffectNode.ts +9 -0
- package/src/lib/ui/runtime/enterRenderPass.ts +5 -4
- package/src/lib/ui/runtime/flushEffects.ts +33 -1
- package/src/lib/ui/runtime/isAsyncFunction.ts +14 -0
- package/src/lib/ui/runtime/nextBlockId.ts +8 -7
- package/src/lib/ui/runtime/renderPath.ts +16 -0
- package/src/lib/ui/runtime/scope.ts +11 -0
- package/src/lib/ui/runtime/toTeardown.ts +10 -3
- package/src/lib/ui/runtime/types/Boundary.ts +9 -0
- package/src/lib/ui/runtime/types/RenderContext.ts +9 -7
- package/src/lib/ui/runtime/types/SsrRender.ts +9 -2
- package/src/lib/ui/runtime/types/UiComponent.ts +1 -5
- package/src/lib/ui/runtime/types/UiProps.ts +6 -5
- package/src/lib/ui/runtime/withOptionalPath.ts +8 -0
- package/src/lib/ui/runtime/withPath.ts +16 -0
- package/src/lib/ui/runtime/withPathFrom.ts +20 -0
- package/src/lib/ui/runtime/withoutHydration.ts +22 -0
- package/src/lib/ui/seedStreamedResolution.ts +31 -6
- package/src/lib/ui/settleAsyncCells.ts +24 -0
- package/src/lib/ui/socketProxy.ts +1 -1
- package/src/lib/ui/startClient.ts +16 -31
- package/src/lib/ui/state.ts +9 -3
- package/src/lib/ui/trackedComputed.ts +68 -0
- package/src/lib/ui/types/Scope.ts +8 -24
- package/src/lib/ui/watch.ts +3 -3
- package/src/serverEntry.ts +14 -0
- package/template/src/server/rpc/getHello.ts +15 -13
- package/template/test/app.test.ts +1 -1
- package/src/lib/server/runtime/devHotModuleResponse.ts +0 -41
- package/src/lib/shared/DEV_HOT_PREFIX.ts +0 -7
- package/src/lib/shared/UNREACHABLE_STATUSES.ts +0 -13
- package/src/lib/shared/hasReplayableRequest.ts +0 -17
- package/src/lib/shared/hydratingSlot.ts +0 -12
- package/src/lib/shared/outboxProbeSlot.ts +0 -20
- package/src/lib/shared/types/Outbox.ts +0 -9
- package/src/lib/shared/types/OutboxEntry.ts +0 -27
- package/src/lib/shared/types/SmartReadOptions.ts +0 -36
- package/src/lib/shared/wakeHydrationPeeks.ts +0 -20
- package/src/lib/ui/COMPONENT_WRAPPER_PREFIX.ts +0 -5
- package/src/lib/ui/compile/REACTIVE_CALLEES.ts +0 -11
- package/src/lib/ui/compile/assertRuntimeHelpersBound.ts +0 -80
- package/src/lib/ui/compile/markupTokens.ts +0 -313
- package/src/lib/ui/compile/structuralBlockTokens.ts +0 -100
- package/src/lib/ui/dom/applyResolved.ts +0 -87
- package/src/lib/ui/dom/scopeLabel.ts +0 -21
- package/src/lib/ui/dom/text.ts +0 -20
- package/src/lib/ui/history.ts +0 -101
- package/src/lib/ui/installHotBridge.ts +0 -93
- package/src/lib/ui/installInspectorBridge.ts +0 -140
- package/src/lib/ui/outbox.ts +0 -35
- package/src/lib/ui/persist.ts +0 -115
- package/src/lib/ui/rpcOutbox/createOutboxQueue.ts +0 -281
- package/src/lib/ui/rpcOutbox/outboxRegistry.ts +0 -69
- package/src/lib/ui/runtime/PATCH_BUS.ts +0 -28
- package/src/lib/ui/runtime/captureModelDoc.ts +0 -28
- package/src/lib/ui/runtime/hotInstances.ts +0 -10
- package/src/lib/ui/runtime/hotReloadEnabled.ts +0 -8
- package/src/lib/ui/runtime/hotReplace.ts +0 -38
- package/src/lib/ui/runtime/liveScopes.ts +0 -15
- package/src/lib/ui/runtime/localStoragePersistence.ts +0 -47
- package/src/lib/ui/runtime/registerHotInstance.ts +0 -23
- package/src/lib/ui/runtime/seedModelDoc.ts +0 -26
- package/src/lib/ui/runtime/types/HotInstance.ts +0 -22
- package/src/lib/ui/runtime/types/PatchEvent.ts +0 -16
- package/src/lib/ui/seedResolved.ts +0 -28
- package/src/lib/ui/sync.ts +0 -48
- package/src/lib/ui/types/History.ts +0 -14
- package/src/lib/ui/types/PersistHandle.ts +0 -11
- package/src/lib/ui/types/PersistenceStore.ts +0 -12
- package/src/lib/ui/types/ResolvedFrame.ts +0 -15
- package/src/lib/ui/types/SyncTransport.ts +0 -13
|
@@ -9,6 +9,7 @@ import { composeProps } from './composeProps.ts'
|
|
|
9
9
|
import { eachPlan } from './eachPlan.ts'
|
|
10
10
|
import { elementPlan } from './elementPlan.ts'
|
|
11
11
|
import { groupBindParts } from './groupBindParts.ts'
|
|
12
|
+
import { hoistableChildRenders } from './hoistableChildRenders.ts'
|
|
12
13
|
import { ifPlan } from './ifPlan.ts'
|
|
13
14
|
import { interpolatedTemplateLiteral } from './interpolatedTemplateLiteral.ts'
|
|
14
15
|
import { isControlFlow } from './isControlFlow.ts'
|
|
@@ -74,8 +75,19 @@ export function generateBuild(
|
|
|
74
75
|
derivedNames: ReadonlySet<string>,
|
|
75
76
|
computedNames: ReadonlySet<string>,
|
|
76
77
|
isLayout = false,
|
|
78
|
+
/* `linked` / async `computed` names, lowered to `$$readCell(name)` in template exprs. */
|
|
79
|
+
cellReadNames: ReadonlySet<string> = new Set(),
|
|
77
80
|
): string {
|
|
78
81
|
const nextVar = makeVarNamer()
|
|
82
|
+
/* A per-body source-order ordinal for each `<Child/>` mount site, so two same-type siblings
|
|
83
|
+
get distinct render-path segments. Combined with the ambient branch/row path a control-flow
|
|
84
|
+
ancestor pushes, this makes every mounted instance's id unique and stable (ADR render-path
|
|
85
|
+
identity). Drawn in document-order walk, matching the SSR back-end's identical walk. */
|
|
86
|
+
let childOrdinal = 0
|
|
87
|
+
/* ADR-0039: the SAME hoistable-child set the SSR back-end computes (identical inputs → identical
|
|
88
|
+
node identities), so the client emits the dual-mode `$$mountStreamedChild` for exactly the
|
|
89
|
+
children the server may stream. A non-hoistable child keeps the plain `$$mountChild`. */
|
|
90
|
+
const streamCapable = hoistableChildRenders(nodes, cellReadNames)
|
|
79
91
|
|
|
80
92
|
/* In a layout, `<slot/>` outlets are rewritten to `OUTLET_TAG` elements up front
|
|
81
93
|
(`asOutlet`) so the static-clone path carries them as ordinary structure. `asOutlet`
|
|
@@ -109,7 +121,7 @@ export function generateBuild(
|
|
|
109
121
|
withShadow,
|
|
110
122
|
bindRead,
|
|
111
123
|
bindWrite,
|
|
112
|
-
} = lowerContext(stateNames, derivedNames, computedNames)
|
|
124
|
+
} = lowerContext(stateNames, derivedNames, computedNames, cellReadNames)
|
|
113
125
|
|
|
114
126
|
/* Maps a plan `Binding`'s classification to the client `ShadowKind`: a `reactive` value
|
|
115
127
|
derefs as a `.value` cell (`derived`), a `plain` value as the bare local (`plain`). The
|
|
@@ -200,7 +212,7 @@ export function generateBuild(
|
|
|
200
212
|
(`type="number"`/`"range"`) reports its edit as a string on `el.value`, which
|
|
201
213
|
would corrupt number-typed state; source the write-back from `valueAsNumber`
|
|
202
214
|
instead (empty field → `undefined`), gated on a statically-known type. */
|
|
203
|
-
const event = bindListenEvent(attr.property
|
|
215
|
+
const event = bindListenEvent(attr.property)
|
|
204
216
|
const staticType = staticAttrValue(node, 'type')
|
|
205
217
|
const isNumericInput =
|
|
206
218
|
attr.property === 'value' &&
|
|
@@ -544,44 +556,67 @@ export function generateBuild(
|
|
|
544
556
|
return `{ match: ${match}, render: ${branchThunk(branch.children)} }`
|
|
545
557
|
})
|
|
546
558
|
.join(', ')
|
|
559
|
+
/* A bare async subject holds the whole switch while the cell is pending — no case, not
|
|
560
|
+
even the default — then matches on the settled value's peek. */
|
|
561
|
+
if (node.asyncSubject === true) {
|
|
562
|
+
const cell = node.subject.trim()
|
|
563
|
+
return `$$switchBlock(${parentVar}, () => $$readCell(${cell}), [${cases}], ${before}, () => $$cellPending(${cell}));\n`
|
|
564
|
+
}
|
|
547
565
|
return `$$switchBlock(${parentVar}, () => (${lowerExpression(node.subject)}), [${cases}], ${before});\n`
|
|
548
566
|
}
|
|
549
567
|
|
|
550
|
-
/* A `{children()}`
|
|
551
|
-
|
|
552
|
-
|
|
568
|
+
/* A component `{children()}` fill point: mount the `children` prop (a `Snippet`) by
|
|
569
|
+
calling it and mounting the resulting value through the snippet interpolation path,
|
|
570
|
+
exactly as any `{snippet(args)}`. `lowerExpression('children()')` reads the destructured
|
|
571
|
+
`children` computed and calls it → a `SnippetValue`, which `appendText` routes to
|
|
572
|
+
`appendSnippet`. A fallback is now an authored `{#if children}…{:else}…{/if}`, so the slot
|
|
573
|
+
node carries no children. Layouts never reach here — their slots are rewritten to `outlet`
|
|
574
|
+
elements by `asOutlet`. */
|
|
553
575
|
function generateSlot(
|
|
554
576
|
_node: Extract<TemplateNode, { kind: 'element' }>,
|
|
555
577
|
parentVar: string,
|
|
556
578
|
): string {
|
|
557
|
-
return
|
|
579
|
+
return `$$appendText(${parentVar}, () => (${lowerExpression('children()')}));\n`
|
|
558
580
|
}
|
|
559
581
|
|
|
560
|
-
/*
|
|
561
|
-
|
|
582
|
+
/* Slot content as a zero-arg `Snippet` under the `children` key — a callable returning a
|
|
583
|
+
`$$snippet`-branded builder, so it unifies with a passed `children={snippet}` and mounts
|
|
584
|
+
through the standard snippet interpolation path. `composeProps` wraps it in the prop-bag
|
|
585
|
+
thunk, so the final bag value is `() => (Snippet callable)`. */
|
|
562
586
|
function slotPart(node: Extract<TemplateNode, { kind: 'component' }>): string | undefined {
|
|
563
587
|
const slotCode = generateChildren(node.children, '$slot')
|
|
564
|
-
return slotCode.trim() === ''
|
|
588
|
+
return slotCode.trim() === ''
|
|
589
|
+
? undefined
|
|
590
|
+
: `"children": () => (() => $$snippet(($slot) => {\n${slotCode}}))`
|
|
565
591
|
}
|
|
566
592
|
|
|
567
593
|
/* The props bag a child mount receives — composed by the shared `composeProps` so the
|
|
568
594
|
build and SSR back-ends emit the same last-wins layering. */
|
|
569
595
|
function propsArg(node: Extract<TemplateNode, { kind: 'component' }>): string {
|
|
570
|
-
return composeProps(node.props, lowerExpression, slotPart(node))
|
|
596
|
+
return composeProps(node.props, lowerExpression, slotPart(node), bindRead, bindWrite)
|
|
571
597
|
}
|
|
572
598
|
|
|
573
599
|
/* Mounts a child component as a marker-bounded range on `parentVar`, positioned at
|
|
574
600
|
`before` (a skeleton anchor's `anchorCursor`, or `null` for a standalone child).
|
|
575
601
|
`mountRange` opens the `[`/`]` markers and builds the child between them — no
|
|
576
602
|
wrapper element — so the child's root is a true direct child of `parentVar`.
|
|
577
|
-
Hydration stays ambient, so the child claims its server range in place.
|
|
578
|
-
component name passes as the scope label (the inspector's `<Counter>` name). */
|
|
603
|
+
Hydration stays ambient, so the child claims its server range in place. */
|
|
579
604
|
function generateChildComponent(
|
|
580
605
|
node: Extract<TemplateNode, { kind: 'component' }>,
|
|
581
606
|
parentVar: string,
|
|
582
607
|
before: string,
|
|
583
608
|
): string {
|
|
584
|
-
|
|
609
|
+
/* The tag lowers through `lowerExpression` like any other reference: a static
|
|
610
|
+
module import (`Button`) is left bare, but a reactive binding — a `{#for}`
|
|
611
|
+
item, an `await` `then` value, a component signal — derefs to its `.value`
|
|
612
|
+
cell, so `<Icon>` from `{#for {icon: Icon} of …}` mounts the component the cell
|
|
613
|
+
holds, not the cell object (whose `.build` is undefined → `build is not a
|
|
614
|
+
function`). SSR emits the same lowering for congruence. */
|
|
615
|
+
/* A hoistable child may have STREAMED (server chose per-render): emit the dual-mode adopter,
|
|
616
|
+
which probes the cursor to adopt an inlined `[ … ]` range OR a streamed `abide:await`
|
|
617
|
+
boundary (ADR-0039). Same args as mountChild. */
|
|
618
|
+
const mountFn = streamCapable.has(node) ? '$$mountStreamedChild' : '$$mountChild'
|
|
619
|
+
return `${mountFn}(${parentVar}, ${lowerExpression(node.name)}, ${propsArg(node)}, ${before}, ${childOrdinal++});\n`
|
|
585
620
|
}
|
|
586
621
|
|
|
587
622
|
/* An await block: pending → resolved(value) / error branches. Each branch is a
|
|
@@ -703,16 +738,35 @@ export function generateBuild(
|
|
|
703
738
|
const thenThunk = branchThunk(plan.thenChildren)
|
|
704
739
|
const elseThunk =
|
|
705
740
|
plan.elseBranch === undefined ? 'undefined' : branchThunk(plan.elseBranch.children)
|
|
741
|
+
/* A bare async subject (`{#if getX()}`) passes `when` a pending probe so a
|
|
742
|
+
still-loading cell renders NO branch; the condition itself is the plain peek read
|
|
743
|
+
(`$$readCell`), evaluated only once no longer pending. */
|
|
744
|
+
if (node.asyncSubject === true) {
|
|
745
|
+
const cell = node.condition.trim()
|
|
746
|
+
return `$$when(${parentVar}, () => $$readCell(${cell}), ${thenThunk}, ${elseThunk}, ${before}, () => $$cellPending(${cell}));\n`
|
|
747
|
+
}
|
|
706
748
|
return `$$when(${parentVar}, () => (${lowerExpression(node.condition)}), ${thenThunk}, ${elseThunk}, ${before});\n`
|
|
707
749
|
}
|
|
708
750
|
/* if/elseif/else is a cond-chain — reuse `switchBlock` over a constant `true`
|
|
709
751
|
subject with `Boolean`-coerced match thunks, so the first truthy branch wins
|
|
710
|
-
(`else` is the match-less default).
|
|
752
|
+
(`else` is the match-less default). A branch whose own condition is a bare async
|
|
753
|
+
subject carries a `pending` probe: `switchBlock` holds the chain there while it loads,
|
|
754
|
+
so sync and async branches interleave and each resolves at render time — a pending
|
|
755
|
+
async branch never lets a later branch render on its not-yet-known condition. */
|
|
756
|
+
const condEntry = (
|
|
757
|
+
condition: string,
|
|
758
|
+
asyncSubject: boolean | undefined,
|
|
759
|
+
children: TemplateNode[],
|
|
760
|
+
): string => {
|
|
761
|
+
const pending =
|
|
762
|
+
asyncSubject === true ? `, pending: () => $$cellPending(${condition.trim()})` : ''
|
|
763
|
+
return `{ match: () => Boolean(${lowerExpression(condition)}), render: ${branchThunk(children)}${pending} }`
|
|
764
|
+
}
|
|
711
765
|
const entries = [
|
|
712
|
-
|
|
766
|
+
condEntry(node.condition, node.asyncSubject, plan.thenChildren),
|
|
713
767
|
...plan.branches.map((branch) =>
|
|
714
768
|
branch.condition !== undefined
|
|
715
|
-
?
|
|
769
|
+
? condEntry(branch.condition, branch.asyncSubject, branch.children)
|
|
716
770
|
: `{ match: undefined, render: ${branchThunk(branch.children)} }`,
|
|
717
771
|
),
|
|
718
772
|
]
|
|
@@ -773,9 +827,12 @@ export function generateBuild(
|
|
|
773
827
|
const catchArg = plan.async
|
|
774
828
|
? `, ${plan.hasCatch ? branchThunk(plan.catchChildren, plan.catchBindings) : 'undefined'}`
|
|
775
829
|
: ''
|
|
830
|
+
/* Whether the each has an explicit `by` key — the row then keys its render-path segment
|
|
831
|
+
on the stable key rather than its position (see `each`/`eachAsync`). */
|
|
832
|
+
const keyed = plan.key !== undefined
|
|
776
833
|
return (
|
|
777
834
|
`${fn}(${parentVar}, () => (${lowerExpression(plan.items)}), ` +
|
|
778
|
-
`(${keyParam}) => (${keyExpression}), (${rowParam}, ${itemWiring.param}${indexParam}) => {\n${itemWiring.prefix}${rowBody}}${catchArg}, ${before});\n`
|
|
835
|
+
`(${keyParam}) => (${keyExpression}), (${rowParam}, ${itemWiring.param}${indexParam}) => {\n${itemWiring.prefix}${rowBody}}${catchArg}, ${before}, ${keyed});\n`
|
|
779
836
|
)
|
|
780
837
|
}
|
|
781
838
|
|