this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Async

+36 -21
+1 -1
example/dune
··· 64 64 (targets 65 65 (dir _opam)) 66 66 (action 67 - (run jtw opam -o _opam stringext))) 67 + (run jtw opam -o _opam stringext core))) 68 68 69 69 (alias 70 70 (name default)
+1 -1
example/unix_worker.ml
··· 118 118 if List.length urls > 0 then failwith "Not implemented" else () 119 119 120 120 let init_function _ () = failwith "Not implemented" 121 - let findlib_init _ = () 121 + let findlib_init _ = Lwt.return () 122 122 let get_stdlib_dcs _uri = [] 123 123 124 124 let require _ () packages =
+19 -8
lib/findlibish.ml
··· 109 109 Rpcmarshal.unmarshal 110 110 Js_top_worker_rpc.Toplevel_api_gen.typ_of_dynamic_cmis rpc 111 111 112 - let init sync_get findlib_index : t = 112 + let (let*) = Lwt.bind 113 + 114 + let init (async_get : string -> (string, [>`Msg of string]) result Lwt.t) findlib_index : t Lwt.t = 113 115 Jslib.log "Initializing findlib"; 116 + let* findlib_txt = async_get findlib_index in 114 117 let findlib_metas = 115 - match sync_get findlib_index with 116 - | None -> [] 117 - | Some txt -> Astring.String.fields ~empty:false txt 118 + match findlib_txt with 119 + | Error (`Msg m) -> 120 + Jslib.log "Error fetching findlib index: %s" m; 121 + [] 122 + | Ok txt -> Astring.String.fields ~empty:false txt 118 123 in 119 - let metas = 120 - List.filter_map 124 + let* metas = 125 + Lwt_list.map_p 121 126 (fun x -> 122 - match sync_get x with Some meta -> Some (x, meta) | None -> None) 127 + let* res = async_get x in 128 + match res with 129 + | Error (`Msg m) -> 130 + Jslib.log "Error fetching findlib meta %s: %s" x m; 131 + Lwt.return_none 132 + | Ok meta -> Lwt.return_some (x, meta)) 123 133 findlib_metas 124 134 in 135 + let metas = List.filter_map Fun.id metas in 125 136 List.filter_map 126 137 (fun (x, meta) -> 127 138 match Angstrom.parse_string ~consume:All Uri.Parser.uri_reference x with ··· 150 161 Jslib.log "Failed to parse uri: %s" m; 151 162 None) 152 163 metas 153 - |> flatten_libs 164 + |> flatten_libs |> Lwt.return 154 165 155 166 let require sync_get cmi_only v packages = 156 167 let rec require dcss package :
+9 -5
lib/impl.ml
··· 109 109 val import_scripts : string list -> unit 110 110 val init_function : string -> unit -> unit 111 111 val get_stdlib_dcs : string -> Toplevel_api_gen.dynamic_cmis list 112 - val findlib_init : string -> findlib_t 112 + val findlib_init : string -> findlib_t Lwt.t 113 113 val path : string 114 114 115 115 val require : ··· 120 120 let functions : (unit -> unit) list option ref = ref None 121 121 let requires : string list ref = ref [] 122 122 let path : string option ref = ref None 123 - let findlib_v : S.findlib_t option ref = ref None 123 + let findlib_v : S.findlib_t Lwt.t option ref = ref None 124 124 let execution_allowed = ref true 125 125 126 126 let refill_lexbuf s p ppf buffer len = ··· 373 373 path := Some S.path; 374 374 375 375 findlib_v := Some (S.findlib_init "findlib_index"); 376 + 376 377 let stdlib_dcs = 377 378 match init_libs.stdlib_dcs with 378 379 | Some dcs -> dcs ··· 418 419 failwith ("Error: " ^ err) 419 420 in 420 421 421 - let dcs = 422 + let* dcs = 422 423 match !findlib_v with 423 - | Some v -> S.require (not !execution_allowed) v !requires 424 - | None -> [] 424 + | Some v -> 425 + let* v = v in 426 + Lwt.return (S.require (not !execution_allowed) v !requires) 427 + | None -> Lwt.return [] 425 428 in 429 + 426 430 let* () = Lwt_list.iter_p add_dynamic_cmis dcs in 427 431 428 432 Logs.info (fun m -> m "setup() finished");
+1 -1
lib/worker.ml
··· 59 59 Findlibish.fetch_dynamic_cmis sync_get uri |> Result.to_list 60 60 61 61 let import_scripts = Js_of_ocaml.Worker.import_scripts 62 - let findlib_init = Findlibish.init sync_get 62 + let findlib_init = Findlibish.init async_get 63 63 64 64 let require b v = function 65 65 | [] -> []
+3 -3
test/node/node_test.expected
··· 1 1 node_test.js: [INFO] init() 2 2 Initializing findlib 3 - node_test.js: [INFO] sync_get: _opam/findlib_index 4 - node_test.js: [INFO] sync_get: _opam/lib/ocaml/stdlib/META 5 - node_test.js: [INFO] sync_get: _opam/lib/astring/META 3 + node_test.js: [INFO] async_get: _opam/findlib_index 4 + node_test.js: [INFO] async_get: _opam/lib/ocaml/stdlib/META 5 + node_test.js: [INFO] async_get: _opam/lib/astring/META 6 6 Parsed uri: lib/ocaml/stdlib/META 7 7 Parsed uri: lib/astring/META 8 8 node_test.js: [INFO] sync_get: _opam/lib/ocaml/dynamic_cmis.json
+1 -1
test/node/node_test.ml
··· 54 54 if List.length urls > 0 then failwith "Not implemented" else () 55 55 56 56 let init_function _ () = failwith "Not implemented" 57 - let findlib_init = Js_top_worker_web.Findlibish.init sync_get 57 + let findlib_init = Js_top_worker_web.Findlibish.init async_get 58 58 59 59 let get_stdlib_dcs uri = 60 60 Js_top_worker_web.Findlibish.fetch_dynamic_cmis sync_get uri
+1 -1
test/unix/unix_test.ml
··· 73 73 if List.length urls > 0 then failwith "Not implemented" else () 74 74 75 75 let init_function _ () = failwith "Not implemented" 76 - let findlib_init _ = () 76 + let findlib_init _ = Lwt.return () 77 77 let get_stdlib_dcs _uri = [] 78 78 79 79 let require _ () packages =