@abide/abide 0.58.0 → 0.101.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 (1198) hide show
  1. package/CHANGELOG.md +11 -1774
  2. package/bin/abide.ts +793 -204
  3. package/package.json +35 -152
  4. package/scaffold/src/server/app.ts +6 -0
  5. package/scaffold/src/shared/.gitkeep +0 -0
  6. package/scaffold/src/ui/app.html +8 -0
  7. package/scaffold/src/ui/pages/page.abide +13 -0
  8. package/src/compiler/CHARACTER_REFERENCES.ts +2242 -0
  9. package/src/compiler/CheckerAnswer.ts +62 -0
  10. package/src/compiler/Cursor.ts +367 -0
  11. package/src/compiler/Finding.ts +2 -0
  12. package/src/compiler/Lowering.ts +648 -0
  13. package/src/compiler/PositionTable.ts +125 -0
  14. package/src/compiler/REACTIVE_MEMBERS.ts +36 -0
  15. package/src/compiler/SHARED_NAMES.ts +45 -0
  16. package/src/compiler/SPECIFIERS.ts +16 -0
  17. package/src/compiler/ShadowMap.ts +144 -0
  18. package/src/compiler/TemplateNode.ts +176 -0
  19. package/src/compiler/TypeSession.ts +1079 -0
  20. package/src/compiler/VOID_ELEMENTS.ts +22 -0
  21. package/src/compiler/aliasedSymbol.ts +15 -0
  22. package/src/compiler/ambientReadsIn.ts +152 -0
  23. package/src/compiler/argsDefaultsIn.ts +173 -0
  24. package/src/compiler/argsSchemaOf.ts +230 -0
  25. package/src/compiler/checkApp.ts +117 -0
  26. package/src/compiler/checkedShadow.ts +182 -0
  27. package/src/compiler/classifyRead.ts +577 -0
  28. package/src/compiler/classifyTemplate.ts +501 -0
  29. package/src/compiler/compileApp.ts +559 -0
  30. package/src/compiler/compiledEntry.ts +141 -0
  31. package/src/compiler/componentGraph.ts +139 -0
  32. package/src/compiler/declaredExports.ts +645 -0
  33. package/src/compiler/decodeCharacterReferences.ts +111 -0
  34. package/src/compiler/emitClient.ts +1343 -0
  35. package/src/compiler/emitComponent.ts +162 -0
  36. package/src/compiler/emitSource.ts +91 -0
  37. package/src/compiler/formatDiagnosis.ts +19 -0
  38. package/src/compiler/handlersUnder.ts +112 -0
  39. package/src/compiler/index.ts +15 -0
  40. package/src/compiler/invocationProps.ts +67 -0
  41. package/src/compiler/isNamedAlone.ts +9 -0
  42. package/src/compiler/lineOf.ts +38 -0
  43. package/src/compiler/parseAbide.ts +1341 -0
  44. package/src/compiler/projectShadow.ts +643 -0
  45. package/src/compiler/reactiveOptions.ts +82 -0
  46. package/src/compiler/reactiveTypes.ts +222 -0
  47. package/src/compiler/readSources.ts +100 -0
  48. package/src/compiler/readsIn.ts +1023 -0
  49. package/src/compiler/renderMarkup.ts +781 -0
  50. package/src/compiler/scaffold.ts +105 -0
  51. package/src/compiler/scopeStyles.ts +309 -0
  52. package/src/compiler/serveLanguage.ts +405 -0
  53. package/src/compiler/shareScope.ts +51 -0
  54. package/src/compiler/sharedModuleWrites.ts +88 -0
  55. package/src/compiler/splitImports.ts +387 -0
  56. package/src/compiler/templateWarnings.ts +128 -0
  57. package/src/compiler/tokenize.ts +317 -0
  58. package/src/compiler/trackingWarnings.ts +279 -0
  59. package/src/compiler/writeDefaultProject.ts +42 -0
  60. package/src/server/BRIDGE_VERSION.ts +3 -0
  61. package/src/server/CLIENT_BUILD.ts +56 -0
  62. package/src/server/DEFAULT_PORT.ts +6 -0
  63. package/src/server/DOCUMENT_HEADERS.ts +11 -0
  64. package/src/server/Inbox.ts +36 -0
  65. package/src/server/LogPanel.ts +239 -0
  66. package/src/server/MCP_PROTOCOL_VERSION.ts +3 -0
  67. package/src/server/SETTLE_MILLISECONDS.ts +7 -0
  68. package/src/server/VIRTUAL_DIRECTORY.ts +6 -0
  69. package/src/server/answerFailure.ts +91 -0
  70. package/src/server/answerRequest.ts +560 -0
  71. package/src/server/answerRpc.ts +550 -0
  72. package/src/server/answerSocket.ts +585 -0
  73. package/src/server/answerValue.ts +375 -0
  74. package/src/server/appDirectories.ts +9 -0
  75. package/src/server/appKit.ts +204 -0
  76. package/src/server/appPlugins.ts +26 -0
  77. package/src/server/argsFor.ts +40 -0
  78. package/src/server/assistant.ts +163 -0
  79. package/src/server/banner.ts +43 -0
  80. package/src/server/bridgeRelay.ts +249 -0
  81. package/src/server/buildDirectory.ts +10 -0
  82. package/src/server/callerOf.ts +60 -0
  83. package/src/server/claudeApi.ts +224 -0
  84. package/src/server/claudeCode.ts +187 -0
  85. package/src/server/clientBuildOptions.ts +49 -0
  86. package/src/server/coerceArgs.ts +110 -0
  87. package/src/server/commands.ts +442 -0
  88. package/src/server/componentImports.ts +56 -0
  89. package/src/server/componentModules.d.ts +9 -0
  90. package/src/server/compressAnswer.ts +100 -0
  91. package/src/server/config.ts +192 -0
  92. package/src/server/configFields.ts +92 -0
  93. package/src/server/createApp.ts +428 -0
  94. package/src/server/crossingOrigin.ts +49 -0
  95. package/src/server/csp.ts +77 -0
  96. package/src/server/devWorker.ts +641 -0
  97. package/src/server/faultPolicy.ts +59 -0
  98. package/src/server/fenceServer.ts +48 -0
  99. package/src/server/generatedSurfaces.ts +430 -0
  100. package/src/server/hooks.ts +190 -0
  101. package/src/server/index.ts +87 -0
  102. package/src/server/installServer.ts +47 -0
  103. package/src/server/launcherOptions.ts +62 -0
  104. package/src/server/launcherPage.ts +156 -0
  105. package/src/server/manifestOf.ts +114 -0
  106. package/src/server/muxUpgrade.ts +72 -0
  107. package/src/server/namesUnder.ts +15 -0
  108. package/src/server/nativeMenu.ts +296 -0
  109. package/src/server/negotiateEncoding.ts +39 -0
  110. package/src/server/plainAnswer.ts +19 -0
  111. package/src/server/prefers.ts +25 -0
  112. package/src/server/principal.ts +261 -0
  113. package/src/server/qualitiesOf.ts +22 -0
  114. package/src/server/randomToken.ts +9 -0
  115. package/src/server/reachable.ts +31 -0
  116. package/src/server/refuseAddressCollision.ts +30 -0
  117. package/src/server/remote.ts +242 -0
  118. package/src/server/render.ts +464 -0
  119. package/src/server/renderComponent.ts +33 -0
  120. package/src/server/reportHealth.ts +46 -0
  121. package/src/server/requestScope.ts +435 -0
  122. package/src/server/responseHelpers.ts +75 -0
  123. package/src/server/runCompiled.ts +44 -0
  124. package/src/server/runDesktop.ts +572 -0
  125. package/src/server/seedBuffer.ts +293 -0
  126. package/src/server/serveBuild.ts +198 -0
  127. package/src/server/serveDev.ts +505 -0
  128. package/src/server/shell.ts +506 -0
  129. package/src/server/surfaceOf.ts +47 -0
  130. package/src/server/testBuild.ts +237 -0
  131. package/src/server/trace.ts +151 -0
  132. package/src/server/versionOf.ts +109 -0
  133. package/src/server/withoutTrailingSlash.ts +4 -0
  134. package/src/shared/ADDRESSES.ts +69 -0
  135. package/src/shared/ANCHORS.ts +54 -0
  136. package/src/shared/Attributes.ts +339 -0
  137. package/src/shared/BOOLEAN_ATTRIBUTES.ts +41 -0
  138. package/src/shared/CHILDREN.ts +11 -0
  139. package/src/shared/CURRENT_ROUTER.ts +25 -0
  140. package/src/shared/CopyOptions.ts +19 -0
  141. package/src/shared/DEBUG_META.ts +6 -0
  142. package/src/shared/EARLY_CALLS.ts +8 -0
  143. package/src/shared/FAILURE_STATUS_TEXT.ts +48 -0
  144. package/src/shared/Failed.ts +146 -0
  145. package/src/shared/GLOBAL_GETS.ts +13 -0
  146. package/src/shared/Issues.ts +49 -0
  147. package/src/shared/JsonValue.ts +18 -0
  148. package/src/shared/LOAD_SIGNAL.ts +10 -0
  149. package/src/shared/MOUNT_META.ts +6 -0
  150. package/src/shared/Middleware.ts +34 -0
  151. package/src/shared/NAVIGATION_HEADER.ts +7 -0
  152. package/src/shared/PRINCIPAL_HEADER.ts +6 -0
  153. package/src/shared/RPC_SERVER.ts +67 -0
  154. package/src/shared/Raw.ts +90 -0
  155. package/src/shared/Schema.ts +229 -0
  156. package/src/shared/UNEXPECTED.ts +11 -0
  157. package/src/shared/URL_ATTRIBUTES.ts +19 -0
  158. package/src/shared/VERSION_HEADER.ts +6 -0
  159. package/src/shared/WORK.ts +37 -0
  160. package/src/shared/anchorMarkup.ts +15 -0
  161. package/src/shared/answerOf.ts +141 -0
  162. package/src/shared/applyPatch.ts +173 -0
  163. package/src/shared/armAnchor.ts +17 -0
  164. package/src/shared/attributeText.ts +50 -0
  165. package/src/shared/boundValue.ts +58 -0
  166. package/src/shared/cookies.ts +271 -0
  167. package/src/shared/csp.ts +55 -0
  168. package/src/shared/decodedOrKept.ts +14 -0
  169. package/src/shared/escapeText.ts +103 -0
  170. package/src/shared/framing.ts +131 -0
  171. package/src/shared/headKeyOf.ts +34 -0
  172. package/src/shared/health.ts +51 -0
  173. package/src/shared/index.ts +117 -0
  174. package/src/shared/isEventName.ts +10 -0
  175. package/src/shared/isRecord.ts +4 -0
  176. package/src/shared/issuesOf.ts +18 -0
  177. package/src/shared/jsonSchema.ts +50 -0
  178. package/src/shared/listOf.ts +20 -0
  179. package/src/shared/log.ts +284 -0
  180. package/src/shared/matchRoute.ts +99 -0
  181. package/src/shared/menuItem.ts +80 -0
  182. package/src/shared/mount.ts +45 -0
  183. package/src/shared/muxFrames.ts +35 -0
  184. package/src/shared/navigate.ts +26 -0
  185. package/src/shared/note.ts +24 -0
  186. package/src/shared/numberFromText.ts +10 -0
  187. package/src/shared/online.ts +19 -0
  188. package/src/shared/paint.ts +4 -0
  189. package/src/shared/principal.ts +145 -0
  190. package/src/shared/principalRotated.ts +47 -0
  191. package/src/shared/propCell.ts +99 -0
  192. package/src/shared/props.ts +24 -0
  193. package/src/shared/putOwn.ts +24 -0
  194. package/src/shared/queryText.ts +18 -0
  195. package/src/shared/reactive/CELL.ts +8 -0
  196. package/src/shared/reactive/Cursor.ts +217 -0
  197. package/src/shared/reactive/ENTRY_LIVES.ts +7 -0
  198. package/src/shared/reactive/Expiry.ts +103 -0
  199. package/src/shared/reactive/FOLLOWED.ts +8 -0
  200. package/src/shared/reactive/KEYED_BRAND.ts +8 -0
  201. package/src/shared/reactive/Keyed.ts +424 -0
  202. package/src/shared/reactive/MUTATION.ts +5 -0
  203. package/src/shared/reactive/NO_INITIAL.ts +6 -0
  204. package/src/shared/reactive/NotLanded.ts +21 -0
  205. package/src/shared/reactive/PATCHES.ts +11 -0
  206. package/src/shared/reactive/PATCH_SINKS.ts +26 -0
  207. package/src/shared/reactive/REACTIVE_BRAND.ts +9 -0
  208. package/src/shared/reactive/RESHAPING.ts +13 -0
  209. package/src/shared/reactive/Reactive.ts +4501 -0
  210. package/src/shared/reactive/SELECTION_MEMBERS.ts +12 -0
  211. package/src/shared/reactive/STREAMING.ts +5 -0
  212. package/src/shared/reactive/argsContract.ts +97 -0
  213. package/src/shared/reactive/byOf.ts +18 -0
  214. package/src/shared/reactive/callLoad.ts +200 -0
  215. package/src/shared/reactive/canonicalKey.ts +95 -0
  216. package/src/shared/reactive/chunksOfStream.ts +51 -0
  217. package/src/shared/reactive/index.ts +542 -0
  218. package/src/shared/reactive/isReactive.ts +19 -0
  219. package/src/shared/reactive/isThenable.ts +14 -0
  220. package/src/shared/reactive/matchesPattern.ts +16 -0
  221. package/src/shared/reactive/pairReactive.ts +41 -0
  222. package/src/shared/reactive/parameterDefaults.ts +356 -0
  223. package/src/shared/reactive/recordWrites.ts +472 -0
  224. package/src/shared/reactive/scoped.ts +157 -0
  225. package/src/shared/reactive/scoping.ts +64 -0
  226. package/src/shared/reactive/share.ts +91 -0
  227. package/src/shared/reactive/structural.ts +62 -0
  228. package/src/shared/reactive/tracking.ts +552 -0
  229. package/src/shared/reactive/watch.ts +314 -0
  230. package/src/shared/refuse.ts +224 -0
  231. package/src/shared/route.ts +29 -0
  232. package/src/shared/routePattern.ts +146 -0
  233. package/src/shared/rpc.ts +501 -0
  234. package/src/shared/rpcRequest.ts +73 -0
  235. package/src/shared/safeUrl.ts +68 -0
  236. package/src/shared/seededDocument.ts +36 -0
  237. package/src/shared/setUpLevels.ts +53 -0
  238. package/src/shared/slotValue.ts +34 -0
  239. package/src/shared/spread.ts +79 -0
  240. package/src/shared/takeEarlyCall.ts +86 -0
  241. package/src/shared/url.ts +140 -0
  242. package/src/shared/validateJson.ts +578 -0
  243. package/src/shared/versionInEtag.ts +14 -0
  244. package/src/shared/writePath.ts +95 -0
  245. package/src/ui/ArmRegion.ts +185 -0
  246. package/src/ui/LAYER_NAMES.ts +30 -0
  247. package/src/ui/List.ts +273 -0
  248. package/src/ui/Mismatch.ts +32 -0
  249. package/src/ui/RawRun.ts +99 -0
  250. package/src/ui/Router.ts +698 -0
  251. package/src/ui/Scope.ts +115 -0
  252. package/src/ui/TryRegion.ts +278 -0
  253. package/src/ui/adoptWalk.ts +126 -0
  254. package/src/ui/applyHead.ts +146 -0
  255. package/src/ui/bindElement.ts +44 -0
  256. package/src/ui/bindProperty.ts +79 -0
  257. package/src/ui/bindSpread.ts +44 -0
  258. package/src/ui/escapeless.ts +14 -0
  259. package/src/ui/index.ts +64 -0
  260. package/src/ui/leave.ts +35 -0
  261. package/src/ui/listenForRoutes.ts +92 -0
  262. package/src/ui/measureLayer.ts +34 -0
  263. package/src/ui/menuBridge.ts +19 -0
  264. package/src/ui/moveNode.ts +34 -0
  265. package/src/ui/parseMarkup.ts +35 -0
  266. package/src/ui/reconcile.ts +368 -0
  267. package/src/ui/regions.ts +137 -0
  268. package/src/ui/reportMenu.ts +57 -0
  269. package/src/ui/routing.ts +18 -0
  270. package/src/ui/rowKeyOf.ts +19 -0
  271. package/src/ui/rows.ts +99 -0
  272. package/src/ui/setAttribute.ts +37 -0
  273. package/src/ui/setClass.ts +27 -0
  274. package/src/ui/setMarkup.ts +20 -0
  275. package/src/ui/setStyleProperty.ts +30 -0
  276. package/src/ui/setText.ts +28 -0
  277. package/src/ui/socketWire.ts +258 -0
  278. package/src/ui/wire.ts +141 -0
  279. package/AGENTS.md +0 -446
  280. package/README.md +0 -249
  281. package/src/abideLsp.ts +0 -251
  282. package/src/abideModules.d.ts +0 -8
  283. package/src/abideResolverPlugin.ts +0 -1101
  284. package/src/appEntry.ts +0 -161
  285. package/src/assets/app.html +0 -12
  286. package/src/build.ts +0 -189
  287. package/src/buildCli.ts +0 -125
  288. package/src/buildDisconnected.ts +0 -117
  289. package/src/bundleApp.ts +0 -146
  290. package/src/bundleDisconnectedEntry.ts +0 -14
  291. package/src/checkAbide.ts +0 -145
  292. package/src/cliEntry.ts +0 -25
  293. package/src/clientBuildPlugins.ts +0 -33
  294. package/src/clientEntry.ts +0 -17
  295. package/src/compile.ts +0 -61
  296. package/src/controlServerWorker.ts +0 -433
  297. package/src/devEntry.ts +0 -381
  298. package/src/discoveryEntry.ts +0 -82
  299. package/src/initAgent.ts +0 -50
  300. package/src/lib/bundle/BundleMenu.ts +0 -12
  301. package/src/lib/bundle/BundleMenuItem.ts +0 -25
  302. package/src/lib/bundle/BundleWindow.ts +0 -37
  303. package/src/lib/bundle/WEBVIEW_BUILD_REVISION.ts +0 -9
  304. package/src/lib/bundle/WEBVIEW_VERSION.ts +0 -7
  305. package/src/lib/bundle/bindConnectedFlag.ts +0 -29
  306. package/src/lib/bundle/bindRequestNavigate.ts +0 -34
  307. package/src/lib/bundle/buildWebviewLib.ts +0 -111
  308. package/src/lib/bundle/bundled.ts +0 -35
  309. package/src/lib/bundle/disconnected.abide +0 -265
  310. package/src/lib/bundle/disconnected.css +0 -9
  311. package/src/lib/bundle/ensureWebviewLib.ts +0 -20
  312. package/src/lib/bundle/exitWithParent.ts +0 -30
  313. package/src/lib/bundle/infoPlist.ts +0 -52
  314. package/src/lib/bundle/installDownloads.ts +0 -34
  315. package/src/lib/bundle/installMacMenu.ts +0 -49
  316. package/src/lib/bundle/listenLocalControlServer.ts +0 -19
  317. package/src/lib/bundle/native/abideMenu.mm +0 -422
  318. package/src/lib/bundle/native/webview.h +0 -4557
  319. package/src/lib/bundle/onMenu.ts +0 -42
  320. package/src/lib/bundle/openWebview.ts +0 -104
  321. package/src/lib/bundle/pngToIcns.ts +0 -47
  322. package/src/lib/bundle/probeAbideServer.ts +0 -57
  323. package/src/lib/bundle/resolveServerBinary.ts +0 -12
  324. package/src/lib/bundle/resolveWebviewLib.ts +0 -53
  325. package/src/lib/bundle/serverBinaryFilename.ts +0 -8
  326. package/src/lib/bundle/signMacApp.ts +0 -37
  327. package/src/lib/bundle/spawnEmbeddedServer.ts +0 -73
  328. package/src/lib/bundle/stableLocalPort.ts +0 -19
  329. package/src/lib/bundle/waitForServer.ts +0 -28
  330. package/src/lib/bundle/webviewCachePath.ts +0 -23
  331. package/src/lib/bundle/webviewLibName.ts +0 -11
  332. package/src/lib/cli/completeCli.ts +0 -38
  333. package/src/lib/cli/connectToServer.ts +0 -23
  334. package/src/lib/cli/createClient.ts +0 -108
  335. package/src/lib/cli/dispatchCommand.ts +0 -72
  336. package/src/lib/cli/loadEnvFromBinaryDir.ts +0 -15
  337. package/src/lib/cli/parseArgvForRpc.ts +0 -131
  338. package/src/lib/cli/printCommandHelp.ts +0 -43
  339. package/src/lib/cli/printSessionHelp.ts +0 -28
  340. package/src/lib/cli/printSessionStatus.ts +0 -21
  341. package/src/lib/cli/printTopLevelHelp.ts +0 -83
  342. package/src/lib/cli/printTrimmed.ts +0 -8
  343. package/src/lib/cli/printValue.ts +0 -10
  344. package/src/lib/cli/renderCliCompletions.ts +0 -56
  345. package/src/lib/cli/resolveCliTarget.ts +0 -47
  346. package/src/lib/cli/runCli.ts +0 -188
  347. package/src/lib/cli/runSession.ts +0 -107
  348. package/src/lib/cli/startLocalInstance.ts +0 -14
  349. package/src/lib/cli/tokenizeArgvFlags.ts +0 -86
  350. package/src/lib/cli/tokenizeLine.ts +0 -51
  351. package/src/lib/cli/types/CliManifest.ts +0 -11
  352. package/src/lib/cli/types/CliManifestEntry.ts +0 -17
  353. package/src/lib/cli/types/CliTarget.ts +0 -13
  354. package/src/lib/mcp/annotationsForMethod.ts +0 -29
  355. package/src/lib/mcp/buildPrompts.ts +0 -25
  356. package/src/lib/mcp/createMcpResourceServer.ts +0 -113
  357. package/src/lib/mcp/createMcpServer.ts +0 -56
  358. package/src/lib/mcp/dispatchMcpRequest.ts +0 -159
  359. package/src/lib/mcp/mcpResourceServerSlot.ts +0 -13
  360. package/src/lib/mcp/mcpSurface.ts +0 -57
  361. package/src/lib/mcp/mcpTools.ts +0 -196
  362. package/src/lib/mcp/renderPrompt.ts +0 -25
  363. package/src/lib/mcp/toolResultFromResponse.ts +0 -100
  364. package/src/lib/mcp/types/JsonRpcRequest.ts +0 -12
  365. package/src/lib/mcp/types/JsonRpcResponse.ts +0 -20
  366. package/src/lib/mcp/types/McpResourceContents.ts +0 -10
  367. package/src/lib/mcp/types/McpResourceDescriptor.ts +0 -6
  368. package/src/lib/mcp/types/McpResourceServer.ts +0 -12
  369. package/src/lib/mcp/types/McpServer.ts +0 -9
  370. package/src/lib/mcp/types/McpServerOptions.ts +0 -16
  371. package/src/lib/mcp/types/McpSurface.ts +0 -15
  372. package/src/lib/mcp/types/PromptDescriptor.ts +0 -5
  373. package/src/lib/mcp/types/PromptMessage.ts +0 -2
  374. package/src/lib/mcp/types/ToolDescriptor.ts +0 -7
  375. package/src/lib/mcp/types/ToolResult.ts +0 -2
  376. package/src/lib/server/AppModule.ts +0 -47
  377. package/src/lib/server/DELETE.ts +0 -10
  378. package/src/lib/server/GET.ts +0 -10
  379. package/src/lib/server/HEAD.ts +0 -10
  380. package/src/lib/server/PATCH.ts +0 -10
  381. package/src/lib/server/POST.ts +0 -10
  382. package/src/lib/server/PUT.ts +0 -10
  383. package/src/lib/server/agent.ts +0 -86
  384. package/src/lib/server/appDataDir.ts +0 -16
  385. package/src/lib/server/cli/buildEnvContent.ts +0 -19
  386. package/src/lib/server/cli/createTarGz.ts +0 -77
  387. package/src/lib/server/cli/handleCliDownload.ts +0 -152
  388. package/src/lib/server/cli/handleCliInstall.ts +0 -37
  389. package/src/lib/server/cli/installScript.ts +0 -31
  390. package/src/lib/server/cli/maxSourceMtime.ts +0 -26
  391. package/src/lib/server/cookies.ts +0 -30
  392. package/src/lib/server/env.ts +0 -51
  393. package/src/lib/server/error.ts +0 -110
  394. package/src/lib/server/json.ts +0 -57
  395. package/src/lib/server/jsonl.ts +0 -47
  396. package/src/lib/server/prompts/definePrompt.ts +0 -21
  397. package/src/lib/server/prompts/promptRegistry.ts +0 -9
  398. package/src/lib/server/prompts/registerPrompt.ts +0 -6
  399. package/src/lib/server/prompts/renderPromptTemplate.ts +0 -17
  400. package/src/lib/server/prompts/types/Prompt.ts +0 -14
  401. package/src/lib/server/prompts/types/PromptOptions.ts +0 -12
  402. package/src/lib/server/prompts/types/PromptRegistryEntry.ts +0 -13
  403. package/src/lib/server/prompts/types/PromptRoutes.ts +0 -10
  404. package/src/lib/server/redirect.ts +0 -43
  405. package/src/lib/server/render.ts +0 -70
  406. package/src/lib/server/request.ts +0 -19
  407. package/src/lib/server/rpc/defineRpc.ts +0 -271
  408. package/src/lib/server/rpc/dispatchRpcInProcess.ts +0 -46
  409. package/src/lib/server/rpc/findRpcByCommandName.ts +0 -18
  410. package/src/lib/server/rpc/parseArgs.ts +0 -244
  411. package/src/lib/server/rpc/readBodyWithinLimit.ts +0 -47
  412. package/src/lib/server/rpc/registerRpc.ts +0 -6
  413. package/src/lib/server/rpc/resolveRpcJsonSchema.ts +0 -28
  414. package/src/lib/server/rpc/rpcRegistry.ts +0 -11
  415. package/src/lib/server/rpc/runWithRpcTimeout.ts +0 -58
  416. package/src/lib/server/rpc/types/RemoteHandler.ts +0 -31
  417. package/src/lib/server/rpc/types/RemoteRoutes.ts +0 -13
  418. package/src/lib/server/rpc/types/RpcHelper.ts +0 -185
  419. package/src/lib/server/rpc/types/RpcRegistryEntry.ts +0 -50
  420. package/src/lib/server/rpc/types/TypedError.ts +0 -18
  421. package/src/lib/server/rpc/types/TypedResponse.ts +0 -18
  422. package/src/lib/server/rpc/unprocessed.ts +0 -13
  423. package/src/lib/server/rpc/validationError.ts +0 -17
  424. package/src/lib/server/runtime/DEFAULT_PORT.ts +0 -6
  425. package/src/lib/server/runtime/DEV_READY_MESSAGE.ts +0 -6
  426. package/src/lib/server/runtime/DEV_REBUILD_MESSAGE.ts +0 -4
  427. package/src/lib/server/runtime/DEV_RELOAD_CLIENT_SCRIPT.ts +0 -92
  428. package/src/lib/server/runtime/SSR_SWAP_SCRIPT.ts +0 -19
  429. package/src/lib/server/runtime/STATUS_TEXT.ts +0 -22
  430. package/src/lib/server/runtime/STREAMED_HTML_HEADER.ts +0 -13
  431. package/src/lib/server/runtime/acceptsGzip.ts +0 -33
  432. package/src/lib/server/runtime/amendBroadcaster.ts +0 -53
  433. package/src/lib/server/runtime/buildCacheSnapshot.ts +0 -63
  434. package/src/lib/server/runtime/buildHealthPayload.ts +0 -34
  435. package/src/lib/server/runtime/buildInFlightSnapshot.ts +0 -35
  436. package/src/lib/server/runtime/buildInspectorSurface.ts +0 -47
  437. package/src/lib/server/runtime/buildOpenApiSpec.ts +0 -150
  438. package/src/lib/server/runtime/buildPreloadManifest.ts +0 -153
  439. package/src/lib/server/runtime/cacheControlForAsset.ts +0 -22
  440. package/src/lib/server/runtime/cacheStalenessBroadcaster.ts +0 -33
  441. package/src/lib/server/runtime/containsTraversal.ts +0 -41
  442. package/src/lib/server/runtime/createAppAssetServer.ts +0 -100
  443. package/src/lib/server/runtime/createAppRouteResolver.ts +0 -145
  444. package/src/lib/server/runtime/createAssetHeaderCache.ts +0 -31
  445. package/src/lib/server/runtime/createPlumbingRouter.ts +0 -212
  446. package/src/lib/server/runtime/createPublicAssetServer.ts +0 -76
  447. package/src/lib/server/runtime/createRouteDispatcher.ts +0 -121
  448. package/src/lib/server/runtime/createServer.ts +0 -605
  449. package/src/lib/server/runtime/createUiPageRenderer.ts +0 -489
  450. package/src/lib/server/runtime/crossOriginForbidden.ts +0 -17
  451. package/src/lib/server/runtime/crossOriginGate.ts +0 -29
  452. package/src/lib/server/runtime/devClientFingerprint.ts +0 -103
  453. package/src/lib/server/runtime/devReloadResponse.ts +0 -41
  454. package/src/lib/server/runtime/disableIdleTimeoutForStream.ts +0 -27
  455. package/src/lib/server/runtime/envSchemaStore.ts +0 -15
  456. package/src/lib/server/runtime/finalizeResponse.ts +0 -42
  457. package/src/lib/server/runtime/findOpenPort.ts +0 -21
  458. package/src/lib/server/runtime/flushingGzipStream.ts +0 -62
  459. package/src/lib/server/runtime/getActiveServer.ts +0 -6
  460. package/src/lib/server/runtime/globToPathSet.ts +0 -29
  461. package/src/lib/server/runtime/gzipResponse.ts +0 -57
  462. package/src/lib/server/runtime/inFlightRequests.ts +0 -13
  463. package/src/lib/server/runtime/inProcessServer.ts +0 -20
  464. package/src/lib/server/runtime/installAmbientScopeStore.ts +0 -54
  465. package/src/lib/server/runtime/internalErrorResponse.ts +0 -28
  466. package/src/lib/server/runtime/isCrossOriginRequest.ts +0 -23
  467. package/src/lib/server/runtime/listenOnOpenPort.ts +0 -36
  468. package/src/lib/server/runtime/logExposedSurfaces.ts +0 -156
  469. package/src/lib/server/runtime/maybeMountInspector.ts +0 -104
  470. package/src/lib/server/runtime/mimeForExtension.ts +0 -14
  471. package/src/lib/server/runtime/pageRenderSlot.ts +0 -15
  472. package/src/lib/server/runtime/pageUrlFromStore.ts +0 -15
  473. package/src/lib/server/runtime/parseIdleTimeout.ts +0 -10
  474. package/src/lib/server/runtime/parsePort.ts +0 -11
  475. package/src/lib/server/runtime/pathStore.ts +0 -15
  476. package/src/lib/server/runtime/registryManifests.ts +0 -66
  477. package/src/lib/server/runtime/renderCellBarrierStore.ts +0 -15
  478. package/src/lib/server/runtime/requestContext.ts +0 -5
  479. package/src/lib/server/runtime/resolvePageSnapshot.ts +0 -25
  480. package/src/lib/server/runtime/respondWithEmbeddedAsset.ts +0 -18
  481. package/src/lib/server/runtime/runWithRequestScope.ts +0 -165
  482. package/src/lib/server/runtime/serializeCacheSnapshot.ts +0 -31
  483. package/src/lib/server/runtime/serverSlot.ts +0 -13
  484. package/src/lib/server/runtime/setActiveServer.ts +0 -6
  485. package/src/lib/server/runtime/snapshotEntryFromCache.ts +0 -121
  486. package/src/lib/server/runtime/streamCacheResolutions.ts +0 -44
  487. package/src/lib/server/runtime/streamFromIterator.ts +0 -124
  488. package/src/lib/server/runtime/textResponse.ts +0 -23
  489. package/src/lib/server/runtime/typedErrorResponse.ts +0 -26
  490. package/src/lib/server/runtime/types/Assets.ts +0 -6
  491. package/src/lib/server/runtime/types/DevReloadStamp.ts +0 -14
  492. package/src/lib/server/runtime/types/InspectorCacheEntry.ts +0 -24
  493. package/src/lib/server/runtime/types/InspectorCacheSnapshot.ts +0 -11
  494. package/src/lib/server/runtime/types/InspectorContext.ts +0 -34
  495. package/src/lib/server/runtime/types/InspectorInFlightRequest.ts +0 -20
  496. package/src/lib/server/runtime/types/InspectorInFlightSnapshot.ts +0 -10
  497. package/src/lib/server/runtime/types/InspectorPrompt.ts +0 -15
  498. package/src/lib/server/runtime/types/InspectorRpc.ts +0 -27
  499. package/src/lib/server/runtime/types/InspectorSocket.ts +0 -17
  500. package/src/lib/server/runtime/types/InspectorSurface.ts +0 -16
  501. package/src/lib/server/runtime/types/RequestStore.ts +0 -125
  502. package/src/lib/server/runtime/warnUnguardedMcp.ts +0 -43
  503. package/src/lib/server/runtime/withResponseDefaults.ts +0 -29
  504. package/src/lib/server/server.ts +0 -33
  505. package/src/lib/server/socket.ts +0 -32
  506. package/src/lib/server/sockets/amendFamilyEntry.ts +0 -39
  507. package/src/lib/server/sockets/createSocketDispatcher.ts +0 -397
  508. package/src/lib/server/sockets/defineSocket.ts +0 -225
  509. package/src/lib/server/sockets/lookupSocket.ts +0 -6
  510. package/src/lib/server/sockets/registerSocket.ts +0 -18
  511. package/src/lib/server/sockets/socketOperations.ts +0 -36
  512. package/src/lib/server/sockets/socketRegistry.ts +0 -9
  513. package/src/lib/server/sockets/types/SocketOperation.ts +0 -22
  514. package/src/lib/server/sockets/types/SocketOptions.ts +0 -26
  515. package/src/lib/server/sockets/types/SocketRegistryEntry.ts +0 -19
  516. package/src/lib/server/sockets/types/SocketRoutes.ts +0 -10
  517. package/src/lib/server/sse.ts +0 -58
  518. package/src/lib/shared/ABIDE_PACKAGE_NAME.ts +0 -7
  519. package/src/lib/shared/ABIDE_VERSION.ts +0 -9
  520. package/src/lib/shared/AMEND_TOPIC_PREFIX.ts +0 -9
  521. package/src/lib/shared/ASYNC_CELL.ts +0 -5
  522. package/src/lib/shared/CACHE_CONTROL_VALUES.ts +0 -16
  523. package/src/lib/shared/CACHE_STALENESS_SOCKET.ts +0 -8
  524. package/src/lib/shared/CLI_PATH.ts +0 -7
  525. package/src/lib/shared/DEFER.ts +0 -8
  526. package/src/lib/shared/DEV_REBUILD_PATH.ts +0 -6
  527. package/src/lib/shared/DEV_RELOAD_PATH.ts +0 -6
  528. package/src/lib/shared/HEALTH_PATH.ts +0 -7
  529. package/src/lib/shared/HTTP_METHODS.ts +0 -6
  530. package/src/lib/shared/HttpError.ts +0 -30
  531. package/src/lib/shared/IDENTITY_PATH.ts +0 -6
  532. package/src/lib/shared/INSPECTOR_PATH.ts +0 -7
  533. package/src/lib/shared/MCP_PATH.ts +0 -6
  534. package/src/lib/shared/NAV_HEADER.ts +0 -8
  535. package/src/lib/shared/OFFLINE_HEADER.ts +0 -8
  536. package/src/lib/shared/PROXIED_SERVER_SUBDIRS.ts +0 -15
  537. package/src/lib/shared/REF_JSON_HEADER.ts +0 -9
  538. package/src/lib/shared/REF_JSON_TAGS.ts +0 -43
  539. package/src/lib/shared/REMOTE_FUNCTION.ts +0 -8
  540. package/src/lib/shared/REPLAYABLE_METHODS.ts +0 -12
  541. package/src/lib/shared/RESERVED_SOCKET_PREFIX.ts +0 -8
  542. package/src/lib/shared/RPC_ARGS_TYPE.ts +0 -7
  543. package/src/lib/shared/RPC_SHIM_GLOBALS.ts +0 -9
  544. package/src/lib/shared/SEEDS.ts +0 -33
  545. package/src/lib/shared/SOCKETS_PATH.ts +0 -7
  546. package/src/lib/shared/SOCKET_SEED.ts +0 -12
  547. package/src/lib/shared/SSR_SCRIPT_ID.ts +0 -11
  548. package/src/lib/shared/STREAMING_CONTENT_TYPES.ts +0 -12
  549. package/src/lib/shared/SocketDisconnectedError.ts +0 -13
  550. package/src/lib/shared/TEXT_PLAIN.ts +0 -7
  551. package/src/lib/shared/abideImportName.ts +0 -44
  552. package/src/lib/shared/abideLog.ts +0 -38
  553. package/src/lib/shared/activeCacheStore.ts +0 -12
  554. package/src/lib/shared/activePage.ts +0 -12
  555. package/src/lib/shared/amend.ts +0 -48
  556. package/src/lib/shared/amendBroadcastSlot.ts +0 -19
  557. package/src/lib/shared/appDataDir.ts +0 -34
  558. package/src/lib/shared/appNameSlot.ts +0 -10
  559. package/src/lib/shared/applyAmendLocally.ts +0 -20
  560. package/src/lib/shared/applyCacheStalenessLocally.ts +0 -18
  561. package/src/lib/shared/assertExhaustive.ts +0 -14
  562. package/src/lib/shared/attachRpcSelectorMethods.ts +0 -44
  563. package/src/lib/shared/attachSocketSelectorMethods.ts +0 -34
  564. package/src/lib/shared/augmentModule.ts +0 -18
  565. package/src/lib/shared/basePath.ts +0 -11
  566. package/src/lib/shared/basePathFromAppUrl.ts +0 -20
  567. package/src/lib/shared/baseSlot.ts +0 -9
  568. package/src/lib/shared/binaryDirEnvPath.ts +0 -12
  569. package/src/lib/shared/bodyValueForKind.ts +0 -34
  570. package/src/lib/shared/browserClientFlags.ts +0 -10
  571. package/src/lib/shared/buildArtifact.ts +0 -20
  572. package/src/lib/shared/buildRpcProxy.ts +0 -39
  573. package/src/lib/shared/buildRpcRequest.ts +0 -81
  574. package/src/lib/shared/buildSocketOverChannel.ts +0 -102
  575. package/src/lib/shared/bundleGraphFromMetafile.ts +0 -68
  576. package/src/lib/shared/bundleLayout.ts +0 -36
  577. package/src/lib/shared/cache.ts +0 -1584
  578. package/src/lib/shared/cacheEntryFromSnapshot.ts +0 -77
  579. package/src/lib/shared/cacheManagedSlot.ts +0 -10
  580. package/src/lib/shared/cacheReaderSocketSlot.ts +0 -11
  581. package/src/lib/shared/cacheStalenessSlot.ts +0 -21
  582. package/src/lib/shared/cacheStoreSlot.ts +0 -12
  583. package/src/lib/shared/cacheStores.ts +0 -10
  584. package/src/lib/shared/canonicalJson.ts +0 -86
  585. package/src/lib/shared/carriesBodyArgs.ts +0 -13
  586. package/src/lib/shared/changeAffectsClient.ts +0 -40
  587. package/src/lib/shared/clearLastConnection.ts +0 -7
  588. package/src/lib/shared/commandNameForUrl.ts +0 -17
  589. package/src/lib/shared/contentBodyKind.ts +0 -27
  590. package/src/lib/shared/contentTypeOf.ts +0 -6
  591. package/src/lib/shared/createCacheStore.ts +0 -147
  592. package/src/lib/shared/createChannelLog.ts +0 -146
  593. package/src/lib/shared/createLifecycleChannel.ts +0 -62
  594. package/src/lib/shared/createLivenessWatch.ts +0 -118
  595. package/src/lib/shared/createPushIterator.ts +0 -132
  596. package/src/lib/shared/createReachable.ts +0 -78
  597. package/src/lib/shared/createRemoteFunction.ts +0 -210
  598. package/src/lib/shared/createResolverSlot.ts +0 -30
  599. package/src/lib/shared/createRpcServerProgram.ts +0 -1007
  600. package/src/lib/shared/createSocketSubRegistry.ts +0 -112
  601. package/src/lib/shared/createSubscriber.ts +0 -55
  602. package/src/lib/shared/createTraceContext.ts +0 -21
  603. package/src/lib/shared/dataDirEnvPath.ts +0 -12
  604. package/src/lib/shared/debugGate.ts +0 -90
  605. package/src/lib/shared/decodeRefJson.ts +0 -112
  606. package/src/lib/shared/decodeResponse.ts +0 -54
  607. package/src/lib/shared/decodeWireBody.ts +0 -35
  608. package/src/lib/shared/detectRpcMethod.ts +0 -24
  609. package/src/lib/shared/detectTarget.ts +0 -27
  610. package/src/lib/shared/docSnapshotsSlot.ts +0 -13
  611. package/src/lib/shared/done.ts +0 -20
  612. package/src/lib/shared/emitLogRecord.ts +0 -217
  613. package/src/lib/shared/encodeRefJson.ts +0 -108
  614. package/src/lib/shared/encodeSeedValue.ts +0 -24
  615. package/src/lib/shared/encodeWireBody.ts +0 -18
  616. package/src/lib/shared/escapeHtml.ts +0 -15
  617. package/src/lib/shared/escapeRegex.ts +0 -9
  618. package/src/lib/shared/exeSuffix.ts +0 -9
  619. package/src/lib/shared/exitOnBuildFailure.ts +0 -18
  620. package/src/lib/shared/extraForwardHeaders.ts +0 -16
  621. package/src/lib/shared/fieldErrorsFromIssues.ts +0 -27
  622. package/src/lib/shared/fileName.ts +0 -9
  623. package/src/lib/shared/fileStem.ts +0 -11
  624. package/src/lib/shared/findExportCallSite.ts +0 -233
  625. package/src/lib/shared/formatTraceparent.ts +0 -6
  626. package/src/lib/shared/forwardHeaders.ts +0 -44
  627. package/src/lib/shared/generateDeclarations.ts +0 -72
  628. package/src/lib/shared/getRemoteMeta.ts +0 -5
  629. package/src/lib/shared/hasSeedableRequest.ts +0 -25
  630. package/src/lib/shared/health.ts +0 -179
  631. package/src/lib/shared/healthReadSlot.ts +0 -11
  632. package/src/lib/shared/healthSeedSlot.ts +0 -12
  633. package/src/lib/shared/html.ts +0 -19
  634. package/src/lib/shared/httpErrorFor.ts +0 -26
  635. package/src/lib/shared/hydrationWindow.ts +0 -53
  636. package/src/lib/shared/importNamesToStrip.ts +0 -13
  637. package/src/lib/shared/invalidate.ts +0 -39
  638. package/src/lib/shared/invalidateEvent.ts +0 -11
  639. package/src/lib/shared/invalidateTripwire.ts +0 -40
  640. package/src/lib/shared/isAbideHealthPayload.ts +0 -11
  641. package/src/lib/shared/isAsciiWhitespace.ts +0 -5
  642. package/src/lib/shared/isAsyncCell.ts +0 -11
  643. package/src/lib/shared/isAsyncIterable.ts +0 -8
  644. package/src/lib/shared/isCompileTarget.ts +0 -21
  645. package/src/lib/shared/isDebugEnabled.ts +0 -19
  646. package/src/lib/shared/isDebugNegated.ts +0 -17
  647. package/src/lib/shared/isIdentPart.ts +0 -9
  648. package/src/lib/shared/isIdentStart.ts +0 -8
  649. package/src/lib/shared/isLayoutFile.ts +0 -12
  650. package/src/lib/shared/isModuleNotFound.ts +0 -18
  651. package/src/lib/shared/isReadOnlyMethod.ts +0 -14
  652. package/src/lib/shared/isReplayableMethod.ts +0 -7
  653. package/src/lib/shared/isStreamingResponse.ts +0 -12
  654. package/src/lib/shared/isSubscribable.ts +0 -15
  655. package/src/lib/shared/isThenable.ts +0 -9
  656. package/src/lib/shared/jsonSchemaForPromptArguments.ts +0 -29
  657. package/src/lib/shared/jsonSchemaForSchema.ts +0 -39
  658. package/src/lib/shared/jsonSchemaForType.ts +0 -245
  659. package/src/lib/shared/jsonlErrorFrame.ts +0 -24
  660. package/src/lib/shared/keyForRemoteCall.ts +0 -30
  661. package/src/lib/shared/keyMatchesPrefix.ts +0 -9
  662. package/src/lib/shared/keyPrefixForRemote.ts +0 -12
  663. package/src/lib/shared/lastConnectionPath.ts +0 -7
  664. package/src/lib/shared/layoutChainForRoute.ts +0 -22
  665. package/src/lib/shared/lenientDecode.ts +0 -15
  666. package/src/lib/shared/loadEnvFile.ts +0 -17
  667. package/src/lib/shared/loadEnvFromDataDir.ts +0 -14
  668. package/src/lib/shared/loadProjectTsConfig.ts +0 -28
  669. package/src/lib/shared/log.ts +0 -24
  670. package/src/lib/shared/logClosingRecord.ts +0 -28
  671. package/src/lib/shared/logTapSlot.ts +0 -13
  672. package/src/lib/shared/manifestModule.ts +0 -39
  673. package/src/lib/shared/markFrameworkSourcesIgnored.ts +0 -47
  674. package/src/lib/shared/matchRoute.ts +0 -165
  675. package/src/lib/shared/matcherFromEnvelope.ts +0 -31
  676. package/src/lib/shared/memoizeByKey.ts +0 -32
  677. package/src/lib/shared/messageFromError.ts +0 -6
  678. package/src/lib/shared/normalizePathname.ts +0 -11
  679. package/src/lib/shared/normalizeTarget.ts +0 -10
  680. package/src/lib/shared/online.ts +0 -51
  681. package/src/lib/shared/page.ts +0 -30
  682. package/src/lib/shared/pageSlot.ts +0 -17
  683. package/src/lib/shared/pageUrlForFile.ts +0 -14
  684. package/src/lib/shared/parseBoundedEnvInt.ts +0 -20
  685. package/src/lib/shared/parseEnv.ts +0 -41
  686. package/src/lib/shared/parsePromptMarkdown.ts +0 -35
  687. package/src/lib/shared/parseRouteSegments.ts +0 -31
  688. package/src/lib/shared/parseTraceparent.ts +0 -26
  689. package/src/lib/shared/peek.ts +0 -46
  690. package/src/lib/shared/pending.ts +0 -36
  691. package/src/lib/shared/pendingAsyncCellsSlot.ts +0 -13
  692. package/src/lib/shared/prepareRemoteExport.ts +0 -40
  693. package/src/lib/shared/prepareRpcModule.ts +0 -240
  694. package/src/lib/shared/prepareSocketModule.ts +0 -46
  695. package/src/lib/shared/probeRegistries.ts +0 -68
  696. package/src/lib/shared/producerKey.ts +0 -32
  697. package/src/lib/shared/programNameForPackage.ts +0 -16
  698. package/src/lib/shared/promptNameForFile.ts +0 -10
  699. package/src/lib/shared/queryStringFromArgs.ts +0 -38
  700. package/src/lib/shared/randomHexId.ts +0 -14
  701. package/src/lib/shared/reachable.ts +0 -99
  702. package/src/lib/shared/readEnvFile.ts +0 -15
  703. package/src/lib/shared/readLastConnection.ts +0 -18
  704. package/src/lib/shared/readPackageJson.ts +0 -9
  705. package/src/lib/shared/recordRemoteMeta.ts +0 -5
  706. package/src/lib/shared/refresh.ts +0 -39
  707. package/src/lib/shared/refreshing.ts +0 -37
  708. package/src/lib/shared/remoteMetaStore.ts +0 -16
  709. package/src/lib/shared/requestScopeSlot.ts +0 -13
  710. package/src/lib/shared/resolveClientFlags.ts +0 -20
  711. package/src/lib/shared/resolvedCellsSlot.ts +0 -13
  712. package/src/lib/shared/responseBodyKind.ts +0 -35
  713. package/src/lib/shared/responseErrorText.ts +0 -9
  714. package/src/lib/shared/reviveWireField.ts +0 -49
  715. package/src/lib/shared/reviveWireOutput.ts +0 -36
  716. package/src/lib/shared/routeParamsShape.ts +0 -20
  717. package/src/lib/shared/rpcErrorRegistry.ts +0 -69
  718. package/src/lib/shared/rpcServerForRoot.ts +0 -25
  719. package/src/lib/shared/rpcTimeoutSlot.ts +0 -9
  720. package/src/lib/shared/rpcUrlForFile.ts +0 -19
  721. package/src/lib/shared/runningAsStandaloneBinary.ts +0 -13
  722. package/src/lib/shared/safeJsonForScript.ts +0 -17
  723. package/src/lib/shared/scanPages.ts +0 -25
  724. package/src/lib/shared/selectorMatcher.ts +0 -55
  725. package/src/lib/shared/selectorPrefix.ts +0 -32
  726. package/src/lib/shared/serializeEnv.ts +0 -30
  727. package/src/lib/shared/serializeSelector.ts +0 -69
  728. package/src/lib/shared/setAppName.ts +0 -5
  729. package/src/lib/shared/setOwnProperty.ts +0 -19
  730. package/src/lib/shared/setsIntersect.ts +0 -15
  731. package/src/lib/shared/sharedCacheStore.ts +0 -14
  732. package/src/lib/shared/sharedCacheStoreSlot.ts +0 -10
  733. package/src/lib/shared/skipNonCode.ts +0 -230
  734. package/src/lib/shared/snapshotShippable.ts +0 -23
  735. package/src/lib/shared/snippet.ts +0 -30
  736. package/src/lib/shared/socketNameForFile.ts +0 -11
  737. package/src/lib/shared/socketTailsSlot.ts +0 -13
  738. package/src/lib/shared/socketTapSlot.ts +0 -12
  739. package/src/lib/shared/sseErrorFrame.ts +0 -29
  740. package/src/lib/shared/streamResponse.ts +0 -180
  741. package/src/lib/shared/streamedCellsSlot.ts +0 -14
  742. package/src/lib/shared/stripImport.ts +0 -29
  743. package/src/lib/shared/subscribableFromResponse.ts +0 -51
  744. package/src/lib/shared/subscribableProbes.ts +0 -111
  745. package/src/lib/shared/tailProbeSlot.ts +0 -23
  746. package/src/lib/shared/toTagSet.ts +0 -4
  747. package/src/lib/shared/trace.ts +0 -16
  748. package/src/lib/shared/types/AmendApply.ts +0 -15
  749. package/src/lib/shared/types/AsyncComputed.ts +0 -20
  750. package/src/lib/shared/types/AsyncState.ts +0 -13
  751. package/src/lib/shared/types/CacheEntry.ts +0 -100
  752. package/src/lib/shared/types/CacheInvalidation.ts +0 -9
  753. package/src/lib/shared/types/CacheOnContext.ts +0 -15
  754. package/src/lib/shared/types/CacheOptions.ts +0 -53
  755. package/src/lib/shared/types/CachePolicy.ts +0 -31
  756. package/src/lib/shared/types/CacheReaderHook.ts +0 -11
  757. package/src/lib/shared/types/CacheSelector.ts +0 -17
  758. package/src/lib/shared/types/CacheSnapshotEntry.ts +0 -32
  759. package/src/lib/shared/types/CacheStalenessApply.ts +0 -13
  760. package/src/lib/shared/types/CacheStalenessFrame.ts +0 -24
  761. package/src/lib/shared/types/CacheStats.ts +0 -13
  762. package/src/lib/shared/types/CacheStore.ts +0 -45
  763. package/src/lib/shared/types/ChannelLog.ts +0 -13
  764. package/src/lib/shared/types/ClientFlags.ts +0 -13
  765. package/src/lib/shared/types/CompileTarget.ts +0 -6
  766. package/src/lib/shared/types/DebugGate.ts +0 -10
  767. package/src/lib/shared/types/DocSnapshots.ts +0 -12
  768. package/src/lib/shared/types/ErrorJsonSchemas.ts +0 -8
  769. package/src/lib/shared/types/ErrorSpec.ts +0 -11
  770. package/src/lib/shared/types/FrameworkLog.ts +0 -13
  771. package/src/lib/shared/types/HttpMethod.ts +0 -3
  772. package/src/lib/shared/types/InputCoercion.ts +0 -17
  773. package/src/lib/shared/types/LastConnection.ts +0 -9
  774. package/src/lib/shared/types/Log.ts +0 -13
  775. package/src/lib/shared/types/LogRecord.ts +0 -42
  776. package/src/lib/shared/types/LogVoice.ts +0 -7
  777. package/src/lib/shared/types/NamedAsyncIterable.ts +0 -26
  778. package/src/lib/shared/types/OutputWirePlan.ts +0 -17
  779. package/src/lib/shared/types/PageSnapshot.ts +0 -14
  780. package/src/lib/shared/types/PagesScan.ts +0 -7
  781. package/src/lib/shared/types/PendingAsyncCells.ts +0 -10
  782. package/src/lib/shared/types/PromptArgument.ts +0 -12
  783. package/src/lib/shared/types/RawRemoteFunction.ts +0 -20
  784. package/src/lib/shared/types/RemoteCallable.ts +0 -40
  785. package/src/lib/shared/types/RemoteFunction.ts +0 -116
  786. package/src/lib/shared/types/ReplayableMethod.ts +0 -7
  787. package/src/lib/shared/types/RequestScopeInfo.ts +0 -16
  788. package/src/lib/shared/types/ResolvedCells.ts +0 -11
  789. package/src/lib/shared/types/ResolverSlot.ts +0 -13
  790. package/src/lib/shared/types/ReturnBody.ts +0 -15
  791. package/src/lib/shared/types/RpcBuildStamps.ts +0 -32
  792. package/src/lib/shared/types/RpcError.ts +0 -26
  793. package/src/lib/shared/types/RpcErrorGuard.ts +0 -35
  794. package/src/lib/shared/types/RpcInvoker.ts +0 -6
  795. package/src/lib/shared/types/RpcOptions.ts +0 -22
  796. package/src/lib/shared/types/Socket.ts +0 -54
  797. package/src/lib/shared/types/SocketChannel.ts +0 -17
  798. package/src/lib/shared/types/SocketClientFrame.ts +0 -19
  799. package/src/lib/shared/types/SocketServerFrame.ts +0 -24
  800. package/src/lib/shared/types/SocketSubCallbacks.ts +0 -13
  801. package/src/lib/shared/types/SocketTails.ts +0 -13
  802. package/src/lib/shared/types/SourceMap.ts +0 -14
  803. package/src/lib/shared/types/SsrBootState.ts +0 -27
  804. package/src/lib/shared/types/SsrPayload.ts +0 -36
  805. package/src/lib/shared/types/StandardSchemaV1.ts +0 -56
  806. package/src/lib/shared/types/StreamPolicy.ts +0 -11
  807. package/src/lib/shared/types/StreamedCells.ts +0 -19
  808. package/src/lib/shared/types/StreamedResolution.ts +0 -28
  809. package/src/lib/shared/types/TailHooks.ts +0 -13
  810. package/src/lib/shared/types/TraceContext.ts +0 -17
  811. package/src/lib/shared/types/ValidationErrorData.ts +0 -20
  812. package/src/lib/shared/types/WireKind.ts +0 -11
  813. package/src/lib/shared/url.ts +0 -141
  814. package/src/lib/shared/validationHttpError.ts +0 -33
  815. package/src/lib/shared/warmSeedKey.ts +0 -16
  816. package/src/lib/shared/wireJsonReplacer.ts +0 -30
  817. package/src/lib/shared/withBase.ts +0 -10
  818. package/src/lib/shared/withBaseUrl.ts +0 -17
  819. package/src/lib/shared/withCacheManaged.ts +0 -18
  820. package/src/lib/shared/withJsonSchema.ts +0 -21
  821. package/src/lib/shared/writeDts.ts +0 -19
  822. package/src/lib/shared/writeHealthDts.ts +0 -36
  823. package/src/lib/shared/writeLastConnection.ts +0 -13
  824. package/src/lib/shared/writePublicAssetsDts.ts +0 -27
  825. package/src/lib/shared/writeRoutesDts.ts +0 -41
  826. package/src/lib/shared/writeRpcDts.ts +0 -60
  827. package/src/lib/shared/writeTestRpcDts.ts +0 -45
  828. package/src/lib/shared/writeTestSocketsDts.ts +0 -34
  829. package/src/lib/test/assertAgentFrameConformance.ts +0 -73
  830. package/src/lib/test/createScriptedSurface.ts +0 -45
  831. package/src/lib/test/createTestApp.ts +0 -242
  832. package/src/lib/test/createTestSocketChannel.ts +0 -85
  833. package/src/lib/ui/README.md +0 -86
  834. package/src/lib/ui/activePendingCells.ts +0 -14
  835. package/src/lib/ui/amendReaderHook.ts +0 -125
  836. package/src/lib/ui/compile/ABIDE_SEMANTIC_TOKENS_LEGEND.ts +0 -79
  837. package/src/lib/ui/compile/AbideCompileError.ts +0 -16
  838. package/src/lib/ui/compile/BLOCK_KEYWORDS.ts +0 -21
  839. package/src/lib/ui/compile/SSR_ESCAPE.ts +0 -40
  840. package/src/lib/ui/compile/TS_PRINTER.ts +0 -7
  841. package/src/lib/ui/compile/UI_RUNTIME_IMPORTS.ts +0 -86
  842. package/src/lib/ui/compile/VOID_TAGS.ts +0 -22
  843. package/src/lib/ui/compile/abideUiPlugin.ts +0 -109
  844. package/src/lib/ui/compile/analyzeComponent.ts +0 -222
  845. package/src/lib/ui/compile/asOutlet.ts +0 -30
  846. package/src/lib/ui/compile/assertTranspiles.ts +0 -19
  847. package/src/lib/ui/compile/assetModulesFile.ts +0 -32
  848. package/src/lib/ui/compile/assignmentTargetNames.ts +0 -54
  849. package/src/lib/ui/compile/asyncInterpolationFields.ts +0 -152
  850. package/src/lib/ui/compile/asyncValuePositionError.ts +0 -21
  851. package/src/lib/ui/compile/asyncValuePositionInterpolations.ts +0 -64
  852. package/src/lib/ui/compile/attrLiftPosition.ts +0 -18
  853. package/src/lib/ui/compile/awaitPlan.ts +0 -60
  854. package/src/lib/ui/compile/awaitSubjectExpr.ts +0 -23
  855. package/src/lib/ui/compile/bindListenEvent.ts +0 -18
  856. package/src/lib/ui/compile/cachedShadowProgram.ts +0 -39
  857. package/src/lib/ui/compile/cachedSourceFile.ts +0 -40
  858. package/src/lib/ui/compile/catchBinding.ts +0 -10
  859. package/src/lib/ui/compile/classStyleMergePlan.ts +0 -108
  860. package/src/lib/ui/compile/classifyInterpolationType.ts +0 -46
  861. package/src/lib/ui/compile/collectAbideDiagnostics.ts +0 -166
  862. package/src/lib/ui/compile/compileComponent.ts +0 -46
  863. package/src/lib/ui/compile/compileModule.ts +0 -306
  864. package/src/lib/ui/compile/compileSSR.ts +0 -119
  865. package/src/lib/ui/compile/compileShadow.ts +0 -1326
  866. package/src/lib/ui/compile/componentOrdinals.ts +0 -39
  867. package/src/lib/ui/compile/composeProps.ts +0 -64
  868. package/src/lib/ui/compile/createShadowLanguageService.ts +0 -348
  869. package/src/lib/ui/compile/createShadowProgram.ts +0 -127
  870. package/src/lib/ui/compile/createShadowScope.ts +0 -42
  871. package/src/lib/ui/compile/declaredNames.ts +0 -36
  872. package/src/lib/ui/compile/decodeHtmlEntities.ts +0 -53
  873. package/src/lib/ui/compile/destructureBindingNames.ts +0 -38
  874. package/src/lib/ui/compile/desugarSignals.ts +0 -1113
  875. package/src/lib/ui/compile/eachPlan.ts +0 -61
  876. package/src/lib/ui/compile/elementPlan.ts +0 -55
  877. package/src/lib/ui/compile/encodeSemanticTokens.ts +0 -60
  878. package/src/lib/ui/compile/expressionIsPrefixEvaluable.ts +0 -19
  879. package/src/lib/ui/compile/generateBuild.ts +0 -903
  880. package/src/lib/ui/compile/generateSSR.ts +0 -973
  881. package/src/lib/ui/compile/groupBindParts.ts +0 -28
  882. package/src/lib/ui/compile/hasTopLevelAwait.ts +0 -28
  883. package/src/lib/ui/compile/hoistCells.ts +0 -120
  884. package/src/lib/ui/compile/hoistableAwaits.ts +0 -183
  885. package/src/lib/ui/compile/hoistableChildRenders.ts +0 -112
  886. package/src/lib/ui/compile/identifierReferencePattern.ts +0 -13
  887. package/src/lib/ui/compile/ifPlan.ts +0 -36
  888. package/src/lib/ui/compile/interpolatedTemplateLiteral.ts +0 -27
  889. package/src/lib/ui/compile/interpolationClassifierForRoot.ts +0 -32
  890. package/src/lib/ui/compile/isAnchorPositioned.ts +0 -19
  891. package/src/lib/ui/compile/isControlFlow.ts +0 -20
  892. package/src/lib/ui/compile/isFunctionScopeBoundary.ts +0 -20
  893. package/src/lib/ui/compile/isPlainIdentifier.ts +0 -7
  894. package/src/lib/ui/compile/isSpuriousAsyncReadDiagnostic.ts +0 -215
  895. package/src/lib/ui/compile/isTextLeaf.ts +0 -16
  896. package/src/lib/ui/compile/isWhitespaceText.ts +0 -19
  897. package/src/lib/ui/compile/liftAsyncSubExpressions.ts +0 -166
  898. package/src/lib/ui/compile/liftScriptSeed.ts +0 -47
  899. package/src/lib/ui/compile/loadShadowTsConfig.ts +0 -31
  900. package/src/lib/ui/compile/lowerAsyncInterpolations.ts +0 -92
  901. package/src/lib/ui/compile/lowerCompoundAssignment.ts +0 -49
  902. package/src/lib/ui/compile/lowerContext.ts +0 -167
  903. package/src/lib/ui/compile/lowerDocAccess.ts +0 -302
  904. package/src/lib/ui/compile/lowerScript.ts +0 -190
  905. package/src/lib/ui/compile/lowerUpdateExpression.ts +0 -32
  906. package/src/lib/ui/compile/makeVarNamer.ts +0 -10
  907. package/src/lib/ui/compile/nearestProjectRoot.ts +0 -16
  908. package/src/lib/ui/compile/nodeAtShadowOffset.ts +0 -28
  909. package/src/lib/ui/compile/offsetToLineColumn.ts +0 -16
  910. package/src/lib/ui/compile/offsetToPosition.ts +0 -9
  911. package/src/lib/ui/compile/pagePropsType.ts +0 -23
  912. package/src/lib/ui/compile/parseTemplate.ts +0 -25
  913. package/src/lib/ui/compile/parseTemplateRecovering.ts +0 -1385
  914. package/src/lib/ui/compile/prepareNestedScript.ts +0 -62
  915. package/src/lib/ui/compile/reactiveBinding.ts +0 -47
  916. package/src/lib/ui/compile/referencedIdentifiers.ts +0 -35
  917. package/src/lib/ui/compile/remapShadowDiagnostic.ts +0 -30
  918. package/src/lib/ui/compile/renameSignalRefs.ts +0 -425
  919. package/src/lib/ui/compile/resolveAbideImports.ts +0 -29
  920. package/src/lib/ui/compile/resolveBranches.ts +0 -21
  921. package/src/lib/ui/compile/resolveReactiveExport.ts +0 -92
  922. package/src/lib/ui/compile/scopeAttr.ts +0 -9
  923. package/src/lib/ui/compile/scopeCss.ts +0 -138
  924. package/src/lib/ui/compile/seedTypeClassifierForRoot.ts +0 -60
  925. package/src/lib/ui/compile/shadowInterpolationClassifier.ts +0 -47
  926. package/src/lib/ui/compile/shadowNaming.ts +0 -11
  927. package/src/lib/ui/compile/signalCallee.ts +0 -24
  928. package/src/lib/ui/compile/skeletonContext.ts +0 -133
  929. package/src/lib/ui/compile/skeletonable.ts +0 -68
  930. package/src/lib/ui/compile/snippetPlan.ts +0 -28
  931. package/src/lib/ui/compile/sourceFileOptionsSignature.ts +0 -20
  932. package/src/lib/ui/compile/sourceToShadowOffset.ts +0 -24
  933. package/src/lib/ui/compile/spreadExcludedNames.ts +0 -27
  934. package/src/lib/ui/compile/staticAttr.ts +0 -11
  935. package/src/lib/ui/compile/staticAttrValue.ts +0 -13
  936. package/src/lib/ui/compile/staticTextPart.ts +0 -12
  937. package/src/lib/ui/compile/stripEffects.ts +0 -48
  938. package/src/lib/ui/compile/structuralHeadTokens.ts +0 -107
  939. package/src/lib/ui/compile/switchPlan.ts +0 -28
  940. package/src/lib/ui/compile/templateAnchorAdapter.ts +0 -61
  941. package/src/lib/ui/compile/templateElementAdapter.ts +0 -44
  942. package/src/lib/ui/compile/templateSemanticTokens.ts +0 -21
  943. package/src/lib/ui/compile/templateStartOffset.ts +0 -15
  944. package/src/lib/ui/compile/tryPlan.ts +0 -37
  945. package/src/lib/ui/compile/types/AbideDiagnostic.ts +0 -14
  946. package/src/lib/ui/compile/types/AnalyzedComponent.ts +0 -42
  947. package/src/lib/ui/compile/types/AsyncInterpolationField.ts +0 -19
  948. package/src/lib/ui/compile/types/Binding.ts +0 -24
  949. package/src/lib/ui/compile/types/CompiledShadow.ts +0 -27
  950. package/src/lib/ui/compile/types/ElementPlan.ts +0 -43
  951. package/src/lib/ui/compile/types/InterpolationClassifier.ts +0 -12
  952. package/src/lib/ui/compile/types/InterpolationKind.ts +0 -7
  953. package/src/lib/ui/compile/types/ParseDiagnostic.ts +0 -8
  954. package/src/lib/ui/compile/types/SeedTypeClassifier.ts +0 -15
  955. package/src/lib/ui/compile/types/SemanticToken.ts +0 -11
  956. package/src/lib/ui/compile/types/ShadowKind.ts +0 -9
  957. package/src/lib/ui/compile/types/ShadowScope.ts +0 -19
  958. package/src/lib/ui/compile/types/SkeletonContext.ts +0 -21
  959. package/src/lib/ui/compile/types/TemplateAttr.ts +0 -34
  960. package/src/lib/ui/compile/types/TemplateNode.ts +0 -137
  961. package/src/lib/ui/compile/types/TextPart.ts +0 -8
  962. package/src/lib/ui/compile/types/ValuePositionInterpolation.ts +0 -13
  963. package/src/lib/ui/compile/unwrapParens.ts +0 -10
  964. package/src/lib/ui/compile/walkAnchorOrder.ts +0 -57
  965. package/src/lib/ui/compile/walkElementOrder.ts +0 -60
  966. package/src/lib/ui/compile/withBindings.ts +0 -45
  967. package/src/lib/ui/compile/wrapReactionCellSources.ts +0 -121
  968. package/src/lib/ui/compile/wrapReactiveSeeds.ts +0 -44
  969. package/src/lib/ui/compile/wrapSeed.ts +0 -28
  970. package/src/lib/ui/compile/writtenTemplateNames.ts +0 -84
  971. package/src/lib/ui/computed.ts +0 -75
  972. package/src/lib/ui/createScope.ts +0 -157
  973. package/src/lib/ui/dom/MATHML_NAMESPACE.ts +0 -6
  974. package/src/lib/ui/dom/SVG_NAMESPACE.ts +0 -8
  975. package/src/lib/ui/dom/adoptRange.ts +0 -27
  976. package/src/lib/ui/dom/anchorCursor.ts +0 -25
  977. package/src/lib/ui/dom/anchoredBranch.ts +0 -153
  978. package/src/lib/ui/dom/appendSnippet.ts +0 -75
  979. package/src/lib/ui/dom/appendStatic.ts +0 -26
  980. package/src/lib/ui/dom/appendText.ts +0 -160
  981. package/src/lib/ui/dom/appendTextAt.ts +0 -39
  982. package/src/lib/ui/dom/assertClaimedText.ts +0 -30
  983. package/src/lib/ui/dom/attach.ts +0 -25
  984. package/src/lib/ui/dom/attr.ts +0 -57
  985. package/src/lib/ui/dom/awaitBlock.ts +0 -314
  986. package/src/lib/ui/dom/awaitSubject.ts +0 -118
  987. package/src/lib/ui/dom/bindProp.ts +0 -22
  988. package/src/lib/ui/dom/bindSelectValue.ts +0 -48
  989. package/src/lib/ui/dom/bindableProp.ts +0 -47
  990. package/src/lib/ui/dom/buildDetachedRange.ts +0 -31
  991. package/src/lib/ui/dom/cellPending.ts +0 -24
  992. package/src/lib/ui/dom/claimText.ts +0 -38
  993. package/src/lib/ui/dom/clearBetween.ts +0 -16
  994. package/src/lib/ui/dom/cloneStatic.ts +0 -69
  995. package/src/lib/ui/dom/commentData.ts +0 -14
  996. package/src/lib/ui/dom/depthZeroNodes.ts +0 -34
  997. package/src/lib/ui/dom/discardAndRebuild.ts +0 -23
  998. package/src/lib/ui/dom/discardBoundary.ts +0 -46
  999. package/src/lib/ui/dom/disposeRange.ts +0 -18
  1000. package/src/lib/ui/dom/domAnchorAdapter.ts +0 -29
  1001. package/src/lib/ui/dom/domElementAdapter.ts +0 -20
  1002. package/src/lib/ui/dom/each.ts +0 -253
  1003. package/src/lib/ui/dom/eachAsync.ts +0 -188
  1004. package/src/lib/ui/dom/effectiveChildNamespace.ts +0 -13
  1005. package/src/lib/ui/dom/enterNamespace.ts +0 -20
  1006. package/src/lib/ui/dom/fillBefore.ts +0 -42
  1007. package/src/lib/ui/dom/fillBoundary.ts +0 -38
  1008. package/src/lib/ui/dom/fillRange.ts +0 -30
  1009. package/src/lib/ui/dom/foreignWrapperTag.ts +0 -22
  1010. package/src/lib/ui/dom/hydrate.ts +0 -34
  1011. package/src/lib/ui/dom/inheritedNamespace.ts +0 -19
  1012. package/src/lib/ui/dom/isComment.ts +0 -6
  1013. package/src/lib/ui/dom/isElement.ts +0 -6
  1014. package/src/lib/ui/dom/markerDepthDelta.ts +0 -19
  1015. package/src/lib/ui/dom/matchingRangeClose.ts +0 -29
  1016. package/src/lib/ui/dom/mergeProps.ts +0 -32
  1017. package/src/lib/ui/dom/mount.ts +0 -30
  1018. package/src/lib/ui/dom/mountChild.ts +0 -129
  1019. package/src/lib/ui/dom/mountRange.ts +0 -48
  1020. package/src/lib/ui/dom/mountSlot.ts +0 -38
  1021. package/src/lib/ui/dom/mountSwappableRange.ts +0 -122
  1022. package/src/lib/ui/dom/moveRange.ts +0 -19
  1023. package/src/lib/ui/dom/mutateDocContainer.ts +0 -65
  1024. package/src/lib/ui/dom/on.ts +0 -33
  1025. package/src/lib/ui/dom/openMarker.ts +0 -22
  1026. package/src/lib/ui/dom/outlet.ts +0 -63
  1027. package/src/lib/ui/dom/parseRawNodes.ts +0 -17
  1028. package/src/lib/ui/dom/readCall.ts +0 -29
  1029. package/src/lib/ui/dom/readCell.ts +0 -55
  1030. package/src/lib/ui/dom/readTextOrSuspend.ts +0 -21
  1031. package/src/lib/ui/dom/removeRange.ts +0 -18
  1032. package/src/lib/ui/dom/replaceRange.ts +0 -24
  1033. package/src/lib/ui/dom/restProps.ts +0 -32
  1034. package/src/lib/ui/dom/skeleton.ts +0 -153
  1035. package/src/lib/ui/dom/spreadAttrs.ts +0 -95
  1036. package/src/lib/ui/dom/spreadProps.ts +0 -31
  1037. package/src/lib/ui/dom/switchBlock.ts +0 -80
  1038. package/src/lib/ui/dom/templateFor.ts +0 -28
  1039. package/src/lib/ui/dom/tryBlock.ts +0 -263
  1040. package/src/lib/ui/dom/types/EachRow.ts +0 -21
  1041. package/src/lib/ui/dom/types/SkeletonHoles.ts +0 -10
  1042. package/src/lib/ui/dom/types/SwitchCase.ts +0 -11
  1043. package/src/lib/ui/dom/when.ts +0 -58
  1044. package/src/lib/ui/dom/withScope.ts +0 -37
  1045. package/src/lib/ui/dom/withSuspense.ts +0 -22
  1046. package/src/lib/ui/dom/writeCell.ts +0 -22
  1047. package/src/lib/ui/effect.ts +0 -24
  1048. package/src/lib/ui/enterScope.ts +0 -18
  1049. package/src/lib/ui/exitScope.ts +0 -8
  1050. package/src/lib/ui/finalizeStreamedChildren.ts +0 -88
  1051. package/src/lib/ui/flight.ts +0 -56
  1052. package/src/lib/ui/html.ts +0 -39
  1053. package/src/lib/ui/isolateCellBarrier.ts +0 -17
  1054. package/src/lib/ui/linked.ts +0 -125
  1055. package/src/lib/ui/navigate.ts +0 -77
  1056. package/src/lib/ui/probeNavigation.ts +0 -33
  1057. package/src/lib/ui/props.ts +0 -17
  1058. package/src/lib/ui/remoteProxy.ts +0 -256
  1059. package/src/lib/ui/renderChain.ts +0 -113
  1060. package/src/lib/ui/renderToStream.ts +0 -128
  1061. package/src/lib/ui/resumeSeedScript.ts +0 -27
  1062. package/src/lib/ui/router.ts +0 -649
  1063. package/src/lib/ui/runtime/AsyncCellError.ts +0 -21
  1064. package/src/lib/ui/runtime/BRANCH_SEGMENT.ts +0 -24
  1065. package/src/lib/ui/runtime/CELL_SEED.ts +0 -12
  1066. package/src/lib/ui/runtime/CHILD_PRESENT.ts +0 -8
  1067. package/src/lib/ui/runtime/CURRENT_BOUNDARY.ts +0 -11
  1068. package/src/lib/ui/runtime/CURRENT_PATH.ts +0 -29
  1069. package/src/lib/ui/runtime/CURRENT_SCOPE.ts +0 -23
  1070. package/src/lib/ui/runtime/DOC_SEED.ts +0 -10
  1071. package/src/lib/ui/runtime/HOLE_ATTRIBUTE.ts +0 -9
  1072. package/src/lib/ui/runtime/NODE_STATE.ts +0 -22
  1073. package/src/lib/ui/runtime/OUTLET_MARKER.ts +0 -10
  1074. package/src/lib/ui/runtime/OUTLET_TAG.ts +0 -7
  1075. package/src/lib/ui/runtime/OWNER.ts +0 -8
  1076. package/src/lib/ui/runtime/PENDING_OUTLET.ts +0 -8
  1077. package/src/lib/ui/runtime/RANGE_MARKER.ts +0 -18
  1078. package/src/lib/ui/runtime/REACTIVE_CONTEXT.ts +0 -20
  1079. package/src/lib/ui/runtime/RENDER.ts +0 -35
  1080. package/src/lib/ui/runtime/REQUEST_SUPERSEDED.ts +0 -8
  1081. package/src/lib/ui/runtime/RESUME.ts +0 -21
  1082. package/src/lib/ui/runtime/SEED_MARKS.ts +0 -14
  1083. package/src/lib/ui/runtime/STREAMED_CELLS.ts +0 -57
  1084. package/src/lib/ui/runtime/SuspenseSignal.ts +0 -24
  1085. package/src/lib/ui/runtime/abortNode.ts +0 -22
  1086. package/src/lib/ui/runtime/ambientPathBacking.ts +0 -32
  1087. package/src/lib/ui/runtime/ambientScopeBacking.ts +0 -26
  1088. package/src/lib/ui/runtime/applyPatchToTree.ts +0 -54
  1089. package/src/lib/ui/runtime/batch.ts +0 -22
  1090. package/src/lib/ui/runtime/blockId.ts +0 -31
  1091. package/src/lib/ui/runtime/boundaryFor.ts +0 -11
  1092. package/src/lib/ui/runtime/cellBarrierBacking.ts +0 -30
  1093. package/src/lib/ui/runtime/claimChild.ts +0 -8
  1094. package/src/lib/ui/runtime/claimExpected.ts +0 -27
  1095. package/src/lib/ui/runtime/claimMarker.ts +0 -13
  1096. package/src/lib/ui/runtime/claimRun.ts +0 -22
  1097. package/src/lib/ui/runtime/clientPage.ts +0 -116
  1098. package/src/lib/ui/runtime/consumeSeed.ts +0 -38
  1099. package/src/lib/ui/runtime/createAsyncCell.ts +0 -358
  1100. package/src/lib/ui/runtime/createComputedNode.ts +0 -19
  1101. package/src/lib/ui/runtime/createDoc.ts +0 -334
  1102. package/src/lib/ui/runtime/createEffectNode.ts +0 -81
  1103. package/src/lib/ui/runtime/createSignalNode.ts +0 -19
  1104. package/src/lib/ui/runtime/currentAbortSignal.ts +0 -26
  1105. package/src/lib/ui/runtime/detachLink.ts +0 -21
  1106. package/src/lib/ui/runtime/endTracking.ts +0 -24
  1107. package/src/lib/ui/runtime/enterRenderPass.ts +0 -13
  1108. package/src/lib/ui/runtime/escapeKey.ts +0 -19
  1109. package/src/lib/ui/runtime/exitRenderPass.ts +0 -7
  1110. package/src/lib/ui/runtime/flushEffects.ts +0 -91
  1111. package/src/lib/ui/runtime/generationGuard.ts +0 -40
  1112. package/src/lib/ui/runtime/historyEntries.ts +0 -151
  1113. package/src/lib/ui/runtime/inScope.ts +0 -19
  1114. package/src/lib/ui/runtime/isAsyncFunction.ts +0 -14
  1115. package/src/lib/ui/runtime/nextBlockId.ts +0 -12
  1116. package/src/lib/ui/runtime/parkCursor.ts +0 -10
  1117. package/src/lib/ui/runtime/pathSegments.ts +0 -10
  1118. package/src/lib/ui/runtime/reactiveAbortState.ts +0 -15
  1119. package/src/lib/ui/runtime/readNode.ts +0 -38
  1120. package/src/lib/ui/runtime/renderPath.ts +0 -16
  1121. package/src/lib/ui/runtime/reportHydrationDivergence.ts +0 -30
  1122. package/src/lib/ui/runtime/routeBareSeed.ts +0 -28
  1123. package/src/lib/ui/runtime/runHydrationPass.ts +0 -69
  1124. package/src/lib/ui/runtime/runNode.ts +0 -75
  1125. package/src/lib/ui/runtime/runtimePath.ts +0 -9
  1126. package/src/lib/ui/runtime/scope.ts +0 -46
  1127. package/src/lib/ui/runtime/scopeGroup.ts +0 -40
  1128. package/src/lib/ui/runtime/toTeardown.ts +0 -38
  1129. package/src/lib/ui/runtime/track.ts +0 -60
  1130. package/src/lib/ui/runtime/trigger.ts +0 -74
  1131. package/src/lib/ui/runtime/types/AbideHistoryState.ts +0 -9
  1132. package/src/lib/ui/runtime/types/Boundary.ts +0 -9
  1133. package/src/lib/ui/runtime/types/Cell.ts +0 -7
  1134. package/src/lib/ui/runtime/types/Computed.ts +0 -3
  1135. package/src/lib/ui/runtime/types/Doc.ts +0 -24
  1136. package/src/lib/ui/runtime/types/EffectResult.ts +0 -10
  1137. package/src/lib/ui/runtime/types/HydrationCursor.ts +0 -8
  1138. package/src/lib/ui/runtime/types/NavVerdict.ts +0 -9
  1139. package/src/lib/ui/runtime/types/Patch.ts +0 -11
  1140. package/src/lib/ui/runtime/types/PathWalk.ts +0 -10
  1141. package/src/lib/ui/runtime/types/ReactiveLink.ts +0 -21
  1142. package/src/lib/ui/runtime/types/ReactiveNode.ts +0 -33
  1143. package/src/lib/ui/runtime/types/RenderContext.ts +0 -10
  1144. package/src/lib/ui/runtime/types/Route.ts +0 -9
  1145. package/src/lib/ui/runtime/types/RouteLoader.ts +0 -7
  1146. package/src/lib/ui/runtime/types/SsrRender.ts +0 -34
  1147. package/src/lib/ui/runtime/types/State.ts +0 -3
  1148. package/src/lib/ui/runtime/types/Teardown.ts +0 -5
  1149. package/src/lib/ui/runtime/types/UiComponent.ts +0 -24
  1150. package/src/lib/ui/runtime/types/UiProps.ts +0 -12
  1151. package/src/lib/ui/runtime/unescapeKey.ts +0 -12
  1152. package/src/lib/ui/runtime/unlinkDeps.ts +0 -28
  1153. package/src/lib/ui/runtime/untrack.ts +0 -20
  1154. package/src/lib/ui/runtime/updateIfNecessary.ts +0 -40
  1155. package/src/lib/ui/runtime/walkPath.ts +0 -41
  1156. package/src/lib/ui/runtime/withOptionalPath.ts +0 -8
  1157. package/src/lib/ui/runtime/withPath.ts +0 -16
  1158. package/src/lib/ui/runtime/withPathFrom.ts +0 -20
  1159. package/src/lib/ui/runtime/withoutHydration.ts +0 -22
  1160. package/src/lib/ui/runtime/writeNode.ts +0 -16
  1161. package/src/lib/ui/scope.ts +0 -20
  1162. package/src/lib/ui/seedBootState.ts +0 -53
  1163. package/src/lib/ui/seedStreamedResolution.ts +0 -56
  1164. package/src/lib/ui/settleAsyncCells.ts +0 -51
  1165. package/src/lib/ui/socketChannel.ts +0 -156
  1166. package/src/lib/ui/socketProxy.ts +0 -47
  1167. package/src/lib/ui/startClient.ts +0 -156
  1168. package/src/lib/ui/state.ts +0 -77
  1169. package/src/lib/ui/subscribeCacheStaleness.ts +0 -85
  1170. package/src/lib/ui/trackedComputed.ts +0 -68
  1171. package/src/lib/ui/tryEncodeResume.ts +0 -11
  1172. package/src/lib/ui/types/Layouts.ts +0 -9
  1173. package/src/lib/ui/types/Pages.ts +0 -8
  1174. package/src/lib/ui/types/Scope.ts +0 -68
  1175. package/src/lib/ui/watch.ts +0 -150
  1176. package/src/preload.ts +0 -19
  1177. package/src/scaffold.ts +0 -153
  1178. package/src/serverBuildPlugins.ts +0 -25
  1179. package/src/serverEntry.ts +0 -138
  1180. package/src/zodCjsPlugin.ts +0 -51
  1181. package/template/.zed/settings.json +0 -10
  1182. package/template/CLAUDE.md +0 -22
  1183. package/template/bunfig.toml +0 -4
  1184. package/template/package.json +0 -21
  1185. package/template/src/app.ts +0 -28
  1186. package/template/src/bundle/icon.png +0 -0
  1187. package/template/src/cli/banner.txt +0 -3
  1188. package/template/src/cli/footer.txt +0 -1
  1189. package/template/src/server/config.ts +0 -17
  1190. package/template/src/server/rpc/getHello.ts +0 -38
  1191. package/template/src/ui/app.css +0 -21
  1192. package/template/src/ui/app.html +0 -24
  1193. package/template/src/ui/pages/about/page.abide +0 -7
  1194. package/template/src/ui/pages/layout.abide +0 -19
  1195. package/template/src/ui/pages/page.abide +0 -19
  1196. package/template/test/app.test.ts +0 -30
  1197. package/template/tsconfig.json +0 -18
  1198. package/tsconfig.app.json +0 -17
@@ -0,0 +1,1079 @@
1
+ import { type Dirent, readdirSync, statSync } from 'node:fs' // Bun exposes no sync directory listing of its own
2
+ import { basename, dirname, join, resolve } from 'node:path' // Bun exposes no path helpers of its own
3
+ import { type Node, NodeFlags, SyntaxKind } from 'typescript/unstable/ast'
4
+ import {
5
+ API,
6
+ type Symbol as CheckedSymbol,
7
+ type Checker,
8
+ NodeBuilderFlags,
9
+ type Project,
10
+ SignatureKind,
11
+ SymbolFlags,
12
+ } from 'typescript/unstable/async'
13
+ import { fileKind, routeOf } from '#shared/routePattern.ts'
14
+ import { aliasedSymbol } from './aliasedSymbol.ts'
15
+ import { AMBIENT_SOURCES, ambientReadsIn } from './ambientReadsIn.ts'
16
+ import { argsDefaultsIn } from './argsDefaultsIn.ts'
17
+ import { type CheckerAnswer, UNCHECKED } from './CheckerAnswer.ts'
18
+ import {
19
+ COMPONENT_MODULE,
20
+ COMPONENT_STAND_IN,
21
+ checkedShadow,
22
+ } from './checkedShadow.ts'
23
+ import type { Finding } from './Finding.ts'
24
+ import { CHECKED_VALUES } from './Lowering.ts'
25
+ import { diagnosisAt, lineOf } from './lineOf.ts'
26
+ import type { AbideFile } from './parseAbide.ts'
27
+ import { projectShadow } from './projectShadow.ts'
28
+ import { abideIn } from './reactiveTypes.ts'
29
+ import type { ParsedSource, ReadSource } from './readSources.ts'
30
+ import { readsIn, type ShadowSpans } from './readsIn.ts'
31
+ import { CHECKED_SUFFIX, ShadowMap } from './ShadowMap.ts'
32
+ import { templateWarnings } from './templateWarnings.ts'
33
+
34
+ // Where 31.3 gets its answer. A `.abide` file is projected into a SHADOW `.ts` held in a virtual
35
+ // filesystem and never written to disk, and TypeScript's own checker is asked what each declared
36
+ // name's type is. That is the whole reason the checker is here rather than a local inference over
37
+ // annotations: the corpus writes `let rows = reactive([...])` with no annotation anywhere, so the
38
+ // answer comes from the initializer's INFERRED type or it does not come at all.
39
+ //
40
+ // The API is the ASYNC one on purpose. `typescript/unstable/sync` reads `child.stdout._handle.fd`
41
+ // and bun exposes no fd on a child pipe, so the sync channel cannot connect. The async channel is
42
+ // a stream and needs nothing.
43
+
44
+ /** Whether a script can bind a name at all — a file that cannot is never handed to the checker. */
45
+ const DECLARES = /\b(?:const|let|var|import)\b/
46
+
47
+ /** A TypeScript checker session over an app, asked about its `.abide` files through shadows. */
48
+ export class TypeSession {
49
+ private api: API
50
+ /** The `tsconfig` the session was opened on, which a file outside its project is refused by. */
51
+ readonly tsconfig: string
52
+ /**
53
+ * Per checker key, the text the checker reads for a file this session wrote, and the path it
54
+ * was registered under.
55
+ *
56
+ * KEYED AS THE CHECKER KEYS ITS OWN CACHE (`keyOf`), not by the string a caller handed in. On a
57
+ * case-insensitive disk the checker folds `Page.abide.shadow.ts` and `page.abide.shadow.ts` to
58
+ * one file, so a map telling them apart reported the second spelling `created` for a file the
59
+ * checker already held — it read nothing, and answered the second text's reads at the first
60
+ * text's offsets.
61
+ */
62
+ private shadows = new Map<string, { path: string; text: string }>()
63
+ /** The checker's own key for a path: resolved, and case-folded where its host folds case. */
64
+ private keyOf: (path: string) => string
65
+ /**
66
+ * Per `.abide` path as the checker keys it (`keyOf`), what `diagnose` last lowered it to —
67
+ * kept for `inspect` alone.
68
+ *
69
+ * THE ONE THING CARRIED FROM ONE CALL TO ANOTHER, because an editor's hover is a request of
70
+ * its own that arrives after the check that lowered the file, and has to map its offset
71
+ * through the lowering the checker's program holds rather than one made again. Everything a
72
+ * check's own caller needs of the lowering, `diagnose` hands back.
73
+ */
74
+ private loweredForInspect = new Map<
75
+ string,
76
+ { text: string; map: ShadowMap }
77
+ >()
78
+
79
+ private constructor(
80
+ api: API,
81
+ tsconfig: string,
82
+ keyOf: (path: string) => string,
83
+ ) {
84
+ this.api = api
85
+ this.tsconfig = tsconfig
86
+ this.keyOf = keyOf
87
+ }
88
+
89
+ /**
90
+ * Checked-module paths a stand-in answered for, without the `.abide` being lowered.
91
+ *
92
+ * 38.40 — A `.abide` THIS SESSION HAS NOT LOWERED IS STILL A MODULE ANOTHER CAN IMPORT. What its
93
+ * checked module exports does not depend on what the component holds (`COMPONENT_MODULE`), so an
94
+ * editor checking one page resolves the components it imports without lowering each of them.
95
+ * Remembered, so the lowering that replaces a stand-in is reported as a change to it.
96
+ */
97
+ private stoodIn = new Set<string>()
98
+
99
+ private standIn(name: string): string | undefined {
100
+ if (!name.endsWith(`.abide${CHECKED_SUFFIX}`)) return undefined
101
+ try {
102
+ if (!statSync(name.slice(0, -CHECKED_SUFFIX.length)).isFile())
103
+ return undefined
104
+ } catch {
105
+ return undefined
106
+ }
107
+ this.stoodIn.add(this.keyOf(name))
108
+ return COMPONENT_MODULE
109
+ }
110
+
111
+ /** Opens a session on the project `tsconfig` configures. */
112
+ static async open(tsconfig: string): Promise<TypeSession> {
113
+ const api = new API({
114
+ cwd: dirname(tsconfig),
115
+ fs: {
116
+ readFile: (name) =>
117
+ session.shadows.get(session.keyOf(name))?.text ??
118
+ session.standIn(name),
119
+ fileExists: (name) =>
120
+ session.shadows.has(session.keyOf(name)) ||
121
+ session.standIn(name) !== undefined
122
+ ? true
123
+ : undefined,
124
+ getAccessibleEntries: (directory) =>
125
+ session.entriesIn(directory),
126
+ },
127
+ })
128
+ // Whether the host folds case is the checker process's answer to `initialize`, and the API
129
+ // keeps it only inside the private `toPath` its own `getSourceFile` keys by — so that is
130
+ // what is read, rather than a second guess at the disk that could disagree with it.
131
+ const internals = api as unknown as {
132
+ ensureInitialized(): Promise<void>
133
+ toPath?: (path: string) => string
134
+ }
135
+ await internals.ensureInitialized()
136
+ const toPath = internals.toPath
137
+ if (typeof toPath !== 'function')
138
+ throw new Error(
139
+ 'abide: the TypeScript API no longer keeps `toPath` where the type session reads it, so a path cannot be keyed as the checker keys it.',
140
+ )
141
+ const session = new TypeSession(api, tsconfig, toPath)
142
+ return session
143
+ }
144
+
145
+ /**
146
+ * The project as of the last snapshot, so a question asked after `readsFor` shares its snapshot
147
+ * rather than taking a second one.
148
+ */
149
+ private latest: Project | undefined = undefined
150
+
151
+ /**
152
+ * Paths edited or deleted on disk since the last snapshot, or `everything`.
153
+ *
154
+ * WHAT THE AUTHOR CHANGED ON DISK since the last snapshot, for a session kept across compiles
155
+ * (`abide dev`). The checker caches every file it has read and is told only about the shadows
156
+ * this class writes, so an edit to a module a page imports answered with the type it had when
157
+ * the session opened: a name made reactive in a `.ts` stayed static, and a handler exported
158
+ * since was not there. `everything` is the edit nobody could name, and drops the whole cache.
159
+ */
160
+ private edits = { present: [] as string[], deleted: [] as string[] }
161
+ private everything = false
162
+
163
+ /**
164
+ * How many snapshots this session has taken.
165
+ *
166
+ * SNAPSHOTS TAKEN, and it is a counter rather than a timing because that is the only form of
167
+ * this claim that survives a loaded machine. One per build is the contract; one per FILE is
168
+ * the shape that made the checker 99.8% of compile time, and it reports the same answers.
169
+ */
170
+ snapshots = 0
171
+
172
+ /**
173
+ * A directory's listing as the checker sees it, with this session's shadows added.
174
+ *
175
+ * The shadow has to appear in its directory's listing or it is not a root of the project and
176
+ * the checker never reads it.
177
+ */
178
+ private entriesIn(
179
+ directory: string,
180
+ ): { files: string[]; directories: string[] } | undefined {
181
+ // TWO PATHS TO ONE DIRECTORY ARE ONE DIRECTORY. A raw string compare said otherwise on a
182
+ // doubled separator, a trailing slash or a relative path, and the shadow then appeared in
183
+ // nobody's listing — so the checker never read it and the refusal below blamed the app's
184
+ // tsconfig for a path this class had mangled.
185
+ const here = this.keyOf(directory)
186
+ const mine: string[] = []
187
+ // The key is the checker's where it is registered, so only the incoming directory needs
188
+ // keying — one `toPath` a call rather than one a shadow.
189
+ for (const [key, shadow] of this.shadows)
190
+ if (dirname(key) === here) mine.push(basename(shadow.path))
191
+ if (mine.length === 0) return undefined
192
+
193
+ const files: string[] = []
194
+ const directories: string[] = []
195
+ // A DIRECTORY THAT IS NOT THERE IS A LISTING OF THE SHADOWS ALONE, not a throw. The
196
+ // checker calls this over the api and a throw crosses back as a remote error, which
197
+ // PANICS the checker process — so a directory deleted between the glob and the ask took
198
+ // the whole command down with it. `abide dev` is where that happens as a matter of
199
+ // course: a generator that rewrites a tree of pages deletes every one of them first, and
200
+ // the watcher fires while it is doing it.
201
+ let entries: Dirent[]
202
+ try {
203
+ entries = readdirSync(directory, { withFileTypes: true })
204
+ } catch (thrown) {
205
+ if ((thrown as { code?: unknown }).code !== 'ENOENT') throw thrown
206
+ return { files: mine, directories: [] }
207
+ }
208
+ // THE LISTING ALREADY KNOWS. A `statSync` per entry was N syscalls for an answer
209
+ // `readdirSync` hands back with the name, and it THREW on a dangling symlink — an Emacs
210
+ // `.#page.abide` lock beside a page took the whole build down with it.
211
+ for (const entry of entries) {
212
+ // A symlink is the one entry the listing cannot answer for, and a dangling one has no
213
+ // answer at all — which is a file as far as this is concerned.
214
+ if (entry.isSymbolicLink()) {
215
+ let followed = false
216
+ try {
217
+ followed = statSync(
218
+ join(directory, entry.name),
219
+ ).isDirectory()
220
+ } catch {
221
+ // Dangling: a file, as `followed` already says.
222
+ }
223
+ if (followed) directories.push(entry.name)
224
+ else files.push(entry.name)
225
+ continue
226
+ }
227
+ if (entry.isDirectory()) directories.push(entry.name)
228
+ else files.push(entry.name)
229
+ }
230
+ for (const name of mine) if (!files.includes(name)) files.push(name)
231
+ return { files, directories }
232
+ }
233
+
234
+ /**
235
+ * Records the paths a watcher saw move, for the next snapshot to invalidate.
236
+ *
237
+ * THE PATHS A WATCHER SAW MOVE, or `undefined` where it saw a move and could not say where.
238
+ * A file that is there is reported CREATED AND CHANGED: `changed` alone leaves a new file out
239
+ * of the project's root set (a `.d.ts` nothing imports is never read), and `created` alone
240
+ * leaves an edited file's cached text in place. A directory is dropped wholesale, because the
241
+ * checker is not told what was under it.
242
+ */
243
+ edited(paths: string[] | undefined): void {
244
+ if (paths === undefined) {
245
+ this.everything = true
246
+ return
247
+ }
248
+ for (const path of paths) {
249
+ let directory: boolean
250
+ try {
251
+ directory = statSync(path).isDirectory()
252
+ } catch {
253
+ this.edits.deleted.push(path)
254
+ // A `.abide` that is gone takes its shadows with it, or the checker keeps a page
255
+ // nobody has as a root of the project for the rest of the session — and a page
256
+ // importing it goes on reading the props its checked module declared.
257
+ const gone = this.keyOf(path)
258
+ for (const [key, shadow] of this.shadows)
259
+ if (
260
+ ShadowMap.isShadowOf(key, gone) ||
261
+ key.startsWith(`${gone}/`)
262
+ ) {
263
+ this.shadows.delete(key)
264
+ this.edits.deleted.push(shadow.path)
265
+ }
266
+ continue
267
+ }
268
+ if (directory) this.everything = true
269
+ else this.edits.present.push(path)
270
+ }
271
+ }
272
+
273
+ /**
274
+ * ONE SNAPSHOT TAKES EVERY EDIT WITH IT: the shadows written for it and whatever moved on disk.
275
+ */
276
+ private async snapshot(
277
+ created: string[],
278
+ changed: string[],
279
+ ): Promise<Project | undefined> {
280
+ const edits = this.edits
281
+ const everything = this.everything
282
+ this.edits = { present: [], deleted: [] }
283
+ this.everything = false
284
+ this.snapshots += 1
285
+ const snapshot = await this.api.updateSnapshot({
286
+ openProjects: [this.tsconfig],
287
+ fileChanges: everything
288
+ ? { invalidateAll: true }
289
+ : {
290
+ created: [...created, ...edits.present],
291
+ changed: [...changed, ...edits.present],
292
+ deleted: edits.deleted,
293
+ },
294
+ })
295
+ this.latest = snapshot.getProjects()[0]
296
+ return this.latest
297
+ }
298
+
299
+ /** Whether the last snapshot still answers: there is one, and nothing has moved since. */
300
+ private get current(): boolean {
301
+ return (
302
+ this.latest !== undefined &&
303
+ !this.everything &&
304
+ this.edits.present.length === 0 &&
305
+ this.edits.deleted.length === 0
306
+ )
307
+ }
308
+
309
+ private async currentProject(
310
+ created: string[] = [],
311
+ changed: string[] = [],
312
+ ): Promise<Project | undefined> {
313
+ return created.length === 0 && changed.length === 0 && this.current
314
+ ? this.latest
315
+ : await this.snapshot(created, changed)
316
+ }
317
+
318
+ /**
319
+ * The project as of every edit so far, for a job to ask its questions of.
320
+ *
321
+ * THE SNAPSHOT IS THE SESSION'S, AND A QUESTION IS ANY MODULE'S: what a handler declares
322
+ * (`declaredExports`) is asked of the same snapshot the reads were, taken only where something
323
+ * moved since.
324
+ */
325
+ project(): Promise<Project | undefined> {
326
+ return this.currentProject()
327
+ }
328
+
329
+ /**
330
+ * THE APP'S OWN FILES the checker holds as roots: under `within`, and neither a dependency nor a
331
+ * declaration file. Resolved against the tsconfig's directory; a caller asking `shadows` keys it.
332
+ */
333
+ private rootsUnder(project: Project, within: string): string[] {
334
+ const root = `${this.canonical(within)}/`
335
+ const roots: string[] = []
336
+ for (const path of project.rootFiles) {
337
+ const canonical = this.canonical(path)
338
+ if (
339
+ canonical.startsWith(root) &&
340
+ !path.includes('/node_modules/') &&
341
+ !path.endsWith('.d.ts')
342
+ )
343
+ roots.push(canonical)
344
+ }
345
+ return roots
346
+ }
347
+
348
+ /**
349
+ * A relative path from the checker is relative to the API's own cwd, which is the tsconfig's
350
+ * directory rather than the process's.
351
+ */
352
+ private canonical(path: string): string {
353
+ return resolve(dirname(this.tsconfig), path)
354
+ }
355
+
356
+ /**
357
+ * A file the checker reads out of `shadows`, reported to the next snapshot only when it is new,
358
+ * its text moved, or a stand-in answered for it until now.
359
+ */
360
+ private register(
361
+ path: string,
362
+ text: string,
363
+ created: string[],
364
+ changed: string[],
365
+ ): void {
366
+ const key = this.keyOf(path)
367
+ const previous = this.shadows.get(key)
368
+ const stoodIn = this.stoodIn.delete(key)
369
+ if (previous === undefined) created.push(path)
370
+ if (stoodIn || (previous !== undefined && previous.text !== text))
371
+ changed.push(path)
372
+ this.shadows.set(key, { path, text })
373
+ }
374
+
375
+ /**
376
+ * The classified reactive reads in one `.abide` file.
377
+ *
378
+ * THE READS IN `file`: every occurrence of a name bound to a `Reactive` (31.3), classified, in
379
+ * its projection (`projectShadow`). Everything else is left exactly as written. ONE FILE; a
380
+ * build wants `readsFor`.
381
+ */
382
+ async reads(abidePath: string, file: AbideFile): Promise<CheckerAnswer> {
383
+ const answered = await this.readsFor([{ path: abidePath, file }])
384
+ return answered.answers[0] ?? UNCHECKED
385
+ }
386
+
387
+ /**
388
+ * Reads and compiler warnings for every file, in one checker snapshot.
389
+ *
390
+ * EVERY FILE IN ONE SNAPSHOT, which is the whole of the compiler's build time. Measured at
391
+ * 19.7 ms a file taking a snapshot each against 0.8 ms a file sharing one — 25x, because
392
+ * adding a file to the project's root set is what costs, not asking about it. What each file's
393
+ * shadow is asked is `readsIn`'s.
394
+ *
395
+ * WHAT IT HAS TO SAY THAT IS NOT A TYPE ERROR comes back beside the reads: the compiler's own
396
+ * warnings (14.14 to 14.17, 31.13, 32.14), each on the `.abide` line where the source's text
397
+ * was handed in.
398
+ */
399
+ async readsFor(
400
+ sources: readonly (Pick<ParsedSource, 'path' | 'file'> & {
401
+ text?: string
402
+ })[],
403
+ ): Promise<{ answers: CheckerAnswer[]; warnings: Diagnosis[] }> {
404
+ const answered = await this.classify(sources)
405
+ for (let at = 0; at < sources.length; at += 1) {
406
+ const source = sources[at] as (typeof sources)[number]
407
+ if (source.text !== undefined)
408
+ answered.warnings.push(
409
+ ...templateWarnings(
410
+ source.path,
411
+ source.text,
412
+ source.file,
413
+ answered.answers[at] ?? UNCHECKED,
414
+ ),
415
+ )
416
+ }
417
+ answered.warnings.sort(byPlace)
418
+ return answered
419
+ }
420
+
421
+ private async classify(
422
+ sources: readonly (Pick<ParsedSource, 'path' | 'file'> & {
423
+ text?: string
424
+ })[],
425
+ ): Promise<{ answers: CheckerAnswer[]; warnings: Diagnosis[] }> {
426
+ const warnings: Diagnosis[] = []
427
+ // Per source, its shadow and what is asked of it, or `undefined` where nothing is declared.
428
+ const queries: ({ map: ShadowMap; spans: ShadowSpans } | undefined)[] =
429
+ []
430
+ const created: string[] = []
431
+ const changed: string[] = []
432
+
433
+ // EVERY SOURCE PROJECTS BEFORE ANY SHADOW IS REGISTERED. A projection refuses (a top-level
434
+ // `await`), and a shadow registered ahead of the refusal was in `shadows` with the lists
435
+ // that would have reported it dropped — so the retry found nothing moved, and the checker
436
+ // answered from the old shadow at the new one's offsets, or never had the file at all.
437
+ const projected = sources.map((source) => ({
438
+ source,
439
+ projection: projectShadow(source.file),
440
+ }))
441
+ for (const { source, projection } of projected) {
442
+ // 34.2 — A `<script module>` DECLARES NAMES TOO, and the `<script>` under it is inside
443
+ // that scope on both sides. The projection holds both from offset 0.
444
+ const scripts = projection.text.slice(0, projection.scripts.end)
445
+ // A TEMPLATE POSITION IS A QUESTION TOO (14.2): a file that declares nothing but
446
+ // writes `{format(total)}` has a position only the checker can prove static.
447
+ if (!DECLARES.test(scripts) && projection.slots.size === 0) {
448
+ queries.push(undefined)
449
+ continue
450
+ }
451
+ // CANONICAL AT THE KEY, not at the comparison. A doubled separator or a relative
452
+ // path is the same file and a raw string is not the same string — registered as it
453
+ // arrived, the shadow appeared in nobody's directory listing AND named a file the
454
+ // checker could not open, and the refusal below blamed the app's tsconfig for it.
455
+ const map = new ShadowMap(
456
+ this.canonical(source.path),
457
+ projection.origins,
458
+ )
459
+ // A shadow STAYS registered for the life of the session and the snapshot is told it
460
+ // changed. Deleting and re-adding under the same path does not invalidate the
461
+ // source-file cache, and the checker then answers about the PREVIOUS file at these
462
+ // offsets — right-looking types for the wrong names, with nothing to say so.
463
+ // AN UNCHANGED SHADOW IS NOT REPORTED, which is what a kept session saves on a save:
464
+ // the one page that moved is re-read rather than all of them.
465
+ this.register(map.shadowPath, projection.text, created, changed)
466
+ queries.push({
467
+ map,
468
+ spans: {
469
+ scriptsEnd: projection.scripts.end,
470
+ modules: projection.modules,
471
+ scripts: projection.scripts,
472
+ positions: projection.positions,
473
+ },
474
+ })
475
+ }
476
+
477
+ const answers = sources.map(() => UNCHECKED)
478
+ if (queries.every((query) => query === undefined))
479
+ return { answers, warnings }
480
+
481
+ const project = await this.currentProject(created, changed)
482
+ if (project === undefined) return { answers, warnings }
483
+ const checker = project.checker
484
+ const abide = await abideIn(project)
485
+
486
+ await Promise.all(
487
+ queries.map(async (query, at) => {
488
+ if (query === undefined) return
489
+ const source = sources[at] as (typeof sources)[number]
490
+ const sourceFile = await project.program.getSourceFile(
491
+ query.map.shadowPath,
492
+ )
493
+ // The shadow has to be INSIDE the opened project or the checker never reads it.
494
+ // Refusing loudly rather than answering nothing: no reads is a file whose every
495
+ // name lowers as written, which renders `[object Object]` where a value was due —
496
+ // a wrong page, with nothing about it saying so.
497
+ if (sourceFile === undefined)
498
+ throw new Error(
499
+ `abide: ${source.path} is not inside the project ${this.tsconfig}, so no name in it can be typed (31.3). Give the app a tsconfig whose include reaches it.`,
500
+ )
501
+ const read = await readsIn(
502
+ checker,
503
+ abide,
504
+ sourceFile,
505
+ query.map.shadowPath,
506
+ query.spans,
507
+ source.path,
508
+ source.file,
509
+ )
510
+ answers[at] = read.answer
511
+ for (const warning of read.warnings)
512
+ warnings.push(
513
+ diagnosisAt(
514
+ source.path,
515
+ source.text,
516
+ query.map.toSource(
517
+ query.map.shadowPath,
518
+ warning.at,
519
+ ),
520
+ 'warning',
521
+ warning.message,
522
+ ),
523
+ )
524
+ }),
525
+ )
526
+ return { answers, warnings }
527
+ }
528
+
529
+ /**
530
+ * What the build refuses and warns on in the app's `.ts` files and its `.abide` `sources`.
531
+ *
532
+ * 11.37 — `ambient`: every read of a request's ambient inside a `global` value's body, as errors.
533
+ * 11.30 — `unkeyed`: every `args` defaulting a member its body's parameter does not, as warnings.
534
+ * Both over every `.ts` under `within` and each of `sources` as the shadow `readsFor` registered
535
+ * for it, because a keyed value is declared in a `.ts` as often as in a `.abide` — one walk of
536
+ * the files for the two, each finding on its own line of the file an author wrote.
537
+ */
538
+ async lints(
539
+ within: string,
540
+ sources: readonly Omit<ParsedSource, 'quiet'>[],
541
+ ): Promise<{ ambient: Diagnosis[]; unkeyed: Diagnosis[] }> {
542
+ const ambient: Diagnosis[] = []
543
+ const unkeyed: Diagnosis[] = []
544
+ const project = await this.currentProject()
545
+ if (project === undefined) return { ambient, unkeyed }
546
+ const checker = project.checker
547
+ const ambientPaths = new Map<string, string>()
548
+ const declared = await Promise.all(
549
+ AMBIENT_SOURCES.map((source) =>
550
+ project.program.getSourceFile(source),
551
+ ),
552
+ )
553
+ for (let at = 0; at < AMBIENT_SOURCES.length; at += 1) {
554
+ const found = declared[at]?.path
555
+ if (found !== undefined)
556
+ ambientPaths.set(AMBIENT_SOURCES[at] as string, found)
557
+ }
558
+ const authored = new Map<
559
+ string,
560
+ { source: (typeof sources)[number]; map: ShadowMap }
561
+ >()
562
+ for (const source of sources) {
563
+ const map = new ShadowMap(
564
+ this.canonical(source.path),
565
+ projectShadow(source.file).origins,
566
+ )
567
+ authored.set(this.keyOf(map.shadowPath), { source, map })
568
+ }
569
+ // A file of this session's own is one of `sources`' shadows or not walked at all: a
570
+ // checked module is the lowering's, and placed nowhere an author wrote.
571
+ const files: string[] = []
572
+ for (const path of this.rootsUnder(project, within)) {
573
+ const key = this.keyOf(path)
574
+ if (authored.has(key) || !this.shadows.has(key)) files.push(path)
575
+ }
576
+ await Promise.all(
577
+ files.map(async (path) => {
578
+ const sourceFile = await project.program.getSourceFile(path)
579
+ if (sourceFile === undefined) return
580
+ const [reads, defaults] = await Promise.all([
581
+ ambientPaths.size === 0
582
+ ? []
583
+ : ambientReadsIn(checker, sourceFile, ambientPaths),
584
+ argsDefaultsIn(checker, sourceFile),
585
+ ])
586
+ if (reads.length === 0 && defaults.length === 0) return
587
+ const shadow = authored.get(this.keyOf(path))
588
+ const source = shadow?.source
589
+ const text =
590
+ source === undefined
591
+ ? await Bun.file(path).text()
592
+ : source.text
593
+ const place = (at: number): number =>
594
+ shadow === undefined ? at : shadow.map.toSource(path, at)
595
+ for (const read of reads)
596
+ ambient.push(
597
+ diagnosisAt(
598
+ source?.path ?? path,
599
+ text,
600
+ place(read.at),
601
+ 'error',
602
+ `abide: a \`global\` value's body reads \`${read.ambient}\`, which belongs to the request it was built in — every later request would be answered with this one's. Take it out of the body, or drop \`global\`. RULEBOOK 11.37.`,
603
+ ),
604
+ )
605
+ for (const finding of defaults)
606
+ unkeyed.push(
607
+ diagnosisAt(
608
+ source?.path ?? path,
609
+ text,
610
+ place(finding.at),
611
+ 'warning',
612
+ finding.message,
613
+ ),
614
+ )
615
+ }),
616
+ )
617
+ ambient.sort(byPlace)
618
+ unkeyed.sort(byPlace)
619
+ return { ambient, unkeyed }
620
+ }
621
+
622
+ /**
623
+ * The checker's diagnostics for each `.abide` source and the app's `.ts` roots.
624
+ *
625
+ * 38.3 — WHAT THE CHECKER SAYS ABOUT EACH FILE AS IT RUNS, placed on the `.abide` line. Each
626
+ * source is checked as its lowered program (`checkedShadow`), which is registered for the life
627
+ * of the session beside its shadow for the reason a shadow is; and every `.ts` root of the
628
+ * project under `within` is checked as it stands, where `scripts` asks for them — an editor
629
+ * asking about one page does not want the whole app. `sources` carry their text, which is what
630
+ * a position is a line of. A `quiet` source is lowered and not reported on: a component an
631
+ * editor's page imports, which is there for the props the page is held to (33.4).
632
+ *
633
+ * `refused` is the path of every source whose checked lowering refused, which `diagnoses` has
634
+ * reported at its line — `abide check` emits the rest of the app without them.
635
+ */
636
+ async diagnose(
637
+ sources: (Omit<ReadSource, 'quiet'> & { quiet?: boolean })[],
638
+ within: string,
639
+ scripts = true,
640
+ ): Promise<{ diagnoses: Diagnosis[]; refused: Set<string> }> {
641
+ const created: string[] = []
642
+ const changed: string[] = []
643
+ const checked: {
644
+ source: (typeof sources)[number]
645
+ map: ShadowMap
646
+ refusals: readonly Finding[]
647
+ }[] = []
648
+ for (const source of sources) {
649
+ const shadow = checkedShadow(source.file, source.answer)
650
+ const map = new ShadowMap(
651
+ this.canonical(source.path),
652
+ projectShadow(source.file).origins,
653
+ shadow.origins,
654
+ )
655
+ this.register(map.checkedPath, shadow.text, created, changed)
656
+ checked.push({ source, map, refusals: shadow.refusals })
657
+ }
658
+ // 34.6 — WHAT THE BUNDLER RESOLVES AND THE CHECKER CANNOT: a stylesheet imported for its
659
+ // effect. Declared in a file of its own at the app's root, which is a script, because a
660
+ // pattern module can only be declared outside a module.
661
+ this.register(
662
+ `${this.canonical(within)}/${AMBIENT}`,
663
+ AMBIENT_DECLARATIONS,
664
+ created,
665
+ changed,
666
+ )
667
+ // 30.26 — THE APP'S ROUTE TABLE, which `url`'s literal is held to: every page under the
668
+ // root, declared into abide's own `Routes`. A module rather than a script, since only a
669
+ // module augments one.
670
+ this.register(
671
+ `${this.canonical(within)}/${ROUTES_DECLARATION}`,
672
+ routesDeclaration(within),
673
+ created,
674
+ changed,
675
+ )
676
+ const refusing = new Set<string>()
677
+ for (const { source, refusals } of checked)
678
+ if (refusals.length > 0) refusing.add(source.path)
679
+ const project = await this.currentProject(created, changed)
680
+ if (project === undefined) return { diagnoses: [], refused: refusing }
681
+ const program = project.program
682
+ // `path` is the file the author wrote, which for a checked module is not the file asked.
683
+ const report = async (
684
+ asked: string,
685
+ path: string,
686
+ place: (position: number) => { line: number; column: number },
687
+ ): Promise<Diagnosis[]> => {
688
+ const [syntactic, semantic] = await Promise.all([
689
+ program.getSyntacticDiagnostics(asked),
690
+ program.getSemanticDiagnostics(asked),
691
+ ])
692
+ const said: Diagnosis[] = []
693
+ for (const diagnostic of [...syntactic, ...semantic])
694
+ said.push({
695
+ path,
696
+ ...place(diagnostic.pos),
697
+ code: diagnostic.code,
698
+ category: CATEGORIES[diagnostic.category] ?? 'error',
699
+ // A checked module's own names are the lowering's, and read as the author's.
700
+ message: flatten(diagnostic).replaceAll(
701
+ `${CHECKED_VALUES}.`,
702
+ '',
703
+ ),
704
+ })
705
+ return said
706
+ }
707
+ const reports: Promise<Diagnosis[]>[] = []
708
+ const refused: Diagnosis[] = []
709
+ for (const { source, map, refusals } of checked) {
710
+ this.loweredForInspect.set(this.keyOf(map.abidePath), {
711
+ text: source.text,
712
+ map,
713
+ })
714
+ if (source.quiet) continue
715
+ // A refusal is at a projection offset (`Lowering.refusals`).
716
+ for (const refusal of refusals)
717
+ refused.push(
718
+ diagnosisAt(
719
+ source.path,
720
+ source.text,
721
+ map.toSource(map.shadowPath, refusal.at),
722
+ 'error',
723
+ refusal.message,
724
+ ),
725
+ )
726
+ reports.push(
727
+ report(map.checkedPath, source.path, (position) =>
728
+ lineOf(
729
+ source.text,
730
+ map.toSource(map.checkedPath, position),
731
+ ),
732
+ ),
733
+ )
734
+ }
735
+ const standing = scripts ? this.rootsUnder(project, within) : []
736
+ for (const path of standing)
737
+ if (!this.shadows.has(this.keyOf(path)))
738
+ reports.push(
739
+ Bun.file(path)
740
+ .text()
741
+ .then((text) =>
742
+ report(path, path, (position) =>
743
+ lineOf(text, position),
744
+ ),
745
+ ),
746
+ )
747
+ const found = [...refused, ...(await Promise.all(reports)).flat()]
748
+ found.sort(byPlace)
749
+ return { diagnoses: found, refused: refusing }
750
+ }
751
+
752
+ /**
753
+ * The hover signature, documentation and definitions of the name at `offset` in a `.abide`.
754
+ *
755
+ * 38.40 — WHAT THE NAME AT `offset` IN A `.abide` IS, asked of the program `diagnose` last lowered
756
+ * it to: its type and documentation for a hover, and where it is declared for a jump. The
757
+ * checked module is asked where the position was copied into it, which is what a member hangs
758
+ * off — `regions.join` is `Array`'s — and the projection where the lowering rewrote it, so a
759
+ * name read by name is the `Reactive` it was declared as.
760
+ *
761
+ * `text` IS WHAT THE EDITOR SHOWS, and an offset into it maps through a lowering of the same
762
+ * text or not at all: a file the parser refuses keeps its last lowering, whose offsets have
763
+ * moved under every edit since.
764
+ */
765
+ async inspect(
766
+ path: string,
767
+ text: string,
768
+ offset: number,
769
+ ): Promise<Inspection | undefined> {
770
+ const lowered = this.loweredForInspect.get(this.keyOf(path))
771
+ const project = this.latest
772
+ if (
773
+ lowered === undefined ||
774
+ lowered.text !== text ||
775
+ project === undefined
776
+ )
777
+ return undefined
778
+ const asked = lowered.map.fromSource(offset)
779
+ if (asked === undefined || !this.shadows.has(this.keyOf(asked.path)))
780
+ return undefined
781
+ const checker = project.checker
782
+ const found = await checker.getSymbolAtPosition(
783
+ asked.path,
784
+ asked.position,
785
+ )
786
+ if (found === undefined) return undefined
787
+ const symbol = await aliasedSymbol(checker, found)
788
+ const declarations: Node[] = []
789
+ for (const handle of symbol.declarations) {
790
+ const node = await handle.resolve(project)
791
+ if (node !== undefined) declarations.push(node)
792
+ }
793
+ // A `.abide` import resolves to its checked module's stand-in, which is the component.
794
+ const component =
795
+ symbol.name === COMPONENT_STAND_IN &&
796
+ declarations[0]?.getSourceFile().fileName.endsWith(CHECKED_SUFFIX)
797
+ const [signature, documentation] = component
798
+ ? [
799
+ `(component) ${found.name}(props: ${await propsTypeOf(checker, symbol)})`,
800
+ '',
801
+ ]
802
+ : await Promise.all([
803
+ describe(project, symbol, declarations[0]),
804
+ symbol.getDocumentationComment(checker),
805
+ ])
806
+ const definitions: Place[] = []
807
+ for (const node of declarations) {
808
+ const named = (node as { name?: Node }).name ?? node
809
+ const file = node.getSourceFile()
810
+ definitions.push(
811
+ this.placeOf(
812
+ file.fileName,
813
+ file.text,
814
+ named.getStart(file),
815
+ named.end,
816
+ ),
817
+ )
818
+ }
819
+ return {
820
+ signature: signature.replaceAll(`${CHECKED_VALUES}.`, ''),
821
+ documentation,
822
+ definitions,
823
+ }
824
+ }
825
+
826
+ /**
827
+ * A span the checker read, placed in the file the author wrote.
828
+ *
829
+ * A span of a file the checker read, as the file the author wrote: a lowered `.abide` mapped
830
+ * back through both of its maps, and one this session has not lowered — or a span of the
831
+ * scaffolding a lowering adds, which the author never wrote — placed at its top.
832
+ */
833
+ private placeOf(
834
+ fileName: string,
835
+ text: string,
836
+ start: number,
837
+ end: number,
838
+ ): Place {
839
+ const canonical = this.canonical(fileName)
840
+ const abidePath = ShadowMap.fileFor(canonical)
841
+ if (abidePath === undefined)
842
+ return {
843
+ path: fileName,
844
+ start: lineOf(text, start),
845
+ end: lineOf(text, end),
846
+ }
847
+ const lowered = this.loweredForInspect.get(this.keyOf(abidePath))
848
+ const placed = lowered?.map.spanToSource(canonical, start, end)
849
+ if (lowered === undefined || placed === undefined) {
850
+ const top = { line: 1, column: 1 }
851
+ return { path: abidePath, start: top, end: top }
852
+ }
853
+ return {
854
+ path: abidePath,
855
+ start: lineOf(lowered.text, placed.start),
856
+ end: lineOf(lowered.text, placed.end),
857
+ }
858
+ }
859
+
860
+ /**
861
+ * Closes the checker, and ends its process.
862
+ *
863
+ * KILLED, NOT LEFT TO END ITSELF. The API's own close only ends the process's stdin, and a
864
+ * `tsgo` that does not read the end of it lives on with this process's stderr in hand — one
865
+ * outlived its build by eight hours, and anything reading that build's stderr to its end
866
+ * (`abide build 2>&1 | tee`, a test's pipe) waits as long. The API holds the process on a
867
+ * private field and forgets it as it closes, so it is taken first; `typeSession.test.ts` gates
868
+ * that the field is still where this reads it.
869
+ *
870
+ * THE CLIENT IS CLOSED, NOT THE API: the API's close first asks the process to drop each
871
+ * snapshot, and one that has stopped answering never settles it. The client's asks nothing —
872
+ * it ends the connection, which rejects what was in flight — and the snapshots die with the
873
+ * process.
874
+ */
875
+ async close(): Promise<void> {
876
+ const client = (
877
+ this.api as unknown as {
878
+ client: {
879
+ process?: { kill(): boolean }
880
+ close(): Promise<void>
881
+ }
882
+ }
883
+ ).client
884
+ const child = client.process
885
+ await client.close()
886
+ child?.kill()
887
+ }
888
+ }
889
+
890
+ const AMBIENT = 'abide-check.d.ts'
891
+ const ROUTES_DECLARATION = 'abide-routes.d.ts'
892
+ const URL_SOURCE = Bun.fileURLToPath(new URL('../shared/url', import.meta.url))
893
+
894
+ /** 30.26 — every page under `root` as a key of abide's `Routes`, or nothing where it has none. */
895
+ function routesDeclaration(root: string): string {
896
+ const routes = new Set<string>()
897
+ routesUnder(root, '', routes)
898
+ let keys = ''
899
+ for (const route of [...routes].sort())
900
+ keys += ` ${JSON.stringify(route)}: true\n`
901
+ return `export {}\ndeclare module ${JSON.stringify(URL_SOURCE)} {\n interface Routes {\n${keys} }\n}\n`
902
+ }
903
+ /**
904
+ * The routes of the pages under `directory`, added to `routes`.
905
+ *
906
+ * A WALK RATHER THAN A GLOB, because it runs on every check and a glob descends `node_modules` and
907
+ * the build before a filter can drop them — 15.6 ms against 5.7 from this repo's root, same pages.
908
+ */
909
+ function routesUnder(
910
+ directory: string,
911
+ relative: string,
912
+ routes: Set<string>,
913
+ ): void {
914
+ let entries: Dirent[]
915
+ try {
916
+ entries = readdirSync(directory, { withFileTypes: true })
917
+ } catch {
918
+ return
919
+ }
920
+ for (const entry of entries) {
921
+ if (entry.name.startsWith('.') || entry.name === 'node_modules')
922
+ continue
923
+ const path = `${relative}${entry.name}`
924
+ if (entry.isDirectory())
925
+ routesUnder(join(directory, entry.name), `${path}/`, routes)
926
+ else if (fileKind(path) === 'page') routes.add(routeOf(path))
927
+ }
928
+ }
929
+ const AMBIENT_DECLARATIONS = `declare module '*.css' {}
930
+ `
931
+
932
+ /**
933
+ * One thing the checker said, placed in the file the author wrote.
934
+ *
935
+ * 38.3 — line and column from 1.
936
+ */
937
+ export type Diagnosis = {
938
+ path: string
939
+ line: number
940
+ column: number
941
+ code: number
942
+ category: 'error' | 'warning' | 'suggestion' | 'message'
943
+ message: string
944
+ }
945
+
946
+ /**
947
+ * Where something is in a file the author wrote, line and column from 1.
948
+ *
949
+ * 38.40.
950
+ */
951
+ export type Place = {
952
+ path: string
953
+ start: { line: number; column: number }
954
+ end: { line: number; column: number }
955
+ }
956
+
957
+ /**
958
+ * The name under a cursor: how it is declared, what its doc comment says, and where.
959
+ *
960
+ * 38.40.
961
+ */
962
+ export type Inspection = {
963
+ signature: string
964
+ documentation: string
965
+ definitions: Place[]
966
+ }
967
+
968
+ /**
969
+ * The props type a component's tag is held to, printed.
970
+ *
971
+ * 33.4 — the record its stand-in is called with.
972
+ */
973
+ async function propsTypeOf(
974
+ checker: Checker,
975
+ component: CheckedSymbol,
976
+ ): Promise<string> {
977
+ const type = await checker.getTypeOfSymbol(component)
978
+ const call =
979
+ type === undefined
980
+ ? undefined
981
+ : (await checker.getSignaturesOfType(type, SignatureKind.Call))[0]
982
+ const record =
983
+ call === undefined ? undefined : await checker.getParameterType(call, 0)
984
+ return record === undefined
985
+ ? 'any'
986
+ : checker.typeToString(record, undefined, NodeBuilderFlags.NoTruncation)
987
+ }
988
+
989
+ /**
990
+ * How a hover spells a symbol, as tsserver does: the keyword it was declared with, its name, and its
991
+ * type — a function's first signature, with how many more it has.
992
+ */
993
+ async function describe(
994
+ project: Project,
995
+ symbol: CheckedSymbol,
996
+ declaration: Node | undefined,
997
+ ): Promise<string> {
998
+ const checker = project.checker
999
+ const flags = symbol.flags
1000
+ const name = symbol.name
1001
+ if (flags & SymbolFlags.Interface) return `interface ${name}`
1002
+ if (flags & SymbolFlags.Class) return `class ${name}`
1003
+ if (flags & SymbolFlags.TypeAlias)
1004
+ return `type ${name} = ${await checker.typeToString(
1005
+ await checker.getDeclaredTypeOfSymbol(symbol),
1006
+ undefined,
1007
+ NodeBuilderFlags.NoTruncation,
1008
+ )}`
1009
+ const type = await checker.getTypeOfSymbol(symbol)
1010
+ if (type === undefined) return name
1011
+ if (flags & (SymbolFlags.Function | SymbolFlags.Method)) {
1012
+ const signatures = await checker.getSignaturesOfType(
1013
+ type,
1014
+ SignatureKind.Call,
1015
+ )
1016
+ const first = signatures[0]
1017
+ const declared =
1018
+ first === undefined
1019
+ ? undefined
1020
+ : await checker.signatureToSignatureDeclaration(
1021
+ first,
1022
+ SyntaxKind.MethodSignature,
1023
+ undefined,
1024
+ NodeBuilderFlags.NoTruncation,
1025
+ )
1026
+ if (declared !== undefined) {
1027
+ const printed = (await project.emitter.printNode(declared))
1028
+ .trim()
1029
+ .replace(/;$/, '')
1030
+ const more = signatures.length - 1
1031
+ return `${flags & SymbolFlags.Function ? 'function' : '(method)'} ${name}${printed}${
1032
+ more > 0 ? ` (+${more} overload${more === 1 ? '' : 's'})` : ''
1033
+ }`
1034
+ }
1035
+ }
1036
+ const spelled = await checker.typeToString(
1037
+ type,
1038
+ undefined,
1039
+ NodeBuilderFlags.NoTruncation,
1040
+ )
1041
+ let keyword = '(property)'
1042
+ if (flags & SymbolFlags.Function) keyword = 'function'
1043
+ else if (flags & SymbolFlags.Method) keyword = '(method)'
1044
+ else if (declaration?.kind === SyntaxKind.Parameter) keyword = '(parameter)'
1045
+ else if (flags & SymbolFlags.Variable) {
1046
+ const list = declaration?.parent.flags ?? 0
1047
+ keyword =
1048
+ list & NodeFlags.Const
1049
+ ? 'const'
1050
+ : list & NodeFlags.Let
1051
+ ? 'let'
1052
+ : 'var'
1053
+ }
1054
+ return `${keyword} ${name}: ${spelled}`
1055
+ }
1056
+
1057
+ function byPlace(one: Diagnosis, two: Diagnosis): number {
1058
+ return (
1059
+ one.path.localeCompare(two.path) ||
1060
+ one.line - two.line ||
1061
+ one.column - two.column
1062
+ )
1063
+ }
1064
+
1065
+ /** Indexed by the API's `DiagnosticCategory`. */
1066
+ const CATEGORIES = ['warning', 'error', 'suggestion', 'message'] as const
1067
+
1068
+ function flatten(diagnostic: {
1069
+ text: string
1070
+ messageChain?:
1071
+ | readonly { text: string; messageChain?: unknown }[]
1072
+ | undefined
1073
+ }): string {
1074
+ let message = diagnostic.text
1075
+ const chain = diagnostic.messageChain ?? []
1076
+ for (const link of chain)
1077
+ message += `\n ${flatten(link as Parameters<typeof flatten>[0]).replaceAll('\n', '\n ')}`
1078
+ return message
1079
+ }