@abide/abide 0.43.0 → 0.44.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 +293 -219
- package/CHANGELOG.md +46 -0
- package/README.md +191 -67
- package/package.json +2 -2
- package/src/abideLsp.ts +8 -4
- package/src/abideResolverPlugin.ts +11 -1
- package/src/build.ts +9 -0
- package/src/buildDisconnected.ts +2 -0
- package/src/devEntry.ts +1 -0
- package/src/lib/bundle/probeAbideServer.ts +1 -1
- package/src/lib/cli/parseArgvForRpc.ts +4 -2
- package/src/lib/cli/types/CliManifest.ts +6 -4
- package/src/lib/mcp/annotationsForMethod.ts +1 -1
- package/src/lib/mcp/toolResultFromResponse.ts +1 -1
- package/src/lib/mcp/types/JsonRpcRequest.ts +3 -3
- package/src/lib/server/AppModule.ts +1 -1
- package/src/lib/server/cli/handleCliDownload.ts +7 -5
- package/src/lib/server/cli/installScript.ts +3 -3
- package/src/lib/server/prompts/promptRegistry.ts +1 -1
- package/src/lib/server/prompts/types/Prompt.ts +2 -1
- package/src/lib/server/rpc/dispatchRpcInProcess.ts +2 -2
- package/src/lib/server/rpc/types/RpcHelper.ts +1 -1
- package/src/lib/server/runtime/createPublicAssetServer.ts +2 -2
- package/src/lib/server/runtime/createRouteDispatcher.ts +1 -1
- package/src/lib/server/runtime/createServer.ts +21 -0
- package/src/lib/server/runtime/createUiPageRenderer.ts +7 -11
- package/src/lib/server/runtime/crossOriginForbidden.ts +2 -2
- package/src/lib/server/runtime/crossOriginGate.ts +1 -1
- package/src/lib/server/runtime/devHotModuleResponse.ts +2 -2
- package/src/lib/server/runtime/disableIdleTimeoutForStream.ts +1 -1
- package/src/lib/server/runtime/logExposedSurfaces.ts +3 -4
- package/src/lib/server/runtime/serializeCacheSnapshot.ts +3 -8
- package/src/lib/server/runtime/snapshotEntryFromCache.ts +10 -7
- package/src/lib/server/runtime/streamFromIterator.ts +2 -2
- package/src/lib/server/runtime/types/InspectorRpc.ts +2 -2
- package/src/lib/server/socket.ts +1 -1
- package/src/lib/server/sockets/createSocketDispatcher.ts +2 -2
- package/src/lib/server/sockets/socketRegistry.ts +2 -2
- package/src/lib/server/sockets/types/SocketClientFrame.ts +3 -3
- package/src/lib/shared/CACHE_WRAPPED.ts +3 -2
- package/src/lib/shared/REMOTE_FUNCTION.ts +1 -1
- package/src/lib/shared/STREAMING_CONTENT_TYPES.ts +3 -2
- package/src/lib/shared/bodyValueForKind.ts +35 -0
- package/src/lib/shared/cache.ts +1 -1
- package/src/lib/shared/cacheEntryFromSnapshot.ts +23 -18
- package/src/lib/shared/createPushIterator.ts +1 -1
- package/src/lib/shared/decodeResponse.ts +11 -8
- package/src/lib/shared/hasReplayableRequest.ts +17 -0
- package/src/lib/shared/html.ts +7 -26
- package/src/lib/shared/manifestModule.ts +2 -2
- package/src/lib/shared/online.ts +1 -1
- package/src/lib/shared/outboxProbeSlot.ts +1 -1
- package/src/lib/shared/pageUrlForFile.ts +1 -1
- package/src/lib/shared/routeParamsShape.ts +20 -0
- package/src/lib/shared/snapshotShippable.ts +22 -0
- package/src/lib/shared/types/CacheEntry.ts +1 -1
- package/src/lib/shared/types/CacheInvalidation.ts +3 -3
- package/src/lib/shared/types/ClientFlags.ts +5 -3
- package/src/lib/shared/types/LastConnection.ts +1 -1
- package/src/lib/shared/url.ts +4 -1
- package/src/lib/shared/withBase.ts +1 -2
- package/src/lib/shared/writeDts.ts +2 -2
- package/src/lib/shared/writeRoutesDts.ts +3 -31
- package/src/lib/test/createTestSocketChannel.ts +3 -3
- package/src/lib/ui/COMPONENT_WRAPPER_PREFIX.ts +1 -1
- package/src/lib/ui/compile/ABIDE_SEMANTIC_TOKENS_LEGEND.ts +40 -6
- package/src/lib/ui/compile/REACTIVE_CALLEES.ts +1 -1
- package/src/lib/ui/compile/UI_RUNTIME_IMPORTS.ts +49 -37
- package/src/lib/ui/compile/abideUiPlugin.ts +1 -1
- package/src/lib/ui/compile/assertRuntimeHelpersBound.ts +3 -1
- package/src/lib/ui/compile/awaitPlan.ts +14 -2
- package/src/lib/ui/compile/catchBinding.ts +8 -0
- package/src/lib/ui/compile/classStyleMergePlan.ts +108 -0
- package/src/lib/ui/compile/collectAbideDiagnostics.ts +11 -0
- package/src/lib/ui/compile/compileComponent.ts +4 -4
- package/src/lib/ui/compile/compileModule.ts +20 -6
- package/src/lib/ui/compile/compileSSR.ts +12 -10
- package/src/lib/ui/compile/compileShadow.ts +107 -16
- package/src/lib/ui/compile/composeProps.ts +3 -3
- package/src/lib/ui/compile/createShadowLanguageService.ts +30 -2
- package/src/lib/ui/compile/createShadowProgram.ts +2 -1
- package/src/lib/ui/compile/createShadowScope.ts +42 -0
- package/src/lib/ui/compile/decodeHtmlEntities.ts +4 -0
- package/src/lib/ui/compile/desugarSignals.ts +12 -7
- package/src/lib/ui/compile/eachPlan.ts +61 -0
- package/src/lib/ui/compile/elementPlan.ts +55 -0
- package/src/lib/ui/compile/encodeSemanticTokens.ts +24 -1
- package/src/lib/ui/compile/generateBuild.ts +150 -127
- package/src/lib/ui/compile/generateSSR.ts +112 -73
- package/src/lib/ui/compile/ifPlan.ts +7 -1
- package/src/lib/ui/compile/interpolatedTemplateLiteral.ts +25 -0
- package/src/lib/ui/compile/isPlainIdentifier.ts +7 -0
- package/src/lib/ui/compile/isTextLeaf.ts +8 -7
- package/src/lib/ui/compile/lowerContext.ts +36 -46
- package/src/lib/ui/compile/lowerDocAccess.ts +2 -2
- package/src/lib/ui/compile/lowerScript.ts +1 -1
- package/src/lib/ui/compile/markupTokens.ts +313 -0
- package/src/lib/ui/compile/pagePropsType.ts +23 -0
- package/src/lib/ui/compile/parseTemplate.ts +131 -61
- package/src/lib/ui/compile/reactiveBinding.ts +47 -0
- package/src/lib/ui/compile/renameSignalRefs.ts +44 -10
- package/src/lib/ui/compile/skeletonable.ts +5 -5
- package/src/lib/ui/compile/snippetPlan.ts +28 -0
- package/src/lib/ui/compile/spreadExcludedNames.ts +4 -4
- package/src/lib/ui/compile/structuralBlockTokens.ts +3 -4
- package/src/lib/ui/compile/switchPlan.ts +7 -1
- package/src/lib/ui/compile/tryPlan.ts +8 -1
- package/src/lib/ui/compile/types/AnalyzedComponent.ts +2 -2
- package/src/lib/ui/compile/types/Binding.ts +24 -0
- package/src/lib/ui/compile/types/CompiledShadow.ts +13 -1
- package/src/lib/ui/compile/types/ElementPlan.ts +43 -0
- package/src/lib/ui/compile/types/ShadowKind.ts +9 -0
- package/src/lib/ui/compile/types/ShadowScope.ts +19 -0
- package/src/lib/ui/compile/types/TemplateAttr.ts +7 -0
- package/src/lib/ui/compile/types/TemplateNode.ts +8 -8
- package/src/lib/ui/compile/withBindings.ts +45 -0
- package/src/lib/ui/createScope.ts +2 -2
- package/src/lib/ui/dom/MATHML_NAMESPACE.ts +2 -2
- package/src/lib/ui/dom/SVG_NAMESPACE.ts +3 -2
- package/src/lib/ui/dom/appendText.ts +1 -1
- package/src/lib/ui/dom/applyResolved.ts +1 -1
- package/src/lib/ui/dom/buildDetachedRange.ts +4 -3
- package/src/lib/ui/dom/cloneStatic.ts +3 -2
- package/src/lib/ui/dom/each.ts +26 -7
- package/src/lib/ui/dom/foreignWrapperTag.ts +2 -2
- package/src/lib/ui/dom/mountChild.ts +8 -1
- package/src/lib/ui/dom/readCall.ts +6 -4
- package/src/lib/ui/dom/scopeLabel.ts +3 -3
- package/src/lib/ui/dom/switchBlock.ts +3 -1
- package/src/lib/ui/dom/types/EachRow.ts +4 -0
- package/src/lib/ui/dom/types/SkeletonHoles.ts +4 -2
- package/src/lib/ui/history.ts +1 -2
- package/src/lib/ui/html.ts +28 -0
- package/src/lib/ui/installHotBridge.ts +0 -2
- package/src/lib/ui/renderChain.ts +16 -3
- package/src/lib/ui/router.ts +66 -15
- package/src/lib/ui/rpcOutbox/createOutboxQueue.ts +1 -1
- package/src/lib/ui/runtime/CHILD_PRESENT.ts +8 -0
- package/src/lib/ui/runtime/OUTLET_MARKER.ts +2 -2
- package/src/lib/ui/runtime/RANGE_MARKER.ts +1 -1
- package/src/lib/ui/runtime/REACTIVE_CONTEXT.ts +9 -3
- package/src/lib/ui/runtime/captureModelDoc.ts +1 -1
- package/src/lib/ui/runtime/createDoc.ts +5 -1
- package/src/lib/ui/runtime/createEffectNode.ts +5 -5
- package/src/lib/ui/runtime/flushEffects.ts +22 -9
- package/src/lib/ui/runtime/historyEntries.ts +1 -1
- package/src/lib/ui/runtime/track.ts +4 -2
- package/src/lib/ui/runtime/trigger.ts +34 -20
- package/src/lib/ui/runtime/types/Route.ts +2 -2
- package/src/lib/ui/runtime/types/UiComponent.ts +3 -2
- package/src/lib/ui/runtime/types/UiProps.ts +9 -12
- package/src/lib/ui/runtime/walkPath.ts +15 -3
- package/src/lib/ui/startClient.ts +41 -14
- package/src/lib/ui/state.ts +3 -3
- package/src/lib/ui/types/Scope.ts +3 -3
- package/src/serverBuildPlugins.ts +11 -5
- package/src/zodCjsPlugin.ts +36 -0
- package/template/.zed/settings.json +7 -1
- package/template/package.json +3 -0
- package/template/src/ui/pages/layout.abide +3 -5
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { classStyleMergePlan } from './classStyleMergePlan.ts'
|
|
2
|
+
import type { ElementPlan, ElementPlanAttr } from './types/ElementPlan.ts'
|
|
3
|
+
import type { TemplateAttr } from './types/TemplateAttr.ts'
|
|
4
|
+
import type { TemplateNode } from './types/TemplateNode.ts'
|
|
5
|
+
import { VOID_TAGS } from './VOID_TAGS.ts'
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
The single decision site for one element's attribute emission — lifted out of the two
|
|
9
|
+
hand-mirrored code-gen back-ends (`generateBuild`, `generateSSR`) so the load-bearing
|
|
10
|
+
agreement on which attribute is which kind, which class/style parts merge, and which tag
|
|
11
|
+
is void lives ONCE (ADR-0013, the locality milestone). Each back-end RENDERS the plan
|
|
12
|
+
differently — build wires live effects/thunks, SSR pushes escaped strings — but consults
|
|
13
|
+
the same classification, so the markup the client clones and the server emits cannot drift.
|
|
14
|
+
|
|
15
|
+
`classStyleMergePlan` folds in as the class/style branch. Each attr is tagged `mergedBuild`
|
|
16
|
+
/`mergedSSR` from the two merge triggers (build merges only on an interpolated base, SSR on
|
|
17
|
+
any directive), so a back-end skips exactly the attrs it folded into its merged class/style
|
|
18
|
+
attribute. The positional holes/anchors stay in `skeletonContext`; this plan layers over it.
|
|
19
|
+
*/
|
|
20
|
+
export function elementPlan(
|
|
21
|
+
node: Extract<TemplateNode, { kind: 'element' }>,
|
|
22
|
+
lower: (code: string) => string,
|
|
23
|
+
): ElementPlan {
|
|
24
|
+
const merge = classStyleMergePlan(node.attrs, lower)
|
|
25
|
+
/* True when this attr is folded into the build back-end's merged class/style effect — the
|
|
26
|
+
interpolated base or any directive of a merged property (a static base stays surgical). */
|
|
27
|
+
const isMergedBuild = (attr: TemplateAttr): boolean =>
|
|
28
|
+
(merge.mergeClassBuild && (attr === merge.classBase || attr.kind === 'class')) ||
|
|
29
|
+
(merge.mergeStyleBuild && (attr === merge.styleBase || attr.kind === 'style'))
|
|
30
|
+
/* True when this attr is folded into the SSR back-end's merged class/style attribute,
|
|
31
|
+
whenever a directive exists. A `class:`/`style:` directive always folds; a static or
|
|
32
|
+
interpolated base folds by NAME (so a duplicate `class`/`style` base is folded too,
|
|
33
|
+
never double-emitted next to the merged attribute — the old SSR by-name skip). */
|
|
34
|
+
const isMergedSSR = (attr: TemplateAttr): boolean => {
|
|
35
|
+
if (attr.kind === 'class') {
|
|
36
|
+
return merge.mergeClass
|
|
37
|
+
}
|
|
38
|
+
if (attr.kind === 'style') {
|
|
39
|
+
return merge.mergeStyle
|
|
40
|
+
}
|
|
41
|
+
if (attr.kind === 'static' || attr.kind === 'interpolated') {
|
|
42
|
+
return (
|
|
43
|
+
(attr.name === 'class' && merge.mergeClass) ||
|
|
44
|
+
(attr.name === 'style' && merge.mergeStyle)
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
return false
|
|
48
|
+
}
|
|
49
|
+
const attrs: ElementPlanAttr[] = node.attrs.map((attr) => ({
|
|
50
|
+
attr,
|
|
51
|
+
mergedBuild: isMergedBuild(attr),
|
|
52
|
+
mergedSSR: isMergedSSR(attr),
|
|
53
|
+
}))
|
|
54
|
+
return { attrs, merge, isVoid: VOID_TAGS.has(node.tag) }
|
|
55
|
+
}
|
|
@@ -10,8 +10,31 @@ by start; tokens with an unknown legend type, and any token overlapping the one
|
|
|
10
10
|
before it, are dropped — the protocol requires a strictly non-overlapping,
|
|
11
11
|
positionally-ordered stream.
|
|
12
12
|
*/
|
|
13
|
+
/*
|
|
14
|
+
A token may span newlines (a multiline template-literal string), but the protocol
|
|
15
|
+
forbids a token crossing a line — so split it into one segment per covered line,
|
|
16
|
+
dropping empty lines. A single-line token returns unchanged.
|
|
17
|
+
*/
|
|
18
|
+
function splitByLine(text: string, token: SemanticToken): SemanticToken[] {
|
|
19
|
+
const raw = text.slice(token.start, token.start + token.length)
|
|
20
|
+
if (!raw.includes('\n')) {
|
|
21
|
+
return [token]
|
|
22
|
+
}
|
|
23
|
+
const segments: SemanticToken[] = []
|
|
24
|
+
let offset = token.start
|
|
25
|
+
for (const line of raw.split('\n')) {
|
|
26
|
+
if (line.length > 0) {
|
|
27
|
+
segments.push({ ...token, start: offset, length: line.length })
|
|
28
|
+
}
|
|
29
|
+
offset += line.length + 1
|
|
30
|
+
}
|
|
31
|
+
return segments
|
|
32
|
+
}
|
|
33
|
+
|
|
13
34
|
export function encodeSemanticTokens(text: string, tokens: SemanticToken[]): number[] {
|
|
14
|
-
const sorted =
|
|
35
|
+
const sorted = tokens
|
|
36
|
+
.flatMap((token) => splitByLine(text, token))
|
|
37
|
+
.sort((a, b) => a.start - b.start || a.length - b.length)
|
|
15
38
|
const data: number[] = []
|
|
16
39
|
let previousLine = 0
|
|
17
40
|
let previousCharacter = 0
|