package b0
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=00a6868b4dfa34565d0141b335622a81a0e8d5b9e3c6dfad025dabfa3df2db2a1302b492953bbbce30c3a4406c324fcec25250a00b38f6d18a69e15605e3b07e
doc/b0.kit/B0_jsoo/index.html
Module B0_jsooSource
js_of_ocaml B0 file support
Metadata
The type for js_of_ocaml compilation either whole program compilation mode for runtime efficiency and minimality or `Separate for build time efficiency.
comp are options added to the js_of_ocaml compile subcommand.
mode is the js_of_ocaml compilation mode.
FIXME this should likely be a store key.
source_map is the source map option.
tag indicates the entity is related to js_of_ocaml.
toplevel should be true to embed toplevel support in the js executable.
link are options added to the js_of_ocaml link subcommand.
assets_root indicates the path w.r.t. to which assets are are B0_std.Fpath.rerooted. Assets that are not prefixed by assets_root are simply copied at the toplevel of the build dir.
val meta :
?meta:B0_meta.t ->
?assets_root:B0_std.Fpath.t ->
?comp:B0_std.Cmd.t ->
?comp_mode:comp_mode ->
?link:B0_std.Cmd.t ->
?requires:B00_ocaml.Lib.Name.t list ->
?source_map:B00_jsoo.source_map ->
?toplevel:bool ->
unit ->
B0_meta.tmeta creates a base metadata dictionary for compiling with js_of_ocaml. See the corresponding keys above. FIXME defaults.
Build units
val exe :
?wrap:(B0_unit.proc -> B0_unit.proc) ->
?doc:string ->
?meta:B0_meta.t ->
?action:B0_unit.action ->
?name:string ->
string ->
srcs:B0_srcs.sels ->
B0_unit.texe n is a JavaScript "executable" file named n.
docis the unit doc string.metais the initial metadata.requiresare the OCaml libraries required to compile the JavaScript.nameis the name of the unit (defaults tonwith.replaced by-).srcsare the executable sources. All files with extension.ml,.mliand.jsare considered for compiling and linked in the JavaScript file.wrapallows to extend the build procedure you must call the given build procedure. TODO maybe remove once we have good Build fragments.
val web :
?wrap:(B0_unit.proc -> B0_unit.proc) ->
?doc:string ->
?meta:B0_meta.t ->
?action:B0_unit.action ->
?name:string ->
string ->
srcs:B0_srcs.sels ->
B0_unit.tweb n is an HTML page named n (without the .html extension FIXME review that).
docis the unit doc string.metais the initial metadata.requiresare the OCaml libraries required to compile the JavaScript.nameis the name of the unit (defaults ton).srcsare the executable sources. All files with extension.ml,.mliand.jsare considered for compiling and linking the executable. The filesB00_fexts.wwwinsrcsminus.jsfiles are copied over the build directory. If these files are can be rerooted to the build dir according toassets_dirthey are copied as such otherwise they are copiedassets_dirFIXME. A competing idea was to have a notion of root induced byB0_srcsselection. See the commented stuff there. This is likely something that will play better with generated assets. It's also sligthly borderline with deployements.wrapallows to extend the build procedure you must call the given build procedure. TODO maybe remove once we have good Build fragments.
TODO document. The js file is n.js, if there's no .html source in the srcs a minimal HTML file is generated in which n.js is linked as a script and any css file in srcs as a stylesheet.
Build fragments
See TODO.
val copy_assets :
B00.Memo.t ->
B00_fexts.map ->
exts:B00_fexts.t ->
assets_root:B0_std.Fpath.t option ->
dst:B0_std.Fpath.t ->
B0_std.Fpath.Set.tcopy_assets m srcs ~exts ~assets_root ~dst copies srcs with extensions in exts to dst. If assets_root is specified indicates the path w.r.t. which assets are B0_std.Fpath.rerooted. Assets that are not prefixed by assets_root are simply copied at the toplevel of dst.
FIXME. Not a good idea to ready them inside. But all this needs a good review.