From 303fc5c319a502976b699a380b057d11fcc97912 Mon Sep 17 00:00:00 2001 From: giles Date: Sat, 28 Mar 2026 18:14:09 +0000 Subject: [PATCH] sx-http: fix inside component-defs strings while keeping the SX valid for the client parser. Component-defs back to inline *) + Buffer.add_string buf "<\\\\/" + | c -> Buffer.add_char buf c + done; Buffer.contents buf (** Serialize a value to SX text (for io-request args). *) @@ -1619,14 +1625,10 @@ let http_inject_shell_statics env static_dir sx_sxc = | _ -> () ) env.bindings; let raw_defs = Buffer.contents buf in - (* Don't inline component-defs — serve from /static/sx-components.sx. - Inlining breaks because SX source can contain literal which - the HTML parser uses to close the tag prematurely. *) - let component_defs = "" in - (* Cache the raw defs for the /static/sx-components.sx endpoint *) - Hashtbl.replace static_cache "/static/sx-components.sx" - (Printf.sprintf "HTTP/1.1 200 OK\r\nContent-Type: text/sx; charset=utf-8\r\nContent-Length: %d\r\nCache-Control: public, max-age=31536000, immutable\r\n\r\n%s" - (String.length raw_defs) raw_defs); + (* Component-defs are inlined in . *) + let component_defs = raw_defs in let component_hash = Digest.string component_defs |> Digest.to_hex in (* Compute file hashes for cache busting *) let sx_js_hash = file_hash (static_dir ^ "/scripts/sx-browser.js") in