this repo has no description

rename findlib_index to findlib_index.json, standardise meta_files key

Writers (jtw.ml opam mode): output filename changed from findlib_index
to findlib_index.json, JSON key from "metas" to "meta_files".

Reader (findlibish.ml): universe link resolution uses .json extension.
Runtime default (impl.ml): changed from "findlib_index" to
"findlib_index.json".

JS client, test fixtures, HTML test pages, and documentation updated
to match.

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

+42 -42
+8 -8
bin/jtw.ml
··· 220 220 in 221 221 (* TODO: dep_paths should also contribute META paths once we have full universe info *) 222 222 let _ = dep_paths in 223 - let findlib_json = `Assoc [("metas", `List metas_json)] in 223 + let findlib_json = `Assoc [("meta_files", `List metas_json)] in 224 224 Out_channel.with_open_bin 225 - Fpath.(output_dir / "findlib_index" |> to_string) 225 + Fpath.(output_dir / "findlib_index.json" |> to_string) 226 226 (fun oc -> Printf.fprintf oc "%s\n" (Yojson.Safe.to_string findlib_json)); 227 227 228 228 (* Compile archives for each library AND its subpackages *) ··· 473 473 deps 474 474 in 475 475 let all_metas = this_meta :: dep_metas in 476 - let findlib_json = `Assoc [("metas", `List (List.map (fun s -> `String s) all_metas))] in 477 - Out_channel.with_open_bin Fpath.(output_dir / pkg_path / "findlib_index" |> to_string) 476 + let findlib_json = `Assoc [("meta_files", `List (List.map (fun s -> `String s) all_metas))] in 477 + Out_channel.with_open_bin Fpath.(output_dir / pkg_path / "findlib_index.json" |> to_string) 478 478 (fun oc -> Printf.fprintf oc "%s\n" (Yojson.Safe.to_string findlib_json))) 479 479 pkg_results; 480 480 481 - (* Generate root findlib_index with all META paths *) 481 + (* Generate root findlib_index.json with all META paths *) 482 482 let all_metas = List.map (fun (pkg_path, local_meta_path, _) -> 483 483 pkg_path ^ "/" ^ local_meta_path) 484 484 pkg_results 485 485 in 486 - let root_index = `Assoc [("metas", `List (List.map (fun s -> `String s) all_metas))] in 487 - Out_channel.with_open_bin Fpath.(output_dir / "findlib_index" |> to_string) 486 + let root_index = `Assoc [("meta_files", `List (List.map (fun s -> `String s) all_metas))] in 487 + Out_channel.with_open_bin Fpath.(output_dir / "findlib_index.json" |> to_string) 488 488 (fun oc -> Printf.fprintf oc "%s\n" (Yojson.Safe.to_string root_index)); 489 489 490 - Format.eprintf "Generated root findlib_index with %d META files\n%!" (List.length pkg_results); 490 + Format.eprintf "Generated root findlib_index.json with %d META files\n%!" (List.length pkg_results); 491 491 492 492 (* Generate worker.js if requested *) 493 493 let () = if no_worker then () else Mk_backend.mk switch output_dir in
+1 -1
client/ocaml-worker.d.ts
··· 7 7 findlib_requires: string[]; 8 8 /** URL to dynamic CMIs for stdlib */ 9 9 stdlib_dcs?: string; 10 - /** URL to findlib_index file */ 10 + /** URL to findlib_index.json file */ 11 11 findlib_index?: string; 12 12 } 13 13
+7 -7
client/ocaml-worker.js
··· 11 11 * 12 12 * await worker.init({ 13 13 * findlib_requires: [], 14 - * findlib_index: 'findlib_index' 14 + * findlib_index: 'findlib_index.json' 15 15 * }); 16 16 * 17 17 * const result = await worker.eval('let x = 1 + 2;;'); ··· 23 23 * @typedef {Object} InitConfig 24 24 * @property {string[]} findlib_requires - Findlib packages to require 25 25 * @property {string} [stdlib_dcs] - URL to dynamic CMIs for stdlib 26 - * @property {string} [findlib_index] - URL to findlib_index file 26 + * @property {string} [findlib_index] - URL to findlib_index.json file 27 27 */ 28 28 29 29 /** ··· 112 112 } 113 113 114 114 /** 115 - * Create a worker from a findlib_index URL. 116 - * The findlib_index JSON contains compiler info (version, content_hash) and 115 + * Create a worker from a findlib_index.json URL. 116 + * The findlib_index.json contains compiler info (version, content_hash) and 117 117 * META file paths. This is the single entry point for discovery. 118 - * @param {string} indexUrl - URL to findlib_index (e.g., '/jtw-output/u/<hash>/findlib_index') 118 + * @param {string} indexUrl - URL to findlib_index.json (e.g., '/jtw-output/u/<hash>/findlib_index.json') 119 119 * @param {string} baseOutputUrl - Base URL of the jtw-output directory (e.g., '/jtw-output') 120 120 * @param {Object} [options] - Options passed to OcamlWorker constructor 121 121 * @returns {Promise<{worker: OcamlWorker, findlib_index: string, stdlib_dcs: string}>} 122 122 */ 123 123 static async fromIndex(indexUrl, baseOutputUrl, options = {}) { 124 124 const resp = await fetch(indexUrl); 125 - if (!resp.ok) throw new Error(`Failed to fetch findlib_index: ${resp.status}`); 125 + if (!resp.ok) throw new Error(`Failed to fetch findlib_index.json: ${resp.status}`); 126 126 const index = await resp.json(); 127 127 const compiler = index.compiler; 128 - if (!compiler) throw new Error('No compiler info in findlib_index'); 128 + if (!compiler) throw new Error('No compiler info in findlib_index.json'); 129 129 const ver = compiler.version; 130 130 const hash = compiler.content_hash; 131 131 const workerUrl = `${baseOutputUrl}/compiler/${ver}/${hash}/worker.js`;
+2 -2
docs/architecture.md
··· 184 184 185 185 ``` 186 186 ┌─────────────────┐ 187 - │ findlib_index │ (list of META URLs) 187 + │ findlib_index.json │ (list of META URLs) 188 188 └────────┬────────┘ 189 189 190 190 ┌──────────────┼──────────────┐ ··· 209 209 210 210 ### Package Loading Process 211 211 212 - 1. Fetch `findlib_index` (list of META file URLs) 212 + 1. Fetch `findlib_index.json` (list of META file URLs) 213 213 2. Parse each META file with `Fl_metascanner` 214 214 3. Build dependency graph 215 215 4. On `#require`:
+3 -3
example/README.md
··· 50 50 This creates `_build/default/example/_opam/` containing: 51 51 - `worker.js` - The WebWorker toplevel 52 52 - `lib/` - Compiled CMI files and JavaScript-compiled CMA files 53 - - `findlib_index` - Index of available packages 53 + - `findlib_index.json` - Index of available packages 54 54 55 55 ### 3. Start the Web Server 56 56 ··· 77 77 ├── _opam/ # Generated: compiled packages 78 78 │ ├── worker.js # The compiled WebWorker 79 79 │ ├── lib/ # CMI files and .cma.js files 80 - │ └── findlib_index # Package index 80 + │ └── findlib_index.json # Package index 81 81 └── *.html, *.ml # Other example files 82 82 ``` 83 83 ··· 164 164 165 165 - The worker loads files via HTTP; check network tab 166 166 - Ensure `lib/ocaml/` directory has CMI files 167 - - Check `findlib_index` file exists 167 + - Check `findlib_index.json` file exists 168 168 169 169 ### Library not found with #require 170 170
+1 -1
idl/toplevel_api.ml
··· 189 189 type init_config = { 190 190 findlib_requires : string list; (** Findlib packages to require *) 191 191 stdlib_dcs : string option; (** URL to the dynamic cmis for the OCaml standard library *) 192 - findlib_index : string option; (** URL to the findlib_index file. Defaults to "findlib_index" *) 192 + findlib_index : string option; (** URL to the findlib_index.json file. Defaults to "findlib_index.json" *) 193 193 execute : bool (** Whether this session should support execution or not. *) 194 194 } [@@deriving rpcty] 195 195 type err = InternalError of string [@@deriving rpcty]
+2 -2
idl/toplevel_api_gen.ml
··· 1979 1979 [@ocaml.doc " URL to the dynamic cmis for the OCaml standard library "]; 1980 1980 findlib_index: string option 1981 1981 [@ocaml.doc 1982 - " URL to the findlib_index file. Defaults to \"findlib_index\" "]; 1982 + " URL to the findlib_index.json file. Defaults to \"findlib_index.json\" "]; 1983 1983 execute: bool 1984 1984 [@ocaml.doc " Whether this session should support execution or not. "]} 1985 1985 [@@deriving rpcty] ··· 2016 2016 (Rpc.Types.Option (let open Rpc.Types in Basic String)); 2017 2017 Rpc.Types.fdefault = None; 2018 2018 Rpc.Types.fdescription = 2019 - ["URL to the findlib_index file. Defaults to \"findlib_index\""]; 2019 + ["URL to the findlib_index.json file. Defaults to \"findlib_index.json\""]; 2020 2020 Rpc.Types.fversion = None; 2021 2021 Rpc.Types.fget = (fun _r -> _r.findlib_index); 2022 2022 Rpc.Types.fset = (fun v _s -> { _s with findlib_index = v })
+1 -1
lib/findlibish.ml
··· 244 244 (* Resolve universe paths from root (they're already full paths) *) 245 245 let universe_index_urls = 246 246 List.map (fun u -> 247 - resolve_from_root ~base:index_url (Filename.concat u "findlib_index")) 247 + resolve_from_root ~base:index_url (Filename.concat u "findlib_index.json")) 248 248 universes 249 249 in 250 250 let* universe_libs = Lwt_list.map_p load_universe universe_index_urls in
+1 -1
lib/impl.ml
··· 658 658 Logs.info (fun m -> m "init()"); 659 659 path := Some S.path; 660 660 661 - let findlib_path = Option.value ~default:"findlib_index" init_libs.findlib_index in 661 + let findlib_path = Option.value ~default:"findlib_index.json" init_libs.findlib_index in 662 662 findlib_v := Some (S.findlib_init findlib_path); 663 663 664 664 let stdlib_dcs =
+1 -1
test/node/node_dependency_test.expected
··· 1 1 === Node.js Cell Dependency Tests === 2 2 3 3 Initializing findlib 4 - Loaded findlib_index findlib_index: 10 META files, 0 universes 4 + Loaded findlib_index findlib_index.json: 10 META files, 0 universes 5 5 Parsed uri: ./lib/stdlib-shims/META 6 6 Reading library: stdlib-shims 7 7 Number of children: 0
+1 -1
test/node/node_directive_test.expected
··· 2 2 3 3 node_directive_test.js: [INFO] init() 4 4 Initializing findlib 5 - Loaded findlib_index findlib_index: 10 META files, 0 universes 5 + Loaded findlib_index findlib_index.json: 10 META files, 0 universes 6 6 Parsed uri: ./lib/stdlib-shims/META 7 7 Reading library: stdlib-shims 8 8 Number of children: 0
+1 -1
test/node/node_env_test.expected
··· 2 2 3 3 node_env_test.js: [INFO] init() 4 4 Initializing findlib 5 - Loaded findlib_index findlib_index: 10 META files, 0 universes 5 + Loaded findlib_index findlib_index.json: 10 META files, 0 universes 6 6 Parsed uri: ./lib/stdlib-shims/META 7 7 Reading library: stdlib-shims 8 8 Number of children: 0
+2 -2
test/node/node_incremental_test.expected
··· 1 1 node_incremental_test.js: [INFO] init() 2 2 Initializing findlib 3 - node_incremental_test.js: [INFO] async_get: _opam/findlib_index 4 - Loaded findlib_index findlib_index: 10 META files, 0 universes 3 + node_incremental_test.js: [INFO] async_get: _opam/findlib_index.json 4 + Loaded findlib_index findlib_index.json: 10 META files, 0 universes 5 5 node_incremental_test.js: [INFO] async_get: _opam/./lib/stdlib-shims/META 6 6 Parsed uri: ./lib/stdlib-shims/META 7 7 Reading library: stdlib-shims
+1 -1
test/node/node_mime_test.expected
··· 2 2 3 3 node_mime_test.js: [INFO] init() 4 4 Initializing findlib 5 - Loaded findlib_index findlib_index: 10 META files, 0 universes 5 + Loaded findlib_index findlib_index.json: 10 META files, 0 universes 6 6 Parsed uri: ./lib/stdlib-shims/META 7 7 Reading library: stdlib-shims 8 8 Number of children: 0
+1 -1
test/node/node_ppx_test.expected
··· 2 2 3 3 node_ppx_test.js: [INFO] init() 4 4 Initializing findlib 5 - Loaded findlib_index findlib_index: 10 META files, 0 universes 5 + Loaded findlib_index findlib_index.json: 10 META files, 0 universes 6 6 Parsed uri: ./lib/stdlib-shims/META 7 7 Reading library: stdlib-shims 8 8 Number of children: 0
+2 -2
test/node/node_test.expected
··· 1 1 node_test.js: [INFO] init() 2 2 Initializing findlib 3 - node_test.js: [INFO] async_get: _opam/findlib_index 4 - Loaded findlib_index findlib_index: 10 META files, 0 universes 3 + node_test.js: [INFO] async_get: _opam/findlib_index.json 4 + Loaded findlib_index findlib_index.json: 10 META files, 0 universes 5 5 node_test.js: [INFO] async_get: _opam/./lib/stdlib-shims/META 6 6 Parsed uri: ./lib/stdlib-shims/META 7 7 Reading library: stdlib-shims
+1 -1
test/ohc-integration/SETUP.md
··· 100 100 dynamic_cmis.json # Stdlib module index 101 101 *.cmi, stdlib.cma.js # Stdlib artifacts 102 102 u/<universe-hash>/ # One per (package, version) universe 103 - findlib_index # JSON: list of META file paths 103 + findlib_index.json # JSON: list of META file paths 104 104 <pkg>/<ver>/lib/<findlib>/ # Package artifacts 105 105 META, *.cmi, *.cma.js, dynamic_cmis.json 106 106 p/<pkg>/<ver>/lib/... # Blessed packages (same structure)
+2 -2
test/ohc-integration/eval-test.html
··· 29 29 throw new Error('universe parameter required'); 30 30 } 31 31 32 - status.textContent = 'Fetching findlib_index...'; 33 - const indexUrl = `/jtw-output/u/${universe}/findlib_index`; 32 + status.textContent = 'Fetching findlib_index.json...'; 33 + const indexUrl = `/jtw-output/u/${universe}/findlib_index.json`; 34 34 const { worker, stdlib_dcs, findlib_index } = await OcamlWorker.fromIndex( 35 35 indexUrl, '/jtw-output', { timeout: 120000 }); 36 36
+1 -1
test/ohc-integration/runner.html
··· 484 484 485 485 async function getWorker(universe) { 486 486 if (workerCache.has(universe)) return workerCache.get(universe); 487 - const indexUrl = `/jtw-output/u/${universe}/findlib_index`; 487 + const indexUrl = `/jtw-output/u/${universe}/findlib_index.json`; 488 488 const { worker: w, stdlib_dcs, findlib_index } = await OcamlWorker.fromIndex( 489 489 indexUrl, '/jtw-output', { timeout: 120000 }); 490 490 await w.init({
+2 -2
test/ohc-integration/test.html
··· 31 31 throw new Error('universe parameter required'); 32 32 } 33 33 34 - status.textContent = 'Fetching findlib_index...'; 35 - const indexUrl = `/jtw-output/u/${universe}/findlib_index`; 34 + status.textContent = 'Fetching findlib_index.json...'; 35 + const indexUrl = `/jtw-output/u/${universe}/findlib_index.json`; 36 36 const { worker, stdlib_dcs, findlib_index } = await OcamlWorker.fromIndex( 37 37 indexUrl, '/jtw-output', { timeout: 120000 }); 38 38
+1 -1
test/ohc-integration/tutorials/tutorial.html
··· 164 164 initEl.innerHTML = '<span class="spinner">&#x25E0;</span> Initializing OCaml worker...'; 165 165 let worker; 166 166 try { 167 - const indexUrl = `/jtw-output/u/${tutorial.universe}/findlib_index`; 167 + const indexUrl = `/jtw-output/u/${tutorial.universe}/findlib_index.json`; 168 168 const { worker: w, stdlib_dcs, findlib_index } = await OcamlWorker.fromIndex( 169 169 indexUrl, '/jtw-output', { timeout: 120000 }); 170 170 worker = w;