@abide/abide 0.57.1 → 0.100.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 (1197) hide show
  1. package/CHANGELOG.md +3 -1773
  2. package/bin/abide.ts +788 -204
  3. package/package.json +30 -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 +109 -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 +537 -0
  72. package/src/server/answerSocket.ts +537 -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 +66 -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 +613 -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 +499 -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 +7 -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 +223 -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 +423 -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 +4480 -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 +418 -0
  229. package/src/shared/reactive/watch.ts +310 -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 +496 -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 -967
  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/anchorCursor.ts +0 -25
  976. package/src/lib/ui/dom/anchoredBranch.ts +0 -153
  977. package/src/lib/ui/dom/appendSnippet.ts +0 -75
  978. package/src/lib/ui/dom/appendStatic.ts +0 -26
  979. package/src/lib/ui/dom/appendText.ts +0 -160
  980. package/src/lib/ui/dom/appendTextAt.ts +0 -39
  981. package/src/lib/ui/dom/assertClaimedText.ts +0 -30
  982. package/src/lib/ui/dom/attach.ts +0 -25
  983. package/src/lib/ui/dom/attr.ts +0 -57
  984. package/src/lib/ui/dom/awaitBlock.ts +0 -314
  985. package/src/lib/ui/dom/awaitSubject.ts +0 -118
  986. package/src/lib/ui/dom/bindProp.ts +0 -22
  987. package/src/lib/ui/dom/bindSelectValue.ts +0 -48
  988. package/src/lib/ui/dom/bindableProp.ts +0 -47
  989. package/src/lib/ui/dom/buildDetachedRange.ts +0 -31
  990. package/src/lib/ui/dom/cellPending.ts +0 -24
  991. package/src/lib/ui/dom/claimText.ts +0 -38
  992. package/src/lib/ui/dom/clearBetween.ts +0 -16
  993. package/src/lib/ui/dom/cloneStatic.ts +0 -38
  994. package/src/lib/ui/dom/commentData.ts +0 -14
  995. package/src/lib/ui/dom/depthZeroNodes.ts +0 -34
  996. package/src/lib/ui/dom/discardAndRebuild.ts +0 -23
  997. package/src/lib/ui/dom/discardBoundary.ts +0 -46
  998. package/src/lib/ui/dom/disposeRange.ts +0 -18
  999. package/src/lib/ui/dom/domAnchorAdapter.ts +0 -29
  1000. package/src/lib/ui/dom/domElementAdapter.ts +0 -20
  1001. package/src/lib/ui/dom/each.ts +0 -253
  1002. package/src/lib/ui/dom/eachAsync.ts +0 -188
  1003. package/src/lib/ui/dom/effectiveChildNamespace.ts +0 -13
  1004. package/src/lib/ui/dom/enterNamespace.ts +0 -20
  1005. package/src/lib/ui/dom/fillBefore.ts +0 -42
  1006. package/src/lib/ui/dom/fillBoundary.ts +0 -38
  1007. package/src/lib/ui/dom/fillRange.ts +0 -30
  1008. package/src/lib/ui/dom/foreignWrapperTag.ts +0 -22
  1009. package/src/lib/ui/dom/hydrate.ts +0 -34
  1010. package/src/lib/ui/dom/inheritedNamespace.ts +0 -19
  1011. package/src/lib/ui/dom/isComment.ts +0 -6
  1012. package/src/lib/ui/dom/isElement.ts +0 -6
  1013. package/src/lib/ui/dom/markerDepthDelta.ts +0 -19
  1014. package/src/lib/ui/dom/matchingRangeClose.ts +0 -29
  1015. package/src/lib/ui/dom/mergeProps.ts +0 -32
  1016. package/src/lib/ui/dom/mount.ts +0 -30
  1017. package/src/lib/ui/dom/mountChild.ts +0 -94
  1018. package/src/lib/ui/dom/mountRange.ts +0 -45
  1019. package/src/lib/ui/dom/mountSlot.ts +0 -38
  1020. package/src/lib/ui/dom/mountSwappableRange.ts +0 -122
  1021. package/src/lib/ui/dom/moveRange.ts +0 -19
  1022. package/src/lib/ui/dom/mutateDocContainer.ts +0 -65
  1023. package/src/lib/ui/dom/on.ts +0 -33
  1024. package/src/lib/ui/dom/openMarker.ts +0 -22
  1025. package/src/lib/ui/dom/outlet.ts +0 -63
  1026. package/src/lib/ui/dom/parseRawNodes.ts +0 -17
  1027. package/src/lib/ui/dom/readCall.ts +0 -29
  1028. package/src/lib/ui/dom/readCell.ts +0 -55
  1029. package/src/lib/ui/dom/readTextOrSuspend.ts +0 -21
  1030. package/src/lib/ui/dom/removeRange.ts +0 -18
  1031. package/src/lib/ui/dom/replaceRange.ts +0 -24
  1032. package/src/lib/ui/dom/restProps.ts +0 -32
  1033. package/src/lib/ui/dom/skeleton.ts +0 -153
  1034. package/src/lib/ui/dom/spreadAttrs.ts +0 -95
  1035. package/src/lib/ui/dom/spreadProps.ts +0 -31
  1036. package/src/lib/ui/dom/switchBlock.ts +0 -80
  1037. package/src/lib/ui/dom/templateFor.ts +0 -28
  1038. package/src/lib/ui/dom/tryBlock.ts +0 -263
  1039. package/src/lib/ui/dom/types/EachRow.ts +0 -21
  1040. package/src/lib/ui/dom/types/SkeletonHoles.ts +0 -10
  1041. package/src/lib/ui/dom/types/SwitchCase.ts +0 -11
  1042. package/src/lib/ui/dom/when.ts +0 -58
  1043. package/src/lib/ui/dom/withScope.ts +0 -37
  1044. package/src/lib/ui/dom/withSuspense.ts +0 -22
  1045. package/src/lib/ui/dom/writeCell.ts +0 -22
  1046. package/src/lib/ui/effect.ts +0 -24
  1047. package/src/lib/ui/enterScope.ts +0 -18
  1048. package/src/lib/ui/exitScope.ts +0 -8
  1049. package/src/lib/ui/finalizeStreamedChildren.ts +0 -89
  1050. package/src/lib/ui/flight.ts +0 -56
  1051. package/src/lib/ui/html.ts +0 -39
  1052. package/src/lib/ui/isolateCellBarrier.ts +0 -17
  1053. package/src/lib/ui/linked.ts +0 -125
  1054. package/src/lib/ui/navigate.ts +0 -77
  1055. package/src/lib/ui/probeNavigation.ts +0 -33
  1056. package/src/lib/ui/props.ts +0 -17
  1057. package/src/lib/ui/remoteProxy.ts +0 -256
  1058. package/src/lib/ui/renderChain.ts +0 -113
  1059. package/src/lib/ui/renderToStream.ts +0 -128
  1060. package/src/lib/ui/resumeSeedScript.ts +0 -27
  1061. package/src/lib/ui/router.ts +0 -649
  1062. package/src/lib/ui/runtime/AsyncCellError.ts +0 -21
  1063. package/src/lib/ui/runtime/BRANCH_SEGMENT.ts +0 -24
  1064. package/src/lib/ui/runtime/CELL_SEED.ts +0 -12
  1065. package/src/lib/ui/runtime/CHILD_PRESENT.ts +0 -8
  1066. package/src/lib/ui/runtime/CURRENT_BOUNDARY.ts +0 -11
  1067. package/src/lib/ui/runtime/CURRENT_PATH.ts +0 -29
  1068. package/src/lib/ui/runtime/CURRENT_SCOPE.ts +0 -23
  1069. package/src/lib/ui/runtime/DOC_SEED.ts +0 -10
  1070. package/src/lib/ui/runtime/HOLE_ATTRIBUTE.ts +0 -9
  1071. package/src/lib/ui/runtime/NODE_STATE.ts +0 -22
  1072. package/src/lib/ui/runtime/OUTLET_MARKER.ts +0 -10
  1073. package/src/lib/ui/runtime/OUTLET_TAG.ts +0 -7
  1074. package/src/lib/ui/runtime/OWNER.ts +0 -8
  1075. package/src/lib/ui/runtime/PENDING_OUTLET.ts +0 -8
  1076. package/src/lib/ui/runtime/RANGE_MARKER.ts +0 -16
  1077. package/src/lib/ui/runtime/REACTIVE_CONTEXT.ts +0 -20
  1078. package/src/lib/ui/runtime/RENDER.ts +0 -35
  1079. package/src/lib/ui/runtime/REQUEST_SUPERSEDED.ts +0 -8
  1080. package/src/lib/ui/runtime/RESUME.ts +0 -21
  1081. package/src/lib/ui/runtime/SEED_MARKS.ts +0 -14
  1082. package/src/lib/ui/runtime/STREAMED_CELLS.ts +0 -57
  1083. package/src/lib/ui/runtime/SuspenseSignal.ts +0 -24
  1084. package/src/lib/ui/runtime/abortNode.ts +0 -22
  1085. package/src/lib/ui/runtime/ambientPathBacking.ts +0 -32
  1086. package/src/lib/ui/runtime/ambientScopeBacking.ts +0 -26
  1087. package/src/lib/ui/runtime/applyPatchToTree.ts +0 -54
  1088. package/src/lib/ui/runtime/batch.ts +0 -22
  1089. package/src/lib/ui/runtime/blockId.ts +0 -31
  1090. package/src/lib/ui/runtime/boundaryFor.ts +0 -11
  1091. package/src/lib/ui/runtime/cellBarrierBacking.ts +0 -30
  1092. package/src/lib/ui/runtime/claimChild.ts +0 -8
  1093. package/src/lib/ui/runtime/claimExpected.ts +0 -27
  1094. package/src/lib/ui/runtime/claimMarker.ts +0 -13
  1095. package/src/lib/ui/runtime/claimRun.ts +0 -22
  1096. package/src/lib/ui/runtime/clientPage.ts +0 -116
  1097. package/src/lib/ui/runtime/consumeSeed.ts +0 -38
  1098. package/src/lib/ui/runtime/createAsyncCell.ts +0 -358
  1099. package/src/lib/ui/runtime/createComputedNode.ts +0 -19
  1100. package/src/lib/ui/runtime/createDoc.ts +0 -334
  1101. package/src/lib/ui/runtime/createEffectNode.ts +0 -81
  1102. package/src/lib/ui/runtime/createSignalNode.ts +0 -19
  1103. package/src/lib/ui/runtime/currentAbortSignal.ts +0 -26
  1104. package/src/lib/ui/runtime/detachLink.ts +0 -21
  1105. package/src/lib/ui/runtime/endTracking.ts +0 -24
  1106. package/src/lib/ui/runtime/enterRenderPass.ts +0 -13
  1107. package/src/lib/ui/runtime/escapeKey.ts +0 -19
  1108. package/src/lib/ui/runtime/exitRenderPass.ts +0 -7
  1109. package/src/lib/ui/runtime/flushEffects.ts +0 -91
  1110. package/src/lib/ui/runtime/generationGuard.ts +0 -40
  1111. package/src/lib/ui/runtime/historyEntries.ts +0 -151
  1112. package/src/lib/ui/runtime/inScope.ts +0 -19
  1113. package/src/lib/ui/runtime/isAsyncFunction.ts +0 -14
  1114. package/src/lib/ui/runtime/nextBlockId.ts +0 -12
  1115. package/src/lib/ui/runtime/parkCursor.ts +0 -10
  1116. package/src/lib/ui/runtime/pathSegments.ts +0 -10
  1117. package/src/lib/ui/runtime/reactiveAbortState.ts +0 -15
  1118. package/src/lib/ui/runtime/readNode.ts +0 -38
  1119. package/src/lib/ui/runtime/renderPath.ts +0 -16
  1120. package/src/lib/ui/runtime/reportHydrationDivergence.ts +0 -30
  1121. package/src/lib/ui/runtime/routeBareSeed.ts +0 -28
  1122. package/src/lib/ui/runtime/runHydrationPass.ts +0 -69
  1123. package/src/lib/ui/runtime/runNode.ts +0 -75
  1124. package/src/lib/ui/runtime/runtimePath.ts +0 -9
  1125. package/src/lib/ui/runtime/scope.ts +0 -46
  1126. package/src/lib/ui/runtime/scopeGroup.ts +0 -40
  1127. package/src/lib/ui/runtime/toTeardown.ts +0 -38
  1128. package/src/lib/ui/runtime/track.ts +0 -60
  1129. package/src/lib/ui/runtime/trigger.ts +0 -74
  1130. package/src/lib/ui/runtime/types/AbideHistoryState.ts +0 -9
  1131. package/src/lib/ui/runtime/types/Boundary.ts +0 -9
  1132. package/src/lib/ui/runtime/types/Cell.ts +0 -7
  1133. package/src/lib/ui/runtime/types/Computed.ts +0 -3
  1134. package/src/lib/ui/runtime/types/Doc.ts +0 -24
  1135. package/src/lib/ui/runtime/types/EffectResult.ts +0 -10
  1136. package/src/lib/ui/runtime/types/HydrationCursor.ts +0 -8
  1137. package/src/lib/ui/runtime/types/NavVerdict.ts +0 -9
  1138. package/src/lib/ui/runtime/types/Patch.ts +0 -11
  1139. package/src/lib/ui/runtime/types/PathWalk.ts +0 -10
  1140. package/src/lib/ui/runtime/types/ReactiveLink.ts +0 -21
  1141. package/src/lib/ui/runtime/types/ReactiveNode.ts +0 -33
  1142. package/src/lib/ui/runtime/types/RenderContext.ts +0 -10
  1143. package/src/lib/ui/runtime/types/Route.ts +0 -9
  1144. package/src/lib/ui/runtime/types/RouteLoader.ts +0 -7
  1145. package/src/lib/ui/runtime/types/SsrRender.ts +0 -34
  1146. package/src/lib/ui/runtime/types/State.ts +0 -3
  1147. package/src/lib/ui/runtime/types/Teardown.ts +0 -5
  1148. package/src/lib/ui/runtime/types/UiComponent.ts +0 -24
  1149. package/src/lib/ui/runtime/types/UiProps.ts +0 -12
  1150. package/src/lib/ui/runtime/unescapeKey.ts +0 -12
  1151. package/src/lib/ui/runtime/unlinkDeps.ts +0 -28
  1152. package/src/lib/ui/runtime/untrack.ts +0 -20
  1153. package/src/lib/ui/runtime/updateIfNecessary.ts +0 -40
  1154. package/src/lib/ui/runtime/walkPath.ts +0 -41
  1155. package/src/lib/ui/runtime/withOptionalPath.ts +0 -8
  1156. package/src/lib/ui/runtime/withPath.ts +0 -16
  1157. package/src/lib/ui/runtime/withPathFrom.ts +0 -20
  1158. package/src/lib/ui/runtime/withoutHydration.ts +0 -22
  1159. package/src/lib/ui/runtime/writeNode.ts +0 -16
  1160. package/src/lib/ui/scope.ts +0 -20
  1161. package/src/lib/ui/seedBootState.ts +0 -53
  1162. package/src/lib/ui/seedStreamedResolution.ts +0 -56
  1163. package/src/lib/ui/settleAsyncCells.ts +0 -51
  1164. package/src/lib/ui/socketChannel.ts +0 -156
  1165. package/src/lib/ui/socketProxy.ts +0 -47
  1166. package/src/lib/ui/startClient.ts +0 -156
  1167. package/src/lib/ui/state.ts +0 -77
  1168. package/src/lib/ui/subscribeCacheStaleness.ts +0 -85
  1169. package/src/lib/ui/trackedComputed.ts +0 -68
  1170. package/src/lib/ui/tryEncodeResume.ts +0 -11
  1171. package/src/lib/ui/types/Layouts.ts +0 -9
  1172. package/src/lib/ui/types/Pages.ts +0 -8
  1173. package/src/lib/ui/types/Scope.ts +0 -68
  1174. package/src/lib/ui/watch.ts +0 -150
  1175. package/src/preload.ts +0 -19
  1176. package/src/scaffold.ts +0 -153
  1177. package/src/serverBuildPlugins.ts +0 -25
  1178. package/src/serverEntry.ts +0 -138
  1179. package/src/zodCjsPlugin.ts +0 -51
  1180. package/template/.zed/settings.json +0 -10
  1181. package/template/CLAUDE.md +0 -22
  1182. package/template/bunfig.toml +0 -4
  1183. package/template/package.json +0 -21
  1184. package/template/src/app.ts +0 -28
  1185. package/template/src/bundle/icon.png +0 -0
  1186. package/template/src/cli/banner.txt +0 -3
  1187. package/template/src/cli/footer.txt +0 -1
  1188. package/template/src/server/config.ts +0 -17
  1189. package/template/src/server/rpc/getHello.ts +0 -38
  1190. package/template/src/ui/app.css +0 -21
  1191. package/template/src/ui/app.html +0 -24
  1192. package/template/src/ui/pages/about/page.abide +0 -7
  1193. package/template/src/ui/pages/layout.abide +0 -19
  1194. package/template/src/ui/pages/page.abide +0 -19
  1195. package/template/test/app.test.ts +0 -30
  1196. package/template/tsconfig.json +0 -18
  1197. package/tsconfig.app.json +0 -17
@@ -0,0 +1,1341 @@
1
+ import { SyntaxKind } from 'typescript/unstable/ast'
2
+ import { URL_ATTRIBUTES } from '#shared/URL_ATTRIBUTES.ts'
3
+ import { isComponentTag, isSlot, propKeyOf } from './classifyTemplate.ts'
4
+ import { decodeCharacterReferences } from './decodeCharacterReferences.ts'
5
+ import { isNamedAlone } from './isNamedAlone.ts'
6
+ import { importedNames } from './splitImports.ts'
7
+ import {
8
+ type Attribute,
9
+ type Branch,
10
+ bodiesOf,
11
+ type ForBlock,
12
+ type InlineComponent,
13
+ type Setup,
14
+ type TemplateNode,
15
+ } from './TemplateNode.ts'
16
+ import {
17
+ isSpace,
18
+ nesting,
19
+ skipQuoted,
20
+ slotEnd,
21
+ type Token,
22
+ tokenize,
23
+ } from './tokenize.ts'
24
+ import { VOID_ELEMENTS } from './VOID_ELEMENTS.ts'
25
+
26
+ // A `.abide` file is a script, a style and a template, and this splits it into the three
27
+ // and parses the third. The expression grammar is NOT parsed here: `{expr}` is captured as
28
+ // source text and handed to the emitter verbatim, which is what keeps 19.11 a property of
29
+ // the file rather than a promise this parser has to keep.
30
+
31
+ /** A `.abide` file split into its script, module, style and head blocks and its parsed template. */
32
+ export type AbideFile = {
33
+ /** `<script>` bodies in source order — per-instance setup, 34.1. */
34
+ scripts: string[]
35
+ /**
36
+ * `<script module>` bodies in source order — 34.2, module scope on both sides. Apart from
37
+ * `scripts` because the two run a different number of times, which is the whole of the clause.
38
+ */
39
+ modules: string[]
40
+ /**
41
+ * `<style>` bodies in source order, outside any block body — each scoped to the component (34.4). A
42
+ * body's own is on its block (34.11).
43
+ */
44
+ styles: string[]
45
+ /**
46
+ * 39.1, 39.3 — what every top-level `<head>` contributes to the document head, split off the
47
+ * template here so no walk over the body steps around it. In tree order, which is 39.5.
48
+ */
49
+ head: TemplateNode[]
50
+ template: TemplateNode[]
51
+ /** 32.43 — the inline components the template's own body declares, in source order. */
52
+ components: InlineComponent[]
53
+ /**
54
+ * 34.13 — the type parameters the component's `<script generics="…">` declares, as written, or
55
+ * `undefined` where it declares none.
56
+ */
57
+ generics: string | undefined
58
+ /**
59
+ * Where each piece the projection copies starts in the source.
60
+ *
61
+ * WHERE EACH PIECE THE PROJECTION COPIES STARTS IN THE SOURCE, so a checker's position in the
62
+ * projection is a line of the `.abide` (38.3). A script block by index; a template expression
63
+ * by the holder the projection keys its span by, a `{#for}` key by its block, an element's tag
64
+ * name by the element, and a literal attribute's name by the attribute. A value the
65
+ * parser rewrote — an interpolated attribute becomes a template literal — is placed where its
66
+ * text starts, which is its line if not its column.
67
+ */
68
+ origins: Origins
69
+ }
70
+
71
+ type Origins = {
72
+ modules: number[]
73
+ scripts: number[]
74
+ holders: Map<object, number>
75
+ keys: Map<object, number>
76
+ }
77
+
78
+ /**
79
+ * What an open level is when it is a control block's ARM rather than an element. Not a string, so
80
+ * no close tag — `<//>` and `</>` included — can name one.
81
+ */
82
+ const ARM = null
83
+
84
+ /** The innermost open level that is a control block's arm, or 0 when none is open. */
85
+ function armLevel(open: (string | null)[]): number {
86
+ let level = open.length - 1
87
+ while (level > 0 && open[level] !== ARM) level -= 1
88
+ return level
89
+ }
90
+
91
+ /** Pops `open` and `stack` together down to `level`, closing whatever the arm still holds open. */
92
+ function unwindTo(
93
+ level: number,
94
+ open: (string | null)[],
95
+ stack: TemplateNode[][],
96
+ ): void {
97
+ while (open.length > level) {
98
+ open.pop()
99
+ stack.pop()
100
+ }
101
+ }
102
+
103
+ /**
104
+ * Splits a `.abide` source into its scripts, styles and head, and parses its template.
105
+ *
106
+ * ONE LEXICAL PASS. A `<script>` or `<style>` is only a tag where the walk below reaches it: a scan
107
+ * run ahead of the template has no idea what a position IS, and lifts the string literal out of
108
+ * `{ok ? "<script>boom()</script>" : ''}` into component setup — the author's text moved from a
109
+ * data position into an executable one.
110
+ */
111
+ export function parseAbide(source: string): AbideFile {
112
+ const scripts: string[] = []
113
+ const modules: string[] = []
114
+ const styles: string[] = []
115
+ let generics: string | undefined
116
+ const origins: Origins = {
117
+ modules: [],
118
+ scripts: [],
119
+ holders: new Map(),
120
+ keys: new Map(),
121
+ }
122
+ const root: TemplateNode[] = []
123
+ // The open elements, innermost last. `root` is the floor and is never popped.
124
+ const stack: TemplateNode[][] = [root]
125
+ // WHAT EACH OPEN LEVEL IS, so a close tag only closes the thing it names. Popping whatever is
126
+ // innermost lets `</br>` end the `<p>` around it and a stray `{/if}` end the `<div>` around
127
+ // it — the nodes after it then hang outside the element the author wrote them in, which is a
128
+ // document nobody asked for and nothing about it says so. A `{#if}` arm is `ARM`, which no
129
+ // tag name can be.
130
+ const open: (string | null)[] = [ARM]
131
+ // The open control blocks, so a `{:else}` knows which block it belongs to, and the open
132
+ // `{#component}` blocks, whose body a `<script>` or a `<style>` written in it belongs to.
133
+ const blocks: (TemplateNode | InlineComponent)[] = []
134
+ // 32.43 — each `{#component}` under the list it was written in, which says whose scope it is in
135
+ // once the tree is whole (`fileComponents`).
136
+ const declared = new Map<TemplateNode[], InlineComponent[]>()
137
+ let at = 0
138
+
139
+ while (at < source.length) {
140
+ const children = stack[stack.length - 1] as TemplateNode[]
141
+ const char = source[at]
142
+
143
+ if (char === '<' && source[at + 1] === '/') {
144
+ const close = source.indexOf('>', at)
145
+ if (close === -1) break
146
+ // An unmatched close tag is dropped rather than closing something else. Recovering
147
+ // the way a browser does — closing every open element up to the match — is a second
148
+ // parser, and refusing to guess is what keeps the tree the one the author wrote.
149
+ //
150
+ // MATCHED CASE-INSENSITIVELY, because an HTML tag name is. Compared as written,
151
+ // `<div>x</DIV><footer>f</footer>` dropped the close tag and put the `<footer>` INSIDE
152
+ // the div — while the browser re-parsing that markup closes at `</DIV>`, so every
153
+ // position the client walks to after it is a different node and the page hydrates
154
+ // against the wrong tree.
155
+ const innermost = open[open.length - 1]
156
+ if (
157
+ typeof innermost === 'string' &&
158
+ sameTag(innermost, source.slice(at + 2, close).trim())
159
+ ) {
160
+ stack.pop()
161
+ open.pop()
162
+ }
163
+ at = close + 1
164
+ continue
165
+ }
166
+
167
+ if (char === '<') {
168
+ // A COMMENT AND A DOCTYPE ARE NOT TAGS, and `readTag` refuses both. Stepping over the
169
+ // `<` it refused is what rendered `<!-- todo -->` as the visible text `!-- todo -->`
170
+ // and turned `<!DOCTYPE html>` into one too.
171
+ //
172
+ // A COMMENT IS DROPPED RATHER THAN KEPT. It is a real `childNodes` entry, so keeping
173
+ // one means the client's walk passing it and every emitter writing it, and the region
174
+ // anchors are already the only comments the document carries (41.10). The document
175
+ // loses the author's note and the two sides still agree on every index.
176
+ if (source.startsWith('<!--', at)) {
177
+ const close = source.indexOf('-->', at + 4)
178
+ at = close === -1 ? source.length : close + 3
179
+ continue
180
+ }
181
+ if (source.startsWith('<!', at)) {
182
+ const close = source.indexOf('>', at)
183
+ at = close === -1 ? source.length : close + 1
184
+ continue
185
+ }
186
+
187
+ const tag = readTag(source, at, origins.holders)
188
+ if (tag === undefined) {
189
+ // A `<` THAT OPENS NO TAG IS TEXT. `<p>a < b</p>` lost its `<` to a parser that
190
+ // stepped over what it could not read.
191
+ at = pushText(children, source, at, at + 1)
192
+ continue
193
+ }
194
+
195
+ // 34.1, 34.4 — a `<script>` or a `<style>` is the FILE's, or inside a block the BODY's
196
+ // (14.8, 34.11), never markup, and its body is taken raw. Here rather than in a pass of its own: a scan that runs before the
197
+ // template is parsed cannot tell a tag from the same characters inside a string in an
198
+ // expression, and lifted the second into component setup.
199
+ // LOWERCASED, for the reason the close tag above is: `<SCRIPT>let z = 1</SCRIPT>` was
200
+ // not lifted, so the author's component setup was emitted into the served document as
201
+ // a live inline script.
202
+ const lowerTag = tag.name.toLowerCase()
203
+ // 34.1 AND 34.2 ARE THE TWO FORMS A `<script>` BLOCK TAKES, AND EVERY OTHER `<script>`
204
+ // IS MARKUP. `<script src="/a.js">` and `<script type="application/ld+json">` are
205
+ // neither per-instance setup nor a module block — lifted into the component anyway,
206
+ // their attributes were discarded and a JSON-LD body was emitted as a JavaScript
207
+ // statement, so the module did not parse and the document lost the tag.
208
+ //
209
+ // A `<style>` HAS NO SECOND FORM — no attribute decides where one goes, only whether it
210
+ // stands in a block body (34.11) — so this is one rule about `<script>` rather than an
211
+ // exception carved out of a rule about both.
212
+ const block =
213
+ lowerTag === 'style'
214
+ ? styles
215
+ : lowerTag === 'script'
216
+ ? scriptBlock(tag.attributes, scripts, modules)
217
+ : undefined
218
+ const declared =
219
+ block === undefined || block === styles
220
+ ? undefined
221
+ : genericsOf(source.slice(at, tag.end))
222
+ if (declared !== undefined) {
223
+ // 34.13 — the component's own type parameters, which a module block and a body's
224
+ // setup have no call to be generic over.
225
+ if (block !== scripts || blocks.length > 0)
226
+ throw new Error(
227
+ 'abide: generics="…" belongs on the component\'s own <script>, and this one is a <script module> or a block body\'s. RULEBOOK 34.13.',
228
+ )
229
+ if (generics !== undefined)
230
+ throw new Error(
231
+ 'abide: two <script> blocks declare generics="…". A component declares its type parameters once. RULEBOOK 34.13.',
232
+ )
233
+ generics = declared
234
+ }
235
+ if (lowerTag === 'script' || lowerTag === 'style') {
236
+ const raw = rawBody(source, lowerTag, tag)
237
+ // 14.8 — A `<script>` INSIDE A BLOCK IS THAT BODY'S, set up once each time the body is
238
+ // built, and not the component's: lifted, it ran once for the page and a row's own
239
+ // names (`{#for item …}`) were not in scope.
240
+ // 34.11 — AND A `<style>` INSIDE A BLOCK IS THAT BODY'S, scoped to the elements it
241
+ // holds (`markScoped`) rather than to the whole component.
242
+ // 32.46, 32.47 — AND IN AN INLINE COMPONENT'S OWN BODY, its setup and its own style.
243
+ if (block === styles && blocks.length > 0) {
244
+ const owner = bodyOf(
245
+ blocks[blocks.length - 1] as
246
+ | TemplateNode
247
+ | InlineComponent,
248
+ )
249
+ owner.style =
250
+ owner.style === null
251
+ ? raw.body
252
+ : `${owner.style}\n${raw.body}`
253
+ at = raw.end
254
+ continue
255
+ }
256
+ if (block === scripts && blocks.length > 0) {
257
+ const holder = blocks[blocks.length - 1] as
258
+ | TemplateNode
259
+ | InlineComponent
260
+ const owner = bodyOf(holder)
261
+ if (owner.setup !== null)
262
+ throw new Error(
263
+ holder.kind === 'component'
264
+ ? `abide: {#component ${holder.name}} has two <script> blocks. A component is set up once, by one. RULEBOOK 32.48.`
265
+ : 'abide: this block body has two <script> blocks. A body is set up once, by one. RULEBOOK 14.8.',
266
+ )
267
+ owner.setup = { text: raw.body }
268
+ origins.holders.set(owner.setup, tag.end)
269
+ at = raw.end
270
+ continue
271
+ }
272
+ if (block !== undefined) {
273
+ if (block === scripts) origins.scripts.push(tag.end)
274
+ else if (block === modules) origins.modules.push(tag.end)
275
+ block.push(raw.body)
276
+ at = raw.end
277
+ continue
278
+ }
279
+ // A markup `<script>` keeps its attributes AND its body, and the body is TEXT
280
+ // rather than template: a `{` in JavaScript is a block, and read as a slot it
281
+ // takes the rest of the file with it.
282
+ const kept: TemplateNode = {
283
+ kind: 'element',
284
+ tag: tag.name,
285
+ lowerTag,
286
+ attributes: tag.attributes,
287
+ children:
288
+ raw.body === ''
289
+ ? []
290
+ : [{ kind: 'text', text: raw.body }],
291
+ components: [],
292
+ passed: [],
293
+ }
294
+ children.push(kept)
295
+ at = raw.end
296
+ continue
297
+ }
298
+
299
+ const element: TemplateNode = {
300
+ kind: 'element',
301
+ tag: tag.name,
302
+ lowerTag,
303
+ attributes: tag.attributes,
304
+ children: [],
305
+ components: [],
306
+ passed: [],
307
+ }
308
+ origins.holders.set(element, at + 1)
309
+ children.push(element)
310
+ // The same rule again: `<BR>` read as an ordinary element was pushed onto the open
311
+ // stack and swallowed the rest of the file as its children, and the emitter wrote a
312
+ // `</BR>` no browser accepts.
313
+ if (!tag.selfClosing && !VOID_ELEMENTS.has(lowerTag)) {
314
+ stack.push(element.children)
315
+ open.push(tag.name)
316
+ }
317
+ at = tag.end
318
+ continue
319
+ }
320
+
321
+ if (char === '{') {
322
+ const end = slotEnd(source, at)
323
+ const slot = trimmed(source, at + 1, end)
324
+ const inner = slot.text
325
+
326
+ // 32.41 — `{#component Name(pattern)}` and `{/component}`, wherever a node may stand. It
327
+ // opens an arm as a block does, and is filed under the list it stands in rather than
328
+ // pushed into it: it renders nothing there, so the text either side is one run.
329
+ if (/^#component(?![\w$])/.test(inner)) {
330
+ const component = inlineComponent(
331
+ trimmed(source, slot.at + '#component'.length, end),
332
+ )
333
+ const here = declared.get(children)
334
+ if (here === undefined) declared.set(children, [component])
335
+ else here.push(component)
336
+ blocks.push(component)
337
+ stack.push(component.children)
338
+ open.push(ARM)
339
+ at = end + 1
340
+ continue
341
+ }
342
+ if (inner === '/component') {
343
+ const level = armLevel(open)
344
+ if (
345
+ blocks[blocks.length - 1]?.kind === 'component' &&
346
+ level > 0
347
+ ) {
348
+ blocks.pop()
349
+ unwindTo(level, open, stack)
350
+ }
351
+ at = end + 1
352
+ continue
353
+ }
354
+ // `{#if}`, `{:else}`, `{:else if}`, `{/if}` — a control block opens a new ARM rather
355
+ // than a new element, so it keeps its own stack beside the element one.
356
+ if (inner.startsWith('#if')) {
357
+ const subject = trimmed(source, slot.at + 3, end)
358
+ const branch = newBranch(subject.text)
359
+ origins.holders.set(branch, subject.at)
360
+ const block: TemplateNode = {
361
+ kind: 'block',
362
+ block: 'if',
363
+ branches: [branch],
364
+ }
365
+ children.push(block)
366
+ blocks.push(block)
367
+ stack.push(branch.children)
368
+ open.push(ARM)
369
+ at = end + 1
370
+ continue
371
+ }
372
+ if (inner.startsWith(':else')) {
373
+ const block = blocks[blocks.length - 1]
374
+ if (
375
+ block !== undefined &&
376
+ block.kind === 'block' &&
377
+ block.block === 'if'
378
+ ) {
379
+ // `{:else}` carries no condition, which is what makes it always take.
380
+ const subject = trimmed(
381
+ source,
382
+ slot.at + elseSubjectAt(inner),
383
+ end,
384
+ )
385
+ const branch = newBranch(subject.text)
386
+ if (branch.subject !== '')
387
+ origins.holders.set(branch, subject.at)
388
+ // UNWOUND TO THE ARM'S OWN LEVEL, for the reason `{/if}` below is: an
389
+ // element the author left open in the PREVIOUS arm sits above it, and
390
+ // popping one level left `open` naming that element while `stack` held the
391
+ // new arm — so its close tag popped the arm and every node after it landed
392
+ // in the first arm, which renders on the opposite condition.
393
+ unwindTo(armLevel(open), open, stack)
394
+ block.branches.push(branch)
395
+ stack.push(branch.children)
396
+ open.push(ARM)
397
+ }
398
+ at = end + 1
399
+ continue
400
+ }
401
+ // 32.16 — `{#try}`, `{:catch e}`, `{:finally}`, `{/try}`.
402
+ if (inner === '#try') {
403
+ const body = newBranch('')
404
+ const block: TemplateNode = {
405
+ kind: 'block',
406
+ block: 'try',
407
+ branches: [body],
408
+ error: '',
409
+ }
410
+ children.push(block)
411
+ blocks.push(block)
412
+ stack.push(body.children)
413
+ open.push(ARM)
414
+ at = end + 1
415
+ continue
416
+ }
417
+ if (inner.startsWith(':catch') || inner === ':finally') {
418
+ const block = blocks[blocks.length - 1]
419
+ // 32.56 — ONLY A `{#try}` HAS THESE ARMS. Anywhere else the tag was dropped and what
420
+ // followed it read as the body it stood in: a `{#for}`'s catch rendered in every row.
421
+ if (
422
+ block === undefined ||
423
+ block.kind !== 'block' ||
424
+ block.block !== 'try'
425
+ )
426
+ throw new Error(
427
+ `abide: {${inner}} stands outside a {#try}, and only a {#try} has a catch or a finally arm. RULEBOOK 32.56.`,
428
+ )
429
+ unwindTo(armLevel(open), open, stack)
430
+ // The finally arm is a third branch until `{/try}` folds it into the other two.
431
+ if (inner.startsWith(':catch'))
432
+ block.error = inner.slice(6).trim()
433
+ const branch = newBranch(inner === ':finally' ? FINALLY : '')
434
+ block.branches.push(branch)
435
+ stack.push(branch.children)
436
+ open.push(ARM)
437
+ at = end + 1
438
+ continue
439
+ }
440
+ if (inner === '/try') {
441
+ const level = armLevel(open)
442
+ const block = blocks[blocks.length - 1]
443
+ if (
444
+ block !== undefined &&
445
+ block.kind === 'block' &&
446
+ block.block === 'try' &&
447
+ level > 0
448
+ ) {
449
+ blocks.pop()
450
+ unwindTo(level, open, stack)
451
+ const after = closeTry(block)
452
+ const around = stack[stack.length - 1] as TemplateNode[]
453
+ around.push(...after)
454
+ // The `{:finally}` markup stands in the list around the block now, and so
455
+ // does what it declares.
456
+ const moved = declared.get(after)
457
+ if (moved !== undefined) {
458
+ const here = declared.get(around)
459
+ if (here === undefined) declared.set(around, moved)
460
+ else here.push(...moved)
461
+ }
462
+ }
463
+ at = end + 1
464
+ continue
465
+ }
466
+ if (inner.startsWith('#for')) {
467
+ const block = forBlock(
468
+ source,
469
+ trimmed(source, slot.at + 4, end),
470
+ origins,
471
+ )
472
+ children.push(block)
473
+ blocks.push(block)
474
+ stack.push(block.children)
475
+ open.push(ARM)
476
+ at = end + 1
477
+ continue
478
+ }
479
+ // A `{/if}` with no block open closes NOTHING — left to pop, it ends the element
480
+ // around it and every node after it hangs outside.
481
+ if (inner === '/for' || inner === '/if') {
482
+ // UNWOUND TO THE ARM'S OWN LEVEL, because an element the author left open inside
483
+ // the block sits above it. Requiring the arm to be innermost, `<div>{#if a}<b>x
484
+ // {/if}</div><p>after</p>` closed NOTHING — the `</div>` then matched nothing
485
+ // either, and the `<p>` landed inside the if-arm and vanished whenever the
486
+ // condition was false. Closing whatever the block still holds open is what the
487
+ // close tag of the element AROUND it would have to do anyway.
488
+ const level = armLevel(open)
489
+ if (blocks[blocks.length - 1]?.kind === 'block' && level > 0) {
490
+ blocks.pop()
491
+ unwindTo(level, open, stack)
492
+ }
493
+ at = end + 1
494
+ continue
495
+ }
496
+
497
+ const expression: TemplateNode = {
498
+ kind: 'expression',
499
+ source: inner,
500
+ }
501
+ origins.holders.set(expression, slot.at)
502
+ children.push(expression)
503
+ at = end + 1
504
+ continue
505
+ }
506
+
507
+ at = pushText(children, source, at, at)
508
+ }
509
+
510
+ const components = fileComponents(root, declared)
511
+ refuseImported(components, [...modules, ...scripts])
512
+ collapseWhitespace(root)
513
+ const head: TemplateNode[] = []
514
+ const template: TemplateNode[] = []
515
+ for (const node of root) {
516
+ if (node.kind === 'element' && node.lowerTag === 'head') {
517
+ assertNoNestedHead(node.children, '<head>')
518
+ for (const child of node.children) head.push(child)
519
+ continue
520
+ }
521
+ assertNoNestedHead([node], '')
522
+ template.push(node)
523
+ }
524
+ return {
525
+ scripts,
526
+ modules,
527
+ styles,
528
+ head,
529
+ template,
530
+ components,
531
+ generics,
532
+ origins,
533
+ }
534
+ }
535
+
536
+ /**
537
+ * An inline component's header — `Name(pattern)` or `Name(pattern: Type)` — read into its parts.
538
+ *
539
+ * 32.39 — THE NAME IS TITLECASE, for the reason a tag is (32.17): `<row/>` is the element, so a
540
+ * lowercase inline component could never be invoked. The parentheses hold what a file component's
541
+ * `props` call destructures into, and the annotation is the type argument that call would take.
542
+ */
543
+ function inlineComponent(header: {
544
+ text: string
545
+ at: number
546
+ }): InlineComponent {
547
+ const tokens = tokenize(header.text)
548
+ const name = tokens[0]
549
+ const opener = tokens[1]
550
+ if (
551
+ name === undefined ||
552
+ opener?.kind !== SyntaxKind.OpenParenToken ||
553
+ !isNamedAlone(name.text)
554
+ )
555
+ throw new Error(
556
+ `abide: {#component ${header.text}} names no component. Write {#component Name(props)}. RULEBOOK 32.39.`,
557
+ )
558
+ if (!isComponentTag(name.text))
559
+ throw new Error(
560
+ `abide: {#component ${name.text}} is not TitleCase, and <${name.text}> is an element. Write {#component ${name.text.charAt(0).toUpperCase()}${name.text.slice(1)}(…)}. RULEBOOK 32.39.`,
561
+ )
562
+ let depth = 0
563
+ let close = -1
564
+ let colon: Token | undefined
565
+ for (let index = 1; index < tokens.length; index += 1) {
566
+ const token = tokens[index] as Token
567
+ depth += nesting(token.kind)
568
+ if (depth === 0) {
569
+ close = index
570
+ break
571
+ }
572
+ if (
573
+ depth === 1 &&
574
+ colon === undefined &&
575
+ token.kind === SyntaxKind.ColonToken
576
+ )
577
+ colon = token
578
+ }
579
+ if (close !== tokens.length - 1)
580
+ throw new Error(
581
+ `abide: {#component ${header.text}} is not a name and one parenthesised props pattern. Write {#component ${name.text}(props)}. RULEBOOK 32.39.`,
582
+ )
583
+ const inside = (from: number, to: number): { text: string; at: number } =>
584
+ trimmed(header.text, from, to)
585
+ const closing = (tokens[close] as Token).start
586
+ const pattern = inside(opener.end, colon?.start ?? closing)
587
+ const type =
588
+ colon === undefined
589
+ ? { text: '', at: closing }
590
+ : inside(colon.end, closing)
591
+ return {
592
+ kind: 'component',
593
+ name: name.text,
594
+ at: header.at + name.start,
595
+ pattern: pattern.text,
596
+ patternAt: header.at + pattern.at,
597
+ type: type.text,
598
+ typeAt: header.at + type.at,
599
+ children: [],
600
+ setup: null,
601
+ style: null,
602
+ components: [],
603
+ }
604
+ }
605
+
606
+ /**
607
+ * Files every inline component on the body whose scope it is in; returns the template's own.
608
+ *
609
+ * 32.43 — A BODY IS A SCOPE, AND AN ELEMENT IS NOT ONE: the template, a row, an arm, an inline
610
+ * component's body, and what stands between an invocation's or a `<slot>`'s tags. A component
611
+ * written inside an ordinary element is filed on the body around the element. 32.50 — one written
612
+ * DIRECTLY between an invocation's tags is the invocation's, passed rather than declared.
613
+ *
614
+ * Each body's own are then walked in turn, and its whitespace collapsed: nothing else reaches a
615
+ * component's body, which is not in any list the template's walks descend.
616
+ */
617
+ function fileComponents(
618
+ template: TemplateNode[],
619
+ declared: ReadonlyMap<TemplateNode[], InlineComponent[]>,
620
+ ): InlineComponent[] {
621
+ // The components `nodes` declares, filed on `scope`, down through every ordinary element.
622
+ const collect = (
623
+ nodes: TemplateNode[],
624
+ scope: InlineComponent[],
625
+ own: boolean,
626
+ ): void => {
627
+ if (own) for (const one of declared.get(nodes) ?? []) scope.push(one)
628
+ for (const node of nodes) {
629
+ if (node.kind === 'element') {
630
+ if (isSlot(node)) open(node.children, node.components, true)
631
+ else if (isComponentTag(node.tag)) {
632
+ node.passed = declared.get(node.children) ?? []
633
+ refuseTwice(node.passed, `<${node.tag}>`)
634
+ for (const passed of node.passed)
635
+ for (const attribute of node.attributes)
636
+ if (propKeyOf(attribute) === passed.name)
637
+ throw new Error(
638
+ `abide: <${node.tag}> is given ${passed.name} as an attribute and as the {#component ${passed.name}} between its tags — one prop, two values. RULEBOOK 32.53.`,
639
+ )
640
+ open(node.children, node.components, false)
641
+ for (const passed of node.passed) inside(passed)
642
+ } else collect(node.children, scope, true)
643
+ continue
644
+ }
645
+ for (const body of bodiesOf(node))
646
+ open(body.children, body.components, true)
647
+ }
648
+ }
649
+ // A body: what it declares, each of those walked in turn.
650
+ const open = (
651
+ nodes: TemplateNode[],
652
+ scope: InlineComponent[],
653
+ own: boolean,
654
+ ): void => {
655
+ collect(nodes, scope, own)
656
+ refuseTwice(scope, 'one body')
657
+ for (const one of scope) inside(one)
658
+ }
659
+ const inside = (component: InlineComponent): void => {
660
+ assertNoNestedHead(component.children, `{#component ${component.name}}`)
661
+ open(component.children, component.components, true)
662
+ collapseWhitespace(component.children)
663
+ }
664
+ const file: InlineComponent[] = []
665
+ open(template, file, true)
666
+ return file
667
+ }
668
+
669
+ /** Throws where two inline components in one list share a name (32.49). */
670
+ function refuseTwice(components: InlineComponent[], where: string): void {
671
+ for (let at = 1; at < components.length; at += 1) {
672
+ const name = (components[at] as InlineComponent).name
673
+ for (let before = 0; before < at; before += 1)
674
+ if ((components[before] as InlineComponent).name === name)
675
+ throw new Error(
676
+ `abide: {#component ${name}} is declared twice in ${where} — one name, two components. Rename one. RULEBOOK 32.49.`,
677
+ )
678
+ }
679
+ }
680
+
681
+ /**
682
+ * Throws where an inline component the template's own body declares shares a name with an import.
683
+ *
684
+ * 32.55 — the template's own body is its file's scope. A name the `<script>` DECLARES is the
685
+ * checker's to find (`TypeSession`); an import is found here, without one.
686
+ */
687
+ function refuseImported(components: InlineComponent[], blocks: string[]): void {
688
+ if (components.length === 0) return
689
+ for (const block of blocks)
690
+ for (const imported of importedNames(block))
691
+ for (const component of components)
692
+ if (component.name === imported.name)
693
+ throw new Error(
694
+ `abide: {#component ${imported.name}} is declared inline and ${imported.name} is also imported from '${imported.specifier}' — one name, two components. Rename one. RULEBOOK 32.55.`,
695
+ )
696
+ }
697
+
698
+ /**
699
+ * Throws where a `<head>` stands anywhere but the top level of the file.
700
+ *
701
+ * 39.2 — a `<head>` MUST be top level, and MUST NOT appear inside a control block. Nested, it
702
+ * would render inside the body, which is the silent wrong answer this refuses instead.
703
+ *
704
+ * BOTH HALVES OF THE CLAUSE. The walk returned on anything that was not an element, so a block
705
+ * was a floor it never went through and `{#if a}<head>…{/if}` emitted `<head>` markup into the
706
+ * body — the exact wrong answer, from the check written to stop it. A `<head>` inside a top-level
707
+ * `<head>` was the other way past it, the hoist pushing its children without asking.
708
+ */
709
+ function assertNoNestedHead(nodes: TemplateNode[], within: string): void {
710
+ for (const node of nodes) {
711
+ if (node.kind === 'element' && node.lowerTag === 'head')
712
+ throw new Error(
713
+ `abide: a <head> must be top level in a .abide file, and this one is inside ${within}. RULEBOOK 39.2.`,
714
+ )
715
+ const label =
716
+ node.kind === 'element'
717
+ ? `<${node.tag}>`
718
+ : node.kind === 'block'
719
+ ? `{#${node.block}}`
720
+ : ''
721
+ for (const body of bodiesOf(node))
722
+ assertNoNestedHead(body.children, label)
723
+ }
724
+ }
725
+
726
+ /** The subject a `{:finally}` branch is parsed under, until `closeTry` folds it away. */
727
+ const FINALLY = '\u0000finally'
728
+
729
+ /**
730
+ * Folds a `{#try}`'s arms into its body and catch, and returns its `{:finally}` markup.
731
+ *
732
+ * 32.16 — THE TWO ARMS A `{#try}` RENDERS ONE OF: the body, and the catch — an empty one where the
733
+ * author wrote none. The `{:finally}` markup stands on both paths, so it stands AFTER the region
734
+ * rather than in either arm, and is handed back for the caller to place there.
735
+ */
736
+ function closeTry(
737
+ block: TemplateNode & { kind: 'block'; block: 'try' },
738
+ ): TemplateNode[] {
739
+ let after: TemplateNode[] = []
740
+ const kept: Branch[] = []
741
+ for (const branch of block.branches)
742
+ if (branch.subject === FINALLY) after = branch.children
743
+ else kept.push(branch)
744
+ if (kept.length === 1) kept.push(newBranch(''))
745
+ block.branches = kept.slice(0, 2)
746
+ return after
747
+ }
748
+
749
+ /** An arm under `subject`, with nothing in it yet. */
750
+ function newBranch(subject: string): Branch {
751
+ return { subject, children: [], setup: null, style: null, components: [] }
752
+ }
753
+
754
+ /**
755
+ * The body a `<script>` or `<style>` written inside `block` belongs to.
756
+ *
757
+ * 14.8 — a row's, or the arm open where it stands. A `{#try}` body refuses one: what a boundary sets up when its body is replaced
758
+ * by the catch (32.16) is not decided, and a guess here would be the decision.
759
+ */
760
+ function bodyOf(block: TemplateNode | InlineComponent): {
761
+ setup: Setup | null
762
+ style: string | null
763
+ } {
764
+ if (block.kind === 'component') return block
765
+ if (block.kind === 'block' && block.block === 'for') return block
766
+ if (block.kind === 'block' && block.block === 'if')
767
+ return block.branches[block.branches.length - 1] as Branch
768
+ throw new Error(
769
+ 'abide: a <script> or a <style> inside a {#try} belongs to no body. Move it into a component the {#try} holds, or into a {#for} or {#if} inside it. RULEBOOK 34.10.',
770
+ )
771
+ }
772
+
773
+ /**
774
+ * Whether two tag names match, ASCII case-insensitively.
775
+ *
776
+ * An HTML tag name is ASCII case-INSENSITIVE, so `</DIV>` closes a `<div>`. A component name is
777
+ * TitleCase (32.17) and an exact match is a case of this one, so there is no second rule here.
778
+ */
779
+ function sameTag(left: string, right: string): boolean {
780
+ return left.toLowerCase() === right.toLowerCase()
781
+ }
782
+
783
+ /**
784
+ * The list a `<script>`'s body belongs in, or `undefined` where it is markup.
785
+ *
786
+ * 34.1 is the bare tag and 34.2 is the bare `module` attribute; anything else on the tag — `src`, `type`, `defer`, `nonce` —
787
+ * is a `<script>` the author wrote for the DOCUMENT, and lifting it into component setup moves it
788
+ * out of the markup and throws its attributes away.
789
+ *
790
+ * 34.12, 34.13 — BUT `lang="ts"` AND `generics="…"` ARE THE COMPONENT'S. Every block is TypeScript,
791
+ * so `lang="ts"` says nothing, and an editor's convention read as markup took the author's whole
792
+ * setup out of the component without a word.
793
+ */
794
+ function scriptBlock(
795
+ attributes: Attribute[],
796
+ scripts: string[],
797
+ modules: string[],
798
+ ): string[] | undefined {
799
+ let module = false
800
+ for (const attribute of attributes) {
801
+ // `<script module>` carries the marker and no value. `module="x"` names something else.
802
+ if (attribute.lowerName === 'module' && attribute.value === '')
803
+ module = true
804
+ else if (attribute.lowerName === 'lang' && attribute.value === 'ts')
805
+ continue
806
+ else if (attribute.lowerName !== 'generics') return undefined
807
+ }
808
+ return module ? modules : scripts
809
+ }
810
+
811
+ /**
812
+ * 34.13 — what a component `<script>`'s `generics` attribute declares, or `undefined`.
813
+ *
814
+ * READ OFF THE TAG'S OWN TEXT rather than its parsed attribute: `T extends { id: string }` holds a
815
+ * brace, and an attribute value with one in it is parsed as an interpolation.
816
+ */
817
+ function genericsOf(tag: string): string | undefined {
818
+ return /\sgenerics\s*=\s*(["'])([\s\S]*?)\1/i.exec(tag)?.[2]
819
+ }
820
+
821
+ /**
822
+ * A RAW-TEXT ELEMENT'S BODY AND WHERE THE TAG ENDS. One answer for all three destinations, so a
823
+ * markup `<script>` and a `<script module>` cannot disagree about where the close tag was.
824
+ */
825
+ function rawBody(
826
+ source: string,
827
+ lowerTag: string,
828
+ tag: { selfClosing: boolean; end: number },
829
+ ): { body: string; end: number } {
830
+ if (tag.selfClosing) return { body: '', end: tag.end }
831
+ // The body ends at the first literal close tag, so a `</script>` inside a string in a script
832
+ // block ends it early — the case is real and is not handled yet.
833
+ const close = closeTagAt(source, lowerTag, tag.end)
834
+ if (close === null)
835
+ return { body: source.slice(tag.end), end: source.length }
836
+ return { body: source.slice(tag.end, close.start), end: close.end }
837
+ }
838
+
839
+ /**
840
+ * Where a raw-text block's close tag begins and ends, or `null` where it has none.
841
+ *
842
+ * Matched the way `sameTag` matches — `indexOf` over the literal spelling missed `</SCRIPT>` and ran the block to the end of the file.
843
+ *
844
+ * WHITESPACE IS LEGAL BEFORE THE `>`, and demanding it at a fixed offset was the same class of
845
+ * miss one layer down: `</script >` and `</style\n>` matched nothing, so the rest of the document
846
+ * became the script body and the template came back EMPTY. The ordinary close-tag path above
847
+ * already `trim()`s for this, which is one question with two answers until now — so the end is
848
+ * handed back rather than recomputed from the tag's length.
849
+ */
850
+ function closeTagAt(
851
+ source: string,
852
+ tag: string,
853
+ from: number,
854
+ ): { start: number; end: number } | null {
855
+ for (let at = from; at < source.length; at += 1) {
856
+ if (source[at] !== '<' || source[at + 1] !== '/') continue
857
+ if (!sameTag(source.slice(at + 2, at + 2 + tag.length), tag)) continue
858
+ let end = at + 2 + tag.length
859
+ while (end < source.length && isSpace(source[end] as string)) end += 1
860
+ if (source[end] !== '>') continue
861
+ return { start: at, end: end + 1 }
862
+ }
863
+ return null
864
+ }
865
+
866
+ /**
867
+ * Appends the text run from `at` to `children` and returns where the run ends.
868
+ *
869
+ * Scanned from `from` — one node, so the `<` that opened no tag is carried by the run that
870
+ * follows it rather than becoming a node of its own.
871
+ */
872
+ function pushText(
873
+ children: TemplateNode[],
874
+ source: string,
875
+ at: number,
876
+ from: number,
877
+ ): number {
878
+ let next = from
879
+ while (next < source.length && source[next] !== '<' && source[next] !== '{')
880
+ next += 1
881
+ const text = source.slice(at, next)
882
+ // A browser MERGES adjacent text on parse, so the tree the client walks has one node here and
883
+ // the markup walk places one position. The only way to produce two is the `<` that opened no tag, and
884
+ // this is where that run rejoins the one before it.
885
+ const last = children[children.length - 1]
886
+ if (last?.kind === 'text') last.text += text
887
+ else children.push({ kind: 'text', text })
888
+ return next
889
+ }
890
+
891
+ /**
892
+ * Where the condition on a `{:else …}` arm starts in `inner`, or its end for the bare `{:else}`
893
+ * that always takes.
894
+ *
895
+ * A DIRECTIVE ENDS AT A WORD BOUNDARY. `startsWith` has none, so `{:elseif b}` was silently read
896
+ * as `{:else if b}` and `{:else ifValid}` as `{:else if}` over the subject `Valid` — a condition
897
+ * the author never wrote, deciding which arm renders.
898
+ */
899
+ function elseSubjectAt(inner: string): number {
900
+ const rest = inner.slice(':else'.length)
901
+ if (rest.trim() === '') return inner.length
902
+ const keyword = /^\s+if(?=[\s(])/.exec(rest)
903
+ if (keyword === null || rest.slice(keyword[0].length).trim() === '')
904
+ throw new Error(
905
+ `abide: {${inner}} is not a control block. Write {:else} or {:else if <condition>}.`,
906
+ )
907
+ return ':else'.length + keyword[0].length
908
+ }
909
+
910
+ /**
911
+ * `source` from `start` to `end`, trimmed, and where what is left starts — the position a
912
+ * checker's answer about it is placed at (38.3).
913
+ */
914
+ function trimmed(
915
+ source: string,
916
+ start: number,
917
+ end: number,
918
+ ): { text: string; at: number } {
919
+ const raw = source.slice(start, end)
920
+ const text = raw.trimStart()
921
+ return { text: text.trimEnd(), at: start + raw.length - text.length }
922
+ }
923
+
924
+ /**
925
+ * Parses a `{#for}` header into its item, index, subject and key.
926
+ *
927
+ * `item, index of list by key` — `index` and `by` are optional, and everything after `of` up to
928
+ * a top-level `by` is the subject. Split on the KEYWORDS rather than on commas, because the
929
+ * subject may hold both.
930
+ *
931
+ * THE SEPARATOR IS THE ONE AT DEPTH ZERO AND OUTSIDE A STRING — all three of them, and each was
932
+ * wrong its own way. `{#for { id, name } of rows}` split on the pattern's own comma and the item
933
+ * became `{ id`, which the emitters write straight into a parameter list. `{#for x of
934
+ * names.filter(n => n !== "run by me")}` split on the ` by ` inside the string literal and the
935
+ * subject ended mid-quote. One scanner for all three rather than one fix for the comma.
936
+ */
937
+ function forBlock(
938
+ file: string,
939
+ header: { text: string; at: number },
940
+ origins: Origins,
941
+ ): ForBlock {
942
+ const source = header.text
943
+ // THE HEADER IS TOKENS, read by the scanner a slot is: an `of`, a `,` or a `by` inside a string,
944
+ // a call or an object pattern is the expression's own, and only one at depth zero divides the
945
+ // header. `by` is a word rather than a keyword, so a member named `by` is not one.
946
+ const tokens = tokenize(source)
947
+ let depth = 0
948
+ let of: Token | undefined
949
+ let comma: Token | undefined
950
+ let by: Token | undefined
951
+ for (let index = 0; index < tokens.length; index += 1) {
952
+ const token = tokens[index] as Token
953
+ const kind = token.kind
954
+ const moved = nesting(kind)
955
+ depth += moved
956
+ if (moved !== 0 || depth !== 0) continue
957
+ else if (of === undefined) {
958
+ if (kind === SyntaxKind.OfKeyword) of = token
959
+ else if (kind === SyntaxKind.CommaToken && comma === undefined)
960
+ comma = token
961
+ } else if (
962
+ by === undefined &&
963
+ kind === SyntaxKind.Identifier &&
964
+ token.text === 'by' &&
965
+ (tokens[index - 1] as Token).kind !== SyntaxKind.DotToken
966
+ )
967
+ by = token
968
+ }
969
+ // A `{#for}` with nothing to iterate rendered as a block over the subject '' — zero rows,
970
+ // forever, with nothing saying why (32.22 is an ABSENT subject, not a missing one).
971
+ if (of === undefined)
972
+ throw new Error(
973
+ `abide: {#for ${source}} has no \` of \`, so there is nothing to iterate. Write {#for item of list}.`,
974
+ )
975
+ const item = source.slice(0, (comma ?? of).start).trim()
976
+ const index =
977
+ comma === undefined ? '' : source.slice(comma.end, of.start).trim()
978
+ // Refused here rather than papered over in each emitter: `{#for , i of rows}` has no binding
979
+ // for the row, and `for (const of …)` is a syntax error in a file nobody wrote.
980
+ if (item === '')
981
+ throw new Error(
982
+ `abide: {#for ${source}} names no item, so a row has nothing to call itself. Write {#for item of list}.`,
983
+ )
984
+ const end = header.at + source.length
985
+ const subject = trimmed(
986
+ file,
987
+ header.at + of.end,
988
+ by === undefined ? end : header.at + by.start,
989
+ )
990
+ const key =
991
+ by === undefined
992
+ ? { text: '', at: end }
993
+ : trimmed(file, header.at + by.end, end)
994
+ const block: ForBlock = {
995
+ kind: 'block',
996
+ block: 'for',
997
+ item,
998
+ index,
999
+ subject: subject.text,
1000
+ key: key.text,
1001
+ children: [],
1002
+ setup: null,
1003
+ style: null,
1004
+ components: [],
1005
+ }
1006
+ origins.holders.set(block, subject.at)
1007
+ if (key.text !== '') origins.keys.set(block, key.at)
1008
+ return block
1009
+ }
1010
+
1011
+ function readTag(
1012
+ source: string,
1013
+ open: number,
1014
+ origins: Map<object, number>,
1015
+ ):
1016
+ | {
1017
+ name: string
1018
+ attributes: Attribute[]
1019
+ selfClosing: boolean
1020
+ end: number
1021
+ }
1022
+ | undefined {
1023
+ let at = open + 1
1024
+ const nameStart = at
1025
+ // A TAG NAME OPENS WITH AN ASCII LETTER, which is HTML's own production and not a case here.
1026
+ // Read as `[\w:-]`, `<p>a <3 b</p>` opened an element named `3` carrying the attribute `b<`,
1027
+ // swallowed the `</p>` and hung every node after it inside a phantom the browser never
1028
+ // creates — so the markup walk placed a node the document does not have and every position
1029
+ // after it in that parent lands one node off. That is the one failure marker-free addressing
1030
+ // cannot survive: it binds to whatever is there, silently.
1031
+ if (!/[A-Za-z]/.test(source[at] ?? '')) return undefined
1032
+ while (at < source.length && /[\w:-]/.test(source[at] as string)) at += 1
1033
+ if (at === nameStart) return undefined
1034
+ const name = source.slice(nameStart, at)
1035
+ const attributes: Attribute[] = []
1036
+
1037
+ // Every attribute read from `from` on is placed: an expression at `position` — where its value
1038
+ // starts, or, where the parser rewrote the value, where the text it was rewritten from does — and
1039
+ // a literal at its name, `named`, which is where a finding about it is read.
1040
+ const place = (from: number, position: number, named: number): void => {
1041
+ for (let index = from; index < attributes.length; index += 1) {
1042
+ const placed = attributes[index] as Attribute
1043
+ origins.set(placed, placed.expression ? position : named)
1044
+ }
1045
+ }
1046
+ while (at < source.length) {
1047
+ while (at < source.length && isSpace(source[at] as string)) at += 1
1048
+ if (source[at] === '>')
1049
+ return { name, attributes, selfClosing: false, end: at + 1 }
1050
+ if (source[at] === '/' && source[at + 1] === '>')
1051
+ return { name, attributes, selfClosing: true, end: at + 2 }
1052
+
1053
+ // 32.11 — `{...expr}` IN ATTRIBUTE POSITION IS A SPREAD, not an attribute named by its own
1054
+ // braces. Carried as `...` holding the expression, so the shadow projects it and the
1055
+ // lowering reads it exactly as it reads any other attribute's.
1056
+ if (source[at] === '{') {
1057
+ const close = slotEnd(source, at)
1058
+ const inner = trimmed(source, at + 1, close)
1059
+ if (inner.text.startsWith('...')) {
1060
+ const spread = trimmed(source, inner.at + 3, close)
1061
+ attributes.push(attribute('...', spread.text, true))
1062
+ place(attributes.length - 1, spread.at, at)
1063
+ at = close + 1
1064
+ continue
1065
+ }
1066
+ }
1067
+
1068
+ const attributeStart = at
1069
+ while (
1070
+ at < source.length &&
1071
+ !isSpace(source[at] as string) &&
1072
+ source[at] !== '=' &&
1073
+ source[at] !== '/' &&
1074
+ source[at] !== '>'
1075
+ )
1076
+ at += 1
1077
+ if (at === attributeStart)
1078
+ return { name, attributes, selfClosing: false, end: at + 1 }
1079
+ const attributeName = source.slice(attributeStart, at)
1080
+
1081
+ if (source[at] !== '=') {
1082
+ // 33.21 — A BARE PROP IS `true`. Handed over as the expression rather than given a
1083
+ // shape of its own, so the build and the checker read `<Name enable>` as they read
1084
+ // `enable={true}`. A bare `bind:` names no `Reactive` and stays the literal it was.
1085
+ const flag =
1086
+ isComponentTag(name) &&
1087
+ !attributeName.toLowerCase().startsWith('bind:')
1088
+ attributes.push(attribute(attributeName, flag ? 'true' : '', flag))
1089
+ place(attributes.length - 1, attributeStart, attributeStart)
1090
+ continue
1091
+ }
1092
+ at += 1
1093
+
1094
+ // `attr={expr}` — the braces are found the same way a slot's are, so `onclick={f('}')}`
1095
+ // ends where it reads as ending.
1096
+ if (source[at] === '{') {
1097
+ const close = slotEnd(source, at)
1098
+ const value = trimmed(source, at + 1, close)
1099
+ attributes.push(attribute(attributeName, value.text, true))
1100
+ place(attributes.length - 1, value.at, attributeStart)
1101
+ at = close + 1
1102
+ continue
1103
+ }
1104
+
1105
+ const quote = source[at]
1106
+ if (quote === '"' || quote === "'") {
1107
+ const close = source.indexOf(quote, at + 1)
1108
+ // AN UNCLOSED QUOTE ATE THE FILE. The tag was handed back ending at `source.length`,
1109
+ // so `<div class="card>` followed by a page yielded `<div>` with no children and the
1110
+ // whole remainder was dropped — the one failure a reader cannot see in the output,
1111
+ // because the output is a document that parses.
1112
+ if (close === -1)
1113
+ throw new Error(
1114
+ `abide: the ${quote} opening ${attributeName} on <${name}> is never closed, so the rest of the file reads as part of that attribute.`,
1115
+ )
1116
+ const from = attributes.length
1117
+ pushQuoted(
1118
+ attributes,
1119
+ attributeName,
1120
+ source.slice(at + 1, close),
1121
+ name,
1122
+ )
1123
+ place(from, at + 1, attributeStart)
1124
+ at = close + 1
1125
+ continue
1126
+ }
1127
+ const valueStart = at
1128
+ while (
1129
+ at < source.length &&
1130
+ !isSpace(source[at] as string) &&
1131
+ source[at] !== '>'
1132
+ )
1133
+ at += 1
1134
+ // 32.3 HOLDS WHETHER OR NOT THE VALUE IS QUOTED. Pushed straight as a literal, a slot in
1135
+ // an unquoted value — `<a href=/x/{id}>` — was served as the author's own braces, never
1136
+ // lowered and never past the `safeUrl` 32.20 asks a URL attribute for.
1137
+ const from = attributes.length
1138
+ pushQuoted(
1139
+ attributes,
1140
+ attributeName,
1141
+ source.slice(valueStart, at),
1142
+ name,
1143
+ )
1144
+ place(from, valueStart, attributeStart)
1145
+ }
1146
+ return { name, attributes, selfClosing: false, end: at }
1147
+ }
1148
+
1149
+ /**
1150
+ * Pushes a quoted attribute: a literal, a template-literal expression, or one `style:prop` per
1151
+ * declaration.
1152
+ *
1153
+ * 32.3 — A QUOTED VALUE WITH A SLOT IN IT IS AN EXPRESSION. Captured as a literal,
1154
+ * `class="badge {tone}"` wrote the braces into the document verbatim, so the page carried the
1155
+ * author's source where a class was due.
1156
+ *
1157
+ * REWRITTEN AS A TEMPLATE LITERAL rather than given a parts array of its own, because that is one
1158
+ * expression and the whole `class={expr}` path already takes one: lowered by `Lowering`,
1159
+ * escaped by `escapeAttribute`, and scheme-checked by `safeUrl` where 32.20 asks for it. A second
1160
+ * shape here would be a second copy of all three.
1161
+ *
1162
+ * 32.27 — ITS STATIC TEXT IS DECODED HERE, so what is left is data whole and takes that one path on
1163
+ * both sides: `title="AT&amp;T {n}"` is the literal `AT&T ${n}`, escaped as one value by the server
1164
+ * and set as it stands by the browser. Each static piece is decoded ON ITS OWN, so a slot's text can
1165
+ * never finish a reference the author's began: `&amp{x}` is `&` and then the slot. 32.28 keeps a URL
1166
+ * attribute's static text as written, escaped with its slots the way `{expr}` is.
1167
+ *
1168
+ * 33.19 — A COMPONENT'S PROP IS DECODED WHEN IT IS STATIC TOO, because it is never markup: an element's
1169
+ * static value is served as the author's bytes (`classifyAttributes`), and a prop is handed over
1170
+ * as a string, so `<Card title="AT&amp;T">` hands the child `AT&T`.
1171
+ *
1172
+ * 32.19 — AN INTERPOLATED `style` TAKES THE OTHER ROAD and lowers to one `style:prop` per
1173
+ * declaration, which is why the split happens here, where the interpolated form is still told
1174
+ * apart from the whole `style={expr}` one.
1175
+ */
1176
+ function pushQuoted(
1177
+ attributes: Attribute[],
1178
+ attributeName: string,
1179
+ raw: string,
1180
+ tag: string,
1181
+ ): void {
1182
+ const prop = isComponentTag(tag)
1183
+ const expression = interpolated(
1184
+ raw,
1185
+ prop || !URL_ATTRIBUTES.has(attributeName.toLowerCase()),
1186
+ )
1187
+ if (expression === undefined) {
1188
+ attributes.push(
1189
+ attribute(
1190
+ attributeName,
1191
+ prop ? decodeCharacterReferences(raw, 'attribute') : raw,
1192
+ false,
1193
+ ),
1194
+ )
1195
+ return
1196
+ }
1197
+ if (attributeName.toLowerCase() !== 'style') {
1198
+ attributes.push(attribute(attributeName, expression, true))
1199
+ return
1200
+ }
1201
+ for (const declaration of splitTopLevel(raw, ';')) {
1202
+ if (declaration.trim() === '') continue
1203
+ const colon = colonAt(declaration)
1204
+ // A PROPERTY NAME IS STATIC. `style="{name}: red"` has no property to bind, and built as a
1205
+ // string it would let a value decide which property it sets.
1206
+ if (colon === -1 || declaration.slice(0, colon).includes('{'))
1207
+ throw new Error(
1208
+ `abide: an interpolated style on <${tag}> sets one property per declaration under a static name, and \`${declaration.trim()}\` has none. Write style:prop={value}. RULEBOOK 32.19.`,
1209
+ )
1210
+ const property = declaration.slice(0, colon).trim()
1211
+ if (property === '')
1212
+ throw new Error(
1213
+ `abide: an interpolated style on <${tag}> has a declaration with no property name. Write style:prop={value}. RULEBOOK 32.19.`,
1214
+ )
1215
+ const value = declaration.slice(colon + 1).trim()
1216
+ const slotted = interpolated(value, false)
1217
+ attributes.push(
1218
+ attribute(
1219
+ `style:${property}`,
1220
+ slotted ?? value,
1221
+ slotted !== undefined,
1222
+ ),
1223
+ )
1224
+ }
1225
+ }
1226
+
1227
+ function attribute(
1228
+ name: string,
1229
+ value: string,
1230
+ expression: boolean,
1231
+ ): Attribute {
1232
+ return { name, lowerName: name.toLowerCase(), value, expression }
1233
+ }
1234
+
1235
+ /**
1236
+ * The value as a template-literal expression, or `undefined` where it holds no slot at all. An
1237
+ * UNCLOSED `{` is text: `slotEnd` runs to the end of the value and the brace was never a
1238
+ * slot, so the attribute stays exactly what the author wrote.
1239
+ */
1240
+ function interpolated(raw: string, decode: boolean): string | undefined {
1241
+ let out = ''
1242
+ let at = 0
1243
+ let found = false
1244
+ while (at < raw.length) {
1245
+ const brace = raw.indexOf('{', at)
1246
+ if (brace === -1) break
1247
+ const close = slotEnd(raw, brace)
1248
+ if (close >= raw.length) break
1249
+ out += `${staticText(raw.slice(at, brace), decode)}\${${raw.slice(brace + 1, close).trim()}}`
1250
+ at = close + 1
1251
+ found = true
1252
+ }
1253
+ if (!found) return undefined
1254
+ return `\`${out}${staticText(raw.slice(at), decode)}\``
1255
+ }
1256
+
1257
+ function staticText(text: string, decode: boolean): string {
1258
+ return templateText(
1259
+ decode ? decodeCharacterReferences(text, 'attribute') : text,
1260
+ )
1261
+ }
1262
+
1263
+ /**
1264
+ * The static text of a template literal. A `\`, a backtick and a `${` are the three sequences the
1265
+ * grammar reads, and an attribute value carries all three as ordinary characters.
1266
+ */
1267
+ function templateText(text: string): string {
1268
+ return text
1269
+ .replaceAll('\\', '\\\\')
1270
+ .replaceAll('`', '\\`')
1271
+ .replaceAll('${', '\\${')
1272
+ }
1273
+
1274
+ /**
1275
+ * The pieces of `source` between each `separator` that stands OUTSIDE a slot — a `;` inside
1276
+ * `{a ? 'x;y' : 'z'}` is the expression's own.
1277
+ */
1278
+ function splitTopLevel(source: string, separator: string): string[] {
1279
+ const pieces: string[] = []
1280
+ let from = 0
1281
+ for (
1282
+ let at = topLevelAt(source, separator, 0);
1283
+ at !== -1;
1284
+ at = topLevelAt(source, separator, from)
1285
+ ) {
1286
+ pieces.push(source.slice(from, at))
1287
+ from = at + 1
1288
+ }
1289
+ pieces.push(source.slice(from))
1290
+ return pieces
1291
+ }
1292
+
1293
+ /** The `:` that separates a declaration's property from its value, outside any slot. */
1294
+ function colonAt(declaration: string): number {
1295
+ return topLevelAt(declaration, ':', 0)
1296
+ }
1297
+
1298
+ /**
1299
+ * The first `target` at or after `from` that stands outside a slot and outside a quoted CSS
1300
+ * string, or -1.
1301
+ */
1302
+ function topLevelAt(source: string, target: string, from: number): number {
1303
+ let at = from
1304
+ while (at < source.length) {
1305
+ const char = source[at]
1306
+ if (char === '{') {
1307
+ const close = slotEnd(source, at)
1308
+ at = close >= source.length ? source.length : close + 1
1309
+ continue
1310
+ }
1311
+ // A QUOTED VALUE IS NOT A LIST OF DECLARATIONS. The `;` inside
1312
+ // `url('data:image/svg+xml;utf8,<svg/>')` split one style declaration into two and 32.19's
1313
+ // refusal named a fragment the author never wrote — a build failure on valid CSS.
1314
+ if (char === '"' || char === "'") {
1315
+ at = skipQuoted(source, at)
1316
+ continue
1317
+ }
1318
+ if (char === target) return at
1319
+ at += 1
1320
+ }
1321
+ return -1
1322
+ }
1323
+
1324
+ /**
1325
+ * Drops the whitespace-only text runs that are the author's layout rather than content.
1326
+ *
1327
+ * 33.17 and 33.18. A whitespace run with a newline and no space or tab is dropped wherever it
1328
+ * stands; one that also carries indentation is dropped only at the ends of a body, where it is
1329
+ * the author's layout rather than a space the document asked for.
1330
+ */
1331
+ function collapseWhitespace(children: TemplateNode[]): void {
1332
+ for (let i = children.length - 1; i >= 0; i -= 1) {
1333
+ const node = children[i] as TemplateNode
1334
+ for (const body of bodiesOf(node)) collapseWhitespace(body.children)
1335
+ if (node.kind !== 'text' || node.text.trim() !== '') continue
1336
+ if (!node.text.includes('\n')) continue
1337
+ const indented = /[ \t]/.test(node.text)
1338
+ if (!indented || i === 0 || i === children.length - 1)
1339
+ children.splice(i, 1)
1340
+ }
1341
+ }