this repo has no description

feat: wire @x-ocaml.requires through to worker init

- Add --copy-file flag to jtw opam/opam-all for including x-ocaml.js
and other assets in universe output
- Pass findlib_requires and findlib_index from meta tags through to
the JTW worker init, so @x-ocaml.requires packages are loaded
during setup
- x_ocaml.ml reads <meta name="x-ocaml-packages"> and
<meta name="x-ocaml-universe"> before creating the backend

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

+28 -4
+28 -4
bin/jtw.ml
··· 73 73 Format.eprintf "Warning: Failed to read deps file %s: %s\n%!" path m; 74 74 [] 75 75 76 - let opam verbose output_dir_str switch libraries no_worker path deps_file = 76 + let copy_extra_files output_dir files = 77 + List.iter (fun src -> 78 + let src = Fpath.v src in 79 + let dst = Fpath.(output_dir / Fpath.filename src) in 80 + Util.cp src dst; 81 + Format.eprintf "Copied %a to %a\n%!" Fpath.pp src Fpath.pp dst) 82 + files 83 + 84 + let opam verbose output_dir_str switch libraries no_worker path deps_file extra_files = 77 85 Opam.switch := switch; 78 86 (* When --path is specified, only compile the specified libraries (no deps) *) 79 87 let libraries_with_deps, libraries_only = ··· 293 301 let () = 294 302 if no_worker then () else Mk_backend.mk switch output_dir 295 303 in 304 + copy_extra_files output_dir extra_files; 296 305 297 306 `Ok () 298 307 ··· 404 413 let local_meta_path = Fpath.(v "lib" // meta_rel / "META" |> to_string) in 405 414 (pkg_path, local_meta_path, pkg_deps) 406 415 407 - let opam_all verbose output_dir_str switch libraries no_worker all_pkgs = 416 + let opam_all verbose output_dir_str switch libraries no_worker all_pkgs extra_files = 408 417 Opam.switch := switch; 409 418 410 419 (* Get all packages and their dependencies *) ··· 491 500 492 501 (* Generate worker.js if requested *) 493 502 let () = if no_worker then () else Mk_backend.mk switch output_dir in 503 + copy_extra_files output_dir extra_files; 494 504 495 505 `Ok () 496 506 ··· 530 540 in 531 541 Arg.(value & opt (some string) None & info [ "deps-file" ] ~doc) 532 542 in 543 + let extra_files = 544 + let doc = 545 + "Copy file into the output directory (e.g., --copy-file /path/to/x-ocaml.js). \ 546 + May be repeated." 547 + in 548 + Arg.(value & opt_all string [] & info [ "copy-file" ] ~doc) 549 + in 533 550 let info = Cmd.info "opam" ~doc:"Generate opam files" in 534 551 Cmd.v info 535 - Term.(ret (const opam $ verbose $ output_dir $ switch $ libraries $ no_worker $ path $ deps_file)) 552 + Term.(ret (const opam $ verbose $ output_dir $ switch $ libraries $ no_worker $ path $ deps_file $ extra_files)) 536 553 537 554 let opam_all_cmd = 538 555 let libraries = Arg.(value & pos_all string [] & info [] ~docv:"LIB") in ··· 558 575 let doc = "Build all installed packages (from ocamlfind list)" in 559 576 Arg.(value & flag & info [ "all" ] ~doc) 560 577 in 578 + let extra_files = 579 + let doc = 580 + "Copy file into the output directory (e.g., --copy-file /path/to/x-ocaml.js). \ 581 + May be repeated." 582 + in 583 + Arg.(value & opt_all string [] & info [ "copy-file" ] ~doc) 584 + in 561 585 let info = Cmd.info "opam-all" ~doc:"Generate universes for all packages and their dependencies" in 562 586 Cmd.v info 563 - Term.(ret (const opam_all $ verbose $ output_dir $ switch $ libraries $ no_worker $ all_pkgs)) 587 + Term.(ret (const opam_all $ verbose $ output_dir $ switch $ libraries $ no_worker $ all_pkgs $ extra_files)) 564 588 565 589 let main_cmd = 566 590 let doc = "An odoc notebook tool" in