this repo has no description

Auto-deploy x-ocaml.js via odoc support files

Install x_ocaml.bc.js into the opam share directory and register it as
an odoc support file so that `odoc support-files -o DIR` copies
_x-ocaml/x-ocaml.js automatically, removing the need for manual
deployment in deploy.sh.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

+20 -2
+1 -1
src/dune
··· 1 1 (library 2 2 (name interactive_extension) 3 3 (public_name odoc-interactive-extension.impl) 4 - (libraries odoc.extension_api)) 4 + (libraries odoc.extension_api unix)) 5 5 6 6 (plugin 7 7 (name odoc-interactive-extension)
+19 -1
src/interactive_extension.ml
··· 182 182 Api.Registry.register (module X_ocaml_config); 183 183 Api.Registry.register_code_block (module X_ocaml_code); 184 184 Api.Registry.register_extension_info config_info; 185 - Api.Registry.register_extension_info code_info 185 + Api.Registry.register_extension_info code_info; 186 + (* Find x-ocaml.js from the x-ocaml opam package's share directory *) 187 + let share_dir = 188 + try 189 + let ic = Unix.open_process_in "opam var x-ocaml:share 2>/dev/null" in 190 + let line = input_line ic in 191 + let _ = Unix.close_process_in ic in 192 + Some (String.trim line) 193 + with _ -> None 194 + in 195 + (match share_dir with 196 + | Some dir -> 197 + let path = dir ^ "/x-ocaml.js" in 198 + if Sys.file_exists path then 199 + Api.Registry.register_support_file ~prefix:"x-ocaml" { 200 + filename = "_x-ocaml/x-ocaml.js"; 201 + content = Copy_from path; 202 + } 203 + | None -> ())